From 1586b9fbd16d851097a950110ba65e1c78e914e9 Mon Sep 17 00:00:00 2001 From: Michael <13953785+Laserlicht@users.noreply.github.com> Date: Wed, 23 Aug 2023 21:37:44 +0200 Subject: [PATCH] possibility to restart --- client/CPlayerInterface.cpp | 6 ++---- server/CVCMIServer.cpp | 2 ++ 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/client/CPlayerInterface.cpp b/client/CPlayerInterface.cpp index fcf684593..3c2069874 100644 --- a/client/CPlayerInterface.cpp +++ b/client/CPlayerInterface.cpp @@ -180,7 +180,7 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player) GH.windows().pushWindow(adventureInt); } -//close window from another player + // close window from another player if(auto w = GH.windows().topWindow()) if(w->ID == -1 && player != playerID) w->close(); @@ -201,8 +201,6 @@ void CPlayerInterface::playerStartsTurn(PlayerColor player) void CPlayerInterface::performAutosave() { - std::string id = cb->getStartInfo()->gameUuid.substr(0, 4); - int frequency = static_cast(settings["general"]["saveFrequency"].Integer()); if(frequency > 0 && cb->getDate() % frequency == 0) { @@ -232,7 +230,7 @@ void CPlayerInterface::performAutosave() + std::to_string(cb->getDate(Date::WEEK)) + std::to_string(cb->getDate(Date::DAY_OF_WEEK)); - cb->save("Saves/Autosave/" + prefix + "Autosave_" + id + "_" + stringifiedDate); + cb->save("Saves/Autosave/" + prefix + "Autosave_" + stringifiedDate); } } } diff --git a/server/CVCMIServer.cpp b/server/CVCMIServer.cpp index 83a711fe9..9a7b9abc9 100644 --- a/server/CVCMIServer.cpp +++ b/server/CVCMIServer.cpp @@ -284,6 +284,7 @@ bool CVCMIServer::prepareToStartGame() { case StartInfo::CAMPAIGN: logNetwork->info("Preparing to start new campaign"); + si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(0)); si->campState->setCurrentMap(campaignMap); si->campState->setCurrentMapBonus(campaignBonus); gh->init(si.get()); @@ -291,6 +292,7 @@ bool CVCMIServer::prepareToStartGame() case StartInfo::NEW_GAME: logNetwork->info("Preparing to start new game"); + si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(0)); gh->init(si.get()); break;