From 231b4cc9eb67b1d527e24e30c6cebee75e1d5734 Mon Sep 17 00:00:00 2001 From: pionere Date: Tue, 17 Sep 2024 09:19:59 +0200 Subject: [PATCH] use time(NULL) instead of SDL_GetTicks to save the hero data periodically --- Source/pfile.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Source/pfile.cpp b/Source/pfile.cpp index 02d080b411f2..120bed283e2a 100644 --- a/Source/pfile.cpp +++ b/Source/pfile.cpp @@ -11,6 +11,7 @@ #include "diabloui.h" #include "utils/file_util.h" #include "DiabloUI/diablo.h" +#include DEVILUTION_BEGIN_NAMESPACE @@ -22,7 +23,7 @@ DEVILUTION_BEGIN_NAMESPACE unsigned mySaveIdx; bool gbValidSaveFile; -static Uint32 guNextSaveTc; +static uint32_t guNextSaveTc; #define PASSWORD_SINGLE "xrgyrkj1" #define PASSWORD_MULTI "szqnlsk1" @@ -304,7 +305,7 @@ void pfile_read_hero_from_save() mypnum = 0; gbValidSaveFile = pfile_archive_contains_game(archive); SFileCloseArchive(archive); - guNextSaveTc = SDL_GetTicks() + PFILE_SAVE_INTERVAL; + guNextSaveTc = time(NULL) + PFILE_SAVE_INTERVAL; } void pfile_rename_temp_to_perm() @@ -418,7 +419,7 @@ void pfile_read_save_file(bool full) void pfile_update(bool force_save) { if (IsMultiGame) { - Uint32 currTc = SDL_GetTicks(); + Uint32 currTc = time(NULL); if (force_save || currTc > guNextSaveTc) { guNextSaveTc = currTc + PFILE_SAVE_INTERVAL; pfile_write_hero(false);