| 27 | } |
| 28 | |
| 29 | void Menu_Load::gatherAvailableSavegames() |
| 30 | { |
| 31 | using namespace Engine; |
| 32 | using namespace Daedalus; |
| 33 | using namespace GEngineClasses; |
| 34 | |
| 35 | auto names = SavegameManager::gatherAvailableSavegames(); |
| 36 | |
| 37 | // gothic 1: Slot 1-15. gothic 2: Slot 1-20 + Slot0 (quicksave) |
| 38 | for (unsigned i = 0; i < names.size(); i++) |
| 39 | { |
| 40 | std::string sym = "MENUITEM_LOAD_SLOT" + std::to_string(i); |
| 41 | bool slotSymbolFound = m_pVM->getDATFile().hasSymbolName(sym); |
| 42 | if (!slotSymbolFound && i == 0) |
| 43 | continue; // Gothic 1 does not have a quicksave slot in the load-menu |
| 44 | |
| 45 | assert(slotSymbolFound); |
| 46 | std::string displayName; |
| 47 | if (names[i] != nullptr) |
| 48 | { |
| 49 | // Toggle selectable depending on whether we actually have a slot here |
| 50 | getItemScriptData(sym).flags |= C_Menu_Item::IT_SELECTABLE; |
| 51 | displayName = *names[i]; |
| 52 | } |
| 53 | else |
| 54 | { |
| 55 | getItemScriptData(sym).flags &= ~C_Menu_Item::IT_SELECTABLE; |
| 56 | displayName = Menu_Load::EMPTY_SLOT_DISPLAYNAME; |
| 57 | } |
| 58 | // never overwrite displayname of quicksave slot (i==0) |
| 59 | if (i != 0) |
| 60 | getItemScriptData(sym).text[0] = displayName; |
| 61 | } |
| 62 | } |
| 63 | |
| 64 | void Menu_Load::onCustomAction(const std::string& action) |
| 65 | { |