MCPcopy Create free account
hub / github.com/ZDoom/Raze / ReadSaveStrings

Method ReadSaveStrings

source/core/menu/loadsavemenu.cpp:60–99  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

58//=============================================================================
59
60void FSavegameManager::ReadSaveStrings()
61{
62 if (SaveGames.Size() == 0)
63 {
64 LastSaved = LastAccessed = -1;
65 quickSaveSlot = nullptr;
66 FileList list;
67 if (ScanDirectory(list, G_GetSavegamesFolder().GetChars(), "*." SAVEGAME_EXT, true))
68 {
69 for (auto& entry : list)
70 {
71 FResourceFile *savegame = FResourceFile::OpenResourceFile(entry.FilePath.c_str(), true);
72 if (savegame != nullptr)
73 {
74 auto info = savegame->FindEntry("info.json");
75 if (info < 0)
76 {
77 // savegame info not found. This is not a savegame so leave it alone.
78 delete savegame;
79 continue;
80 }
81 auto fr = savegame->GetEntryReader(info, true);
82 FString title;
83 int check = G_ValidateSavegame(fr, &title, true);
84 fr.Close();
85 delete savegame;
86 if (check != 0)
87 {
88 FSaveGameNode *node = new FSaveGameNode;
89 node->Filename = entry.FilePath.c_str();
90 node->bOldVersion = check == -1;
91 node->bMissingWads = check == -2;
92 node->SaveTitle = title;
93 InsertSaveNode(node);
94 }
95 }
96 }
97 }
98 }
99}
100
101
102//=============================================================================

Callers 1

DEFINE_ACTION_FUNCTIONFunction · 0.80

Calls 9

ScanDirectoryFunction · 0.85
G_GetSavegamesFolderFunction · 0.85
G_ValidateSavegameFunction · 0.85
c_strMethod · 0.80
SizeMethod · 0.45
GetCharsMethod · 0.45
FindEntryMethod · 0.45
GetEntryReaderMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected