| 221 | } |
| 222 | |
| 223 | void SaveMenu::loadWithWarning(sp<Control> parent) |
| 224 | { |
| 225 | if (parent->Name == existingSaveItemId) |
| 226 | { |
| 227 | sp<SaveMetadata> slot = parent->getData<SaveMetadata>(); |
| 228 | if (slot != nullptr) |
| 229 | { |
| 230 | std::function<void()> onSuccess = std::function<void()>([this, slot] { |
| 231 | auto state = mksp<GameState>(); |
| 232 | auto task = saveManager.loadGame(*slot, state); |
| 233 | fw().stageQueueCommand( |
| 234 | {StageCmd::Command::PUSH, |
| 235 | mksp<LoadingScreen>(nullptr, std::move(task), [state]() -> sp<Stage> { |
| 236 | if (state->current_battle) |
| 237 | { |
| 238 | return mksp<BattleView>(state); |
| 239 | } |
| 240 | else |
| 241 | { |
| 242 | return mksp<CityView>(state); |
| 243 | } |
| 244 | })}); |
| 245 | }); |
| 246 | sp<MessageBox> messageBox = mksp<MessageBox>( |
| 247 | MessageBox("Load game", "Unsaved progress will be lost. Continue?", |
| 248 | MessageBox::ButtonOptions::YesNo, std::move(onSuccess), nullptr)); |
| 249 | |
| 250 | fw().stageQueueCommand({StageCmd::Command::PUSH, messageBox}); |
| 251 | } |
| 252 | } |
| 253 | } |
| 254 | |
| 255 | void SaveMenu::tryToLoadGame(sp<Control> slotControl) |
| 256 | { |
nothing calls this directly
no test coverage detected