MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / tryToLoadGame

Method tryToLoadGame

game/ui/general/savemenu.cpp:255–278  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

253}
254
255void SaveMenu::tryToLoadGame(sp<Control> slotControl)
256{
257 if (slotControl->Name == existingSaveItemId)
258 {
259 sp<SaveMetadata> slot = slotControl->getData<SaveMetadata>();
260 if (slot != nullptr)
261 {
262 auto state = mksp<GameState>();
263 auto task = saveManager.loadGame(*slot, state);
264 fw().stageQueueCommand(
265 {StageCmd::Command::PUSH,
266 mksp<LoadingScreen>(nullptr, std::move(task), [state]() -> sp<Stage> {
267 if (state->current_battle)
268 {
269 return mksp<BattleView>(state);
270 }
271 else
272 {
273 return mksp<CityView>(state);
274 }
275 })});
276 }
277 }
278}
279
280void SaveMenu::tryToSaveGame(const UString &saveName, sp<Control> parent)
281{

Callers

nothing calls this directly

Calls 2

stageQueueCommandMethod · 0.80
loadGameMethod · 0.45

Tested by

no test coverage detected