Ticket #3255: t3255_use_timestamp_and_pid_for_oosdump_filename.patch
File t3255_use_timestamp_and_pid_for_oosdump_filename.patch, 1.3 KB (added by , 9 years ago) |
---|
-
source/network/NetTurnManager.cpp
31 31 #include "ps/Replay.h" 32 32 #include "ps/SavedGame.h" 33 33 #include "scriptinterface/ScriptInterface.h" 34 34 #include "simulation2/Simulation2.h" 35 35 36 #include<iostream> 37 #include<ctime> 38 36 39 #include <sstream> 37 40 #include <fstream> 38 41 #include <iomanip> 39 42 43 #if MSC_VERSION 44 #include <process.h> 45 #define getpid _getpid // use the non-deprecated function name 46 #endif 47 40 48 static const int DEFAULT_TURN_LENGTH_MP = 500; 41 49 static const int DEFAULT_TURN_LENGTH_SP = 200; 42 50 43 51 static const int COMMAND_DELAY = 2; 44 52 … … 230 238 bool quick = !TurnNeedsFullHash(turn); 231 239 std::string hash; 232 240 bool ok = m_Simulation2.ComputeStateHash(hash, quick); 233 241 ENSURE(ok); 234 242 235 OsPath path = psLogDir()/"oos_dump.txt"; 243 std::wstringstream name; 244 name << L"oos_dump_" << std::time(0) << L"_" << getpid() << L".txt"; 245 246 OsPath path = psLogDir()/name.str(); 236 247 std::ofstream file (OsString(path).c_str(), std::ofstream::out | std::ofstream::trunc); 237 248 m_Simulation2.DumpDebugState(file); 238 249 file.close(); 239 250 240 251 std::stringstream msg;