mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
- fixed savegame validation and recursive ticker calls.
This commit is contained in:
parent
41b116e2f2
commit
c36402eb5c
3 changed files with 23 additions and 10 deletions
|
@ -52,10 +52,17 @@ ATTRIBUTE((flatten)) void timerUpdateClock(void)
|
|||
totalclock += n;
|
||||
timerlastsample += n*nanoseconds(1000000000/timerticspersec);
|
||||
|
||||
// This function can get called from deep within processing loops.
|
||||
// The callbacks in here may not be called recursively, though.
|
||||
static bool recursion;
|
||||
if (recursion) return;
|
||||
recursion = true;
|
||||
|
||||
for (; n > 0; n--)
|
||||
{
|
||||
for (auto cb : callbacks) cb();
|
||||
}
|
||||
recursion = false;
|
||||
}
|
||||
|
||||
void(*timerSetCallback(void(*callback)(void)))(void)
|
||||
|
|
|
@ -205,8 +205,8 @@ void FSavegameManager::ReadSaveStrings()
|
|||
{
|
||||
FSaveGameNode *node = new FSaveGameNode;
|
||||
node->Filename = filepath;
|
||||
node->bOldVersion = true;
|
||||
node->bMissingWads = false;
|
||||
node->bOldVersion = check == -1;
|
||||
node->bMissingWads = check == -2;
|
||||
node->SaveTitle = title;
|
||||
InsertSaveNode(node);
|
||||
}
|
||||
|
@ -281,13 +281,17 @@ void FSavegameManager::NotifyNewSave(const FString &file, const FString &title,
|
|||
|
||||
void FSavegameManager::LoadSavegame(int Selected)
|
||||
{
|
||||
savegameManager.LoadGame(SaveGames[Selected]);
|
||||
if (quickSaveSlot == (FSaveGameNode*)1)
|
||||
auto sel = savegameManager.GetSavegame(Selected);
|
||||
if (sel && !sel->bOldVersion && !sel->bMissingWads)
|
||||
{
|
||||
quickSaveSlot = SaveGames[Selected];
|
||||
savegameManager.LoadGame(SaveGames[Selected]);
|
||||
if (quickSaveSlot == (FSaveGameNode*)1)
|
||||
{
|
||||
quickSaveSlot = SaveGames[Selected];
|
||||
}
|
||||
M_ClearMenus();
|
||||
LastAccessed = Selected;
|
||||
}
|
||||
M_ClearMenus();
|
||||
LastAccessed = Selected;
|
||||
}
|
||||
|
||||
|
||||
|
@ -365,6 +369,7 @@ unsigned FSavegameManager::ExtractSaveData(int index)
|
|||
}
|
||||
auto fr = info->NewReader();
|
||||
auto data = fr.ReadPadded(1);
|
||||
fr.Close();
|
||||
sjson_context* ctx = sjson_create_context(0, 0, NULL);
|
||||
if (ctx)
|
||||
{
|
||||
|
@ -372,8 +377,9 @@ unsigned FSavegameManager::ExtractSaveData(int index)
|
|||
|
||||
|
||||
FString comment = sjson_get_string(root, "Creation Time", "");
|
||||
FString pcomment = sjson_get_string(root, "Comment", "");
|
||||
if (comment.Len() > 0) comment += "\n";
|
||||
FString fcomment = sjson_get_string(root, "Map File", "");
|
||||
FString ncomment = sjson_get_string(root, "Map Name", "");
|
||||
FStringf pcomment("%s - %s\n", fcomment.GetChars(), ncomment.GetChars());
|
||||
comment += pcomment;
|
||||
SaveCommentString = comment;
|
||||
|
||||
|
|
|
@ -665,7 +665,7 @@ bool GameInterface::SaveGame(FSaveGameNode* sv)
|
|||
{
|
||||
videoNextPage(); // no idea if this is needed here.
|
||||
g_screenCapture = 1;
|
||||
G_DrawRooms(myconnectindex, 65536);
|
||||
//G_DrawRooms(myconnectindex, 65536);
|
||||
g_screenCapture = 0;
|
||||
|
||||
return G_SavePlayer(sv);
|
||||
|
|
Loading…
Reference in a new issue