Use std::time_t in the replay menu (as 64bit integer conversion are implemented now) and remove the unused filemoddate fallback.

Differential Revision: https://code.wildfiregames.com/D112
Reviewed By: echotangoecho
This was SVN commit r19200.
This commit is contained in:
elexis
2017-02-05 02:18:33 +00:00
parent 39bb057ec5
commit 5130bb69d3
4 changed files with 12 additions and 16 deletions
+6 -6
View File
@@ -1,4 +1,4 @@
/* Copyright (C) 2016 Wildfire Games.
/* Copyright (C) 2017 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
@@ -54,7 +54,7 @@ CReplayLogger::~CReplayLogger()
void CReplayLogger::StartGame(JS::MutableHandleValue attribs)
{
// Add timestamp, since the file-modification-date can change
m_ScriptInterface.SetProperty(attribs, "timestamp", std::to_string(std::time(nullptr)));
m_ScriptInterface.SetProperty(attribs, "timestamp", std::time(nullptr));
// Add engine version and currently loaded mods for sanity checks when replaying
m_ScriptInterface.SetProperty(attribs, "engine_version", CStr(engine_version));
@@ -73,10 +73,10 @@ void CReplayLogger::Turn(u32 n, u32 turnLength, std::vector<SimulationCommand>&
JSAutoRequest rq(cx);
*m_Stream << "turn " << n << " " << turnLength << "\n";
for (size_t i = 0; i < commands.size(); ++i)
{
*m_Stream << "cmd " << commands[i].player << " " << m_ScriptInterface.StringifyJSON(&commands[i].data, false) << "\n";
}
for (SimulationCommand& command : commands)
*m_Stream << "cmd " << command.player << " " << m_ScriptInterface.StringifyJSON(&command.data, false) << "\n";
*m_Stream << "end\n";
m_Stream->flush();
}