MCPcopy Create free account
hub / github.com/OpenLoco/OpenLoco / init

Function init

src/OpenLoco/src/EditorController.cpp:43–133  ·  view source on GitHub ↗

0x0043D7DC

Source from the content-addressed store, hash-verified

41
42 // 0x0043D7DC
43 void init()
44 {
45 SceneManager::removeSceneFlags(SceneManager::Flags::title);
46 SceneManager::addSceneFlags(SceneManager::Flags::editor);
47 SceneManager::setGameSpeed(GameSpeed::Normal);
48
49 auto& options = Scenario::getOptions();
50 auto& gameState = getGameState();
51
52 options.editorStep = Step::objectSelection;
53 options.difficulty = 2;
54 options.madeAnyChanges = 0;
55 options.scenarioFlags = Scenario::ScenarioFlags::landscapeGenerationDone;
56 gameState.lastLandOption = 0xFF;
57 gameState.lastMapWindowAttributes.flags = WindowFlags::none;
58
59 WindowManager::closeAllFloatingWindows();
60 resetSubsystems();
61 MessageManager::reset();
62 Audio::pauseSound();
63 Audio::unpauseSound();
64 ObjectManager::unloadAll();
65 auto& selection = ObjectManager::prepareSelectionList(false);
66 ObjectManager::loadSelectionListObjects(selection.objectFlags);
67 ObjectManager::freeSelectionList();
68 ObjectManager::reloadAll();
69 Scenario::sub_4748D4();
70
71 options.scenarioStartYear = 1900;
72 gameState.seaLevel = 4;
73 options.minLandHeight = 2;
74 options.topographyStyle = Scenario::TopographyStyle::mountains;
75 options.hillDensity = 50;
76 options.numberOfForests = 100;
77 options.minForestRadius = 4;
78 options.maxForestRadius = 40;
79 options.minForestDensity = 1;
80 options.maxForestDensity = 7;
81 options.numberRandomTrees = 1000;
82 options.minAltitudeForTrees = 0;
83 options.maxAltitudeForTrees = 25;
84 options.numberOfTowns = 55;
85 options.maxTownSize = 3;
86 options.numberOfIndustries = 1;
87
88 resetLandDistributionPatterns();
89 Scenario::reset();
90
91 gameState.maxCompetingCompanies = 8;
92 gameState.competitorStartDelay = 0;
93 gameState.preferredAIIntelligence = 0;
94 gameState.preferredAIAggressiveness = 0;
95 gameState.preferredAICompetitiveness = 0;
96 gameState.startingLoanSize = 1250;
97 gameState.maxLoanSize = 3750;
98 gameState.loanInterestRate = 10;
99 gameState.industryFlags = IndustryManager::Flags::none;
100 gameState.forbiddenVehiclesPlayers = 0;

Callers

nothing calls this directly

Calls 15

removeSceneFlagsFunction · 0.85
addSceneFlagsFunction · 0.85
resetSubsystemsFunction · 0.85
pauseSoundFunction · 0.85
unpauseSoundFunction · 0.85
unloadAllFunction · 0.85
loadSelectionListObjectsFunction · 0.85
freeSelectionListFunction · 0.85
reloadAllFunction · 0.85
sub_4748D4Function · 0.85
initialiseDateFunction · 0.85

Tested by

no test coverage detected