| 60 | } |
| 61 | |
| 62 | void Menu_Save::onCustomAction(const std::string& action) |
| 63 | { |
| 64 | if (action.find("MENUITEM_SAVE_SLOT") != std::string::npos) |
| 65 | { |
| 66 | std::string numStr = action.substr(std::string("MENUITEM_SAVE_SLOT").size()); |
| 67 | int index = std::stoi(numStr); |
| 68 | assert(index >= 0 && index < Engine::SavegameManager::maxSlots()); |
| 69 | |
| 70 | if (!m_isWaitingForSaveName) |
| 71 | { |
| 72 | m_isWaitingForSaveName = true; |
| 73 | m_MenuItemSaveSlot = "MENUITEM_SAVE_SLOT" + std::to_string(index); |
| 74 | |
| 75 | const std::string saveGameName = Engine::SavegameManager::isSavegameAvailable(index) ? Engine::SavegameManager::readSavegameInfo(index).name : ""; |
| 76 | m_SaveName.clear(); |
| 77 | |
| 78 | #ifdef ANDROID |
| 79 | m_SaveName = "Slot " + std::to_string(index); |
| 80 | #endif |
| 81 | |
| 82 | onTextInput(saveGameName); |
| 83 | } |
| 84 | else |
| 85 | { |
| 86 | m_isWaitingForSaveName = false; |
| 87 | Engine::SavegameManager::saveToSlot(index, m_SaveName); |
| 88 | // close menus after saving |
| 89 | getHud().popAllMenus(); |
| 90 | } |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | bool Menu_Save::onInputAction(Engine::ActionType action) |
| 95 | { |
nothing calls this directly
no test coverage detected