1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

possibility to restart

This commit is contained in:
Michael 2023-08-23 21:37:44 +02:00 committed by GitHub
parent 4784ae94b5
commit 1586b9fbd1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -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<CInfoWindow>())
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<int>(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);
}
}
}

View File

@ -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;