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

Function loadGame

src/OpenLoco/src/Game.cpp:109–161  ·  view source on GitHub ↗

0x0043BFF8

Source from the content-addressed store, hash-verified

107
108 // 0x0043BFF8
109 void loadGame()
110 {
111 GameCommands::LoadSaveQuitGameArgs args{};
112 args.loadQuitMode = LoadOrQuitMode::loadGamePrompt;
113 args.saveMode = GameCommands::LoadSaveQuitGameArgs::SaveMode::closeSavePrompt;
114 GameCommands::doCommand(args, GameCommands::Flags::apply);
115
116 ToolManager::toolCancel();
117
118 if (SceneManager::isEditorMode())
119 {
120 if (auto res = Game::loadLandscapeOpen())
121 {
122 // 0x0043C087
123 auto path = fs::u8path(*res).replace_extension(S5::extensionSC5);
124 _activeSavePath = path.u8string();
125
126 // 0x004424CE
127 if (S5::importSaveToGameState(path, S5::LoadFlags::landscape))
128 {
129 SceneManager::resetSceneAge();
130 throw GameException::Interrupt;
131 }
132 }
133 }
134 else if (!SceneManager::isNetworked())
135 {
136 if (auto res = Game::loadSaveGameOpen())
137 {
138 // 0x0043C033
139 auto path = fs::u8path(*res).replace_extension(S5::extensionSV5);
140 _activeSavePath = path.u8string();
141
142 if (S5::importSaveToGameState(path, S5::LoadFlags::none))
143 {
144 SceneManager::resetSceneAge();
145 throw GameException::Interrupt;
146 }
147 }
148 }
149 else if (SceneManager::isNetworked())
150 {
151 // 0x0043C0DB
152 if (CompanyManager::getControllingId() == GameCommands::getUpdatingCompanyId())
153 {
154 MultiPlayer::setFlag(MultiPlayer::flags::flag_4);
155 MultiPlayer::setFlag(MultiPlayer::flags::flag_3);
156 }
157 }
158
159 // 0x0043C0D1
160 Gfx::invalidateScreen();
161 }
162
163 // 0x0043C182
164 void quitGame()

Callers 1

loadSaveQuitFunction · 0.85

Calls 12

isEditorModeFunction · 0.85
loadLandscapeOpenFunction · 0.85
importSaveToGameStateFunction · 0.85
resetSceneAgeFunction · 0.85
isNetworkedFunction · 0.85
loadSaveGameOpenFunction · 0.85
getControllingIdFunction · 0.85
getUpdatingCompanyIdFunction · 0.85
invalidateScreenFunction · 0.85
setFlagFunction · 0.70
doCommandFunction · 0.50
toolCancelFunction · 0.50

Tested by

no test coverage detected