MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / loadRuleset

Method loadRuleset

src/Engine/Game.cpp:528–556  ·  view source on GitHub ↗

* Loads the rulesets specified in the game options. */

Source from the content-addressed store, hash-verified

526 * Loads the rulesets specified in the game options.
527 */
528void 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.

Callers 1

loadMethod · 0.80

Calls 6

ExceptionClass · 0.85
whatMethod · 0.80
sortListsMethod · 0.80
clearMethod · 0.45
emptyMethod · 0.45
loadMethod · 0.45

Tested by

no test coverage detected