- added date and play time display to savegames.

This commit is contained in:
Christoph Oelckers 2020-01-11 19:40:35 +01:00
parent a5f08a4734
commit 17eddda36c
2 changed files with 6 additions and 2 deletions

View File

@ -379,8 +379,8 @@ unsigned FSavegameManager::ExtractSaveData(int index)
FString comment = sjson_get_string(root, "Creation Time", "");
FString fcomment = sjson_get_string(root, "Map Label", "");
FString ncomment = sjson_get_string(root, "Map Name", "");
FStringf pcomment("%s - %s\n", fcomment.GetChars(), ncomment.GetChars());
comment += pcomment;
FString mtime = sjson_get_string(root, "Map Time", "");
comment.AppendFormat("\n%s - %s\n%s", fcomment.GetChars(), ncomment.GetChars(), mtime.GetChars());
SaveCommentString = comment;
// Extract pic (todo: let the renderer write a proper PNG file instead of a raw canvas dunp of the software renderer - and make it work for all games.)

View File

@ -143,9 +143,13 @@ void G_WriteSaveHeader(const char *name)
sjson_put_string(ctx, root, "Engine", savesig.savesig);
sjson_put_string(ctx, root, "Game Resource", fileSystem.GetResourceFileName(1));
sjson_put_string(ctx, root, "Map Name", currentLevel->DisplayName());
sjson_put_string(ctx, root, "Creation Time", myasctime());
sjson_put_string(ctx, root, "Title", name);
sjson_put_string(ctx, root, "Map File", currentLevel->fileName);
sjson_put_string(ctx, root, "Map Label", currentLevel->labelName);
auto gs = gi->getStats();
FStringf timeStr("%02d:%02d", gs.timesecnd / 60, gs.timesecnd % 60);
sjson_put_string(ctx, root, "Map Time", timeStr);
const char *fn = currentLevel->fileName;
if (*fn == '/') fn++;
if (strncmp(fn, "file://", 7) != 0) // this only has meaning for non-usermaps