MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / onCustomAction

Method onCustomAction

src/ui/Menu_Save.cpp:62–92  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

60}
61
62void 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
94bool Menu_Save::onInputAction(Engine::ActionType action)
95{

Callers

nothing calls this directly

Calls 4

findMethod · 0.80
popAllMenusMethod · 0.80
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected