Index: binaries/system/readme.txt =================================================================== --- binaries/system/readme.txt +++ binaries/system/readme.txt @@ -61,6 +61,7 @@ -rejointest=N simulates a rejoin and checks simulation state each turn for serialization errors; this is similar to a serialization test but much faster and less complete. It should be enough for debugging most rejoin OOSes. +-aicommands write ai commands to commands.txt Windows-specific: -wQpcTscSafe allow timing via QueryPerformanceCounter despite the fact Index: source/simulation2/components/CCmpAIManager.cpp =================================================================== --- source/simulation2/components/CCmpAIManager.cpp +++ source/simulation2/components/CCmpAIManager.cpp @@ -28,6 +28,8 @@ #include "lib/allocators/shared_ptr.h" #include "ps/CLogger.h" #include "ps/Filesystem.h" +#include "ps/Game.h" +#include "ps/Mod.h" #include "ps/Profile.h" #include "ps/Util.h" #include "simulation2/components/ICmpAIInterface.h" @@ -42,6 +44,7 @@ #include "simulation2/serialization/StdDeserializer.h" #include "simulation2/serialization/StdSerializer.h" #include "simulation2/serialization/SerializeTemplates.h" +#include "simulation2/system/TurnManager.h" extern void kill_mainloop(); @@ -1162,7 +1165,10 @@ for (size_t j = 0; j < commands[i].commands.size(); ++j) { scriptInterface.ReadStructuredClone(commands[i].commands[j], &clonedCommandVal); - cmpCommandQueue->PushLocalCommand(commands[i].player, clonedCommandVal); + if (g_args.Has("-aicommands")) + g_Game->GetTurnManager()->AddCommand(1, commands[i].player, clonedCommandVal, g_Game->GetTurnManager()->GetCurrentTurn() + COMMAND_DELAY + 1); + else + cmpCommandQueue->PushLocalCommand(commands[i].player, clonedCommandVal); } } } Index: source/simulation2/system/TurnManager.h =================================================================== --- source/simulation2/system/TurnManager.h +++ source/simulation2/system/TurnManager.h @@ -186,6 +186,7 @@ u32 m_FinalTurn; private: + friend class CCmpAIManager; size_t m_TimeWarpNumTurns; // 0 if disabled std::list m_TimeWarpStates; std::string m_QuickSaveState; // TODO: should implement a proper disk-based quicksave system