* Loads the rulesets specified in the game options. */
| 526 | * Loads the rulesets specified in the game options. |
| 527 | */ |
| 528 | void Game::loadRuleset() |
| 529 | { |
| 530 | Options::badMods.clear(); |
| 531 | _rules = new Ruleset(); |
| 532 | if (Options::rulesets.empty()) |
| 533 | { |
| 534 | Options::rulesets.push_back("Xcom1Ruleset"); |
| 535 | } |
| 536 | for (std::vector<std::string>::iterator i = Options::rulesets.begin(); i != Options::rulesets.end();) |
| 537 | { |
| 538 | try |
| 539 | { |
| 540 | _rules->load(*i); |
| 541 | ++i; |
| 542 | } |
| 543 | catch (YAML::Exception &e) |
| 544 | { |
| 545 | Log(LOG_WARNING) << e.what(); |
| 546 | Options::badMods.push_back(*i); |
| 547 | Options::badMods.push_back(e.what()); |
| 548 | i = Options::rulesets.erase(i); |
| 549 | } |
| 550 | } |
| 551 | if (Options::rulesets.empty()) |
| 552 | { |
| 553 | throw Exception("Failed to load ruleset"); |
| 554 | } |
| 555 | _rules->sortLists(); |
| 556 | } |
| 557 | |
| 558 | /** |
| 559 | * Sets whether the mouse is activated. |