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

Method gatherAvailableSavegames

src/ui/Menu_Load.cpp:29–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

27}
28
29void 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
64void Menu_Load::onCustomAction(const std::string& action)
65{

Callers 1

createMethod · 0.45

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected