Ticket #3339: t3339_command_line_option_ooslog_unique_v1.1.patch
File t3339_command_line_option_ooslog_unique_v1.1.patch, 3.1 KB (added by , 9 years ago) |
---|
-
binaries/system/readme.txt
48 48 PATH is system path to commands.txt containing simulation log 49 49 -replay-visual=PATH visual replay of a previous game, used for analysis purposes 50 50 PATH is system path to commands.txt containing simulation log 51 51 -writableRoot store runtime game data in root data directory 52 52 (only use if you have write permissions on that directory) 53 -oosdump-unique adds unix timestamp and process id to the filename of the out of sync log 54 to prevent the file from being overwritten by another process. 53 55 -ooslog dumps simulation state in binary and ASCII representations each turn, 54 56 files created in sim_log within the game's log folder. NOTE: game will 55 run much slower with this option !57 run much slower with this option and can use hundreds of megabytes of disk space! 56 58 -serializationtest checks simulation state each turn for serialization errors; on test 57 59 failure, error is displayed and logs created in oos_log within the 58 60 game's log folder. NOTE: game will run much slower with this option! 59 61 60 62 Windows-specific: -
source/network/NetTurnManager.cpp
24 24 #include "network/NetMessage.h" 25 25 26 26 #include "gui/GUIManager.h" 27 27 #include "maths/MathUtil.h" 28 28 #include "ps/CLogger.h" 29 #include "ps/GameSetup/CmdLineArgs.h" 29 30 #include "ps/Profile.h" 30 31 #include "ps/Pyrogenesis.h" 31 32 #include "ps/Replay.h" 32 33 #include "ps/SavedGame.h" 33 34 #include "scriptinterface/ScriptInterface.h" 34 35 #include "simulation2/Simulation2.h" 35 36 37 #include <ctime> 36 38 #include <sstream> 37 39 #include <fstream> 40 #include <iostream> 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 … … 228 236 229 237 bool quick = !TurnNeedsFullHash(turn); 230 238 std::string hash; 231 239 ENSURE(m_Simulation2.ComputeStateHash(hash, quick)); 232 240 233 OsPath path = psLogDir()/"oos_dump.txt"; 241 std::wstringstream name; 242 name << L"oos_dump"; 243 if (g_args.Has("oosdump-unique")) 244 name << L"_" << std::time(0) << L"_" << getpid(); 245 name << L".txt"; 246 247 OsPath path = psLogDir()/name.str(); 234 248 std::ofstream file (OsString(path).c_str(), std::ofstream::out | std::ofstream::trunc); 235 249 m_Simulation2.DumpDebugState(file); 236 250 file.close(); 237 251 238 252 hash = Hexify(hash); -
source/network/NetTurnManager.h
23 23 24 24 #include <list> 25 25 #include <map> 26 26 #include <vector> 27 27 28 extern CmdLineArgs g_args; 29 28 30 class CNetServerWorker; 29 31 class CNetClient; 30 32 class CSimulationMessage; 31 33 class CSimulation2; 32 34 class IReplayLogger;