mirror of
https://github.com/vcmi/vcmi.git
synced 2024-11-21 17:17:06 +02:00
change datetime format
This commit is contained in:
parent
cb91397688
commit
452762cd78
@ -238,7 +238,7 @@ void CPlayerInterface::performAutosave()
|
||||
std::string name = cb->getMapHeader()->name.toString();
|
||||
int txtlen = TextOperations::getUnicodeCharactersCount(name);
|
||||
|
||||
TextOperations::trimRightUnicode(name, std::max(0, txtlen - 15));
|
||||
TextOperations::trimRightUnicode(name, std::max(0, txtlen - 14));
|
||||
auto const & isSymbolIllegal = [&](char c) {
|
||||
static const std::string forbiddenChars("\\/:*?\"<>| ");
|
||||
|
||||
@ -249,7 +249,7 @@ void CPlayerInterface::performAutosave()
|
||||
};
|
||||
std::replace_if(name.begin(), name.end(), isSymbolIllegal, '_' );
|
||||
|
||||
prefix = cb->getStartInfo()->startTimeIso8601 + "_" + name + "/";
|
||||
prefix = vstd::getFormattedDateTime(cb->getStartInfo()->startTime, "%Y-%m-%d_%H-%M") + "_" + name + "/";
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -146,7 +146,7 @@ struct DLL_LINKAGE StartInfo : public Serializeable
|
||||
using TPlayerInfos = std::map<PlayerColor, PlayerSettings>;
|
||||
TPlayerInfos playerInfos; //color indexed
|
||||
|
||||
std::string startTimeIso8601;
|
||||
time_t startTime;
|
||||
std::string fileURI;
|
||||
SimturnsInfo simturnsInfo;
|
||||
TurnTimerInfo turnTimerInfo;
|
||||
@ -180,7 +180,17 @@ struct DLL_LINKAGE StartInfo : public Serializeable
|
||||
h & oldSeeds;
|
||||
h & oldSeeds;
|
||||
}
|
||||
h & startTimeIso8601;
|
||||
if (h.version < Handler::Version::FOLDER_NAME_REWORK)
|
||||
{
|
||||
std::string startTimeLegacy;
|
||||
h & startTimeLegacy;
|
||||
struct std::tm tm;
|
||||
std::istringstream ss(startTimeLegacy);
|
||||
ss >> std::get_time(&tm, "%Y%m%dT%H%M%S");
|
||||
startTime = mktime(&tm);
|
||||
}
|
||||
else
|
||||
h & startTime;
|
||||
h & fileURI;
|
||||
h & simturnsInfo;
|
||||
h & turnTimerInfo;
|
||||
@ -193,7 +203,7 @@ struct DLL_LINKAGE StartInfo : public Serializeable
|
||||
StartInfo()
|
||||
: mode(EStartMode::INVALID)
|
||||
, difficulty(1)
|
||||
, startTimeIso8601(vstd::getDateTimeISO8601Basic(std::time(nullptr)))
|
||||
, startTime(std::time(nullptr))
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -65,6 +65,7 @@ enum class ESerializationVersion : int32_t
|
||||
LOCAL_PLAYER_STATE_DATA, // 866 - player state contains arbitrary client-side data
|
||||
REMOVE_TOWN_PTR, // 867 - removed pointer to CTown from CGTownInstance
|
||||
REMOVE_OBJECT_TYPENAME, // 868 - remove typename from CGObjectInstance
|
||||
FOLDER_NAME_REWORK, // 869 - rework foldername
|
||||
|
||||
CURRENT = REMOVE_OBJECT_TYPENAME
|
||||
CURRENT = FOLDER_NAME_REWORK
|
||||
};
|
||||
|
@ -245,7 +245,7 @@ bool CVCMIServer::prepareToStartGame()
|
||||
{
|
||||
case EStartMode::CAMPAIGN:
|
||||
logNetwork->info("Preparing to start new campaign");
|
||||
si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(nullptr));
|
||||
si->startTime = std::time(nullptr);
|
||||
si->fileURI = mi->fileURI;
|
||||
si->campState->setCurrentMap(campaignMap);
|
||||
si->campState->setCurrentMapBonus(campaignBonus);
|
||||
@ -254,7 +254,7 @@ bool CVCMIServer::prepareToStartGame()
|
||||
|
||||
case EStartMode::NEW_GAME:
|
||||
logNetwork->info("Preparing to start new game");
|
||||
si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(nullptr));
|
||||
si->startTime = std::time(nullptr);
|
||||
si->fileURI = mi->fileURI;
|
||||
gh->init(si.get(), progressTracking);
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user