Ticket #4990: load_simstate+visual_replay.diff
File load_simstate+visual_replay.diff, 1.3 KB (added by , 6 years ago) |
---|
-
source/ps/Game.cpp
37 37 #include "ps/LoaderThunks.h" 38 38 #include "ps/Profile.h" 39 39 #include "ps/Replay.h" 40 40 #include "ps/Shapes.h" 41 41 #include "ps/World.h" 42 #include "ps/GameSetup/CmdLineArgs.h" 42 43 #include "ps/GameSetup/GameSetup.h" 43 44 #include "renderer/Renderer.h" 44 45 #include "renderer/TimeManager.h" 45 46 #include "renderer/WaterManager.h" 46 47 #include "scriptinterface/ScriptInterface.h" … … 52 53 #include "tools/atlas/GameInterface/GameLoop.h" 53 54 54 55 extern bool g_GameRestarted; 55 56 extern GameLoopState* g_AtlasGameLoop; 56 57 58 extern CmdLineArgs g_args; 59 57 60 /** 58 61 * Globally accessible pointer to the CGame object. 59 62 **/ 60 63 CGame *g_Game=NULL; 61 64 … … bool CGame::StartVisualReplay(const std: 189 192 JSContext* cx = scriptInterface.GetContext(); 190 193 JSAutoRequest rq(cx); 191 194 192 195 JS::RootedValue attribs(cx); 193 196 scriptInterface.ParseJSON(line, &attribs); 194 StartGame(&attribs, ""); 197 198 CStr savegame = ""; 199 if (g_args.Has("load")) 200 { 201 std::ifstream file (g_args.Get("load").c_str(), std::ifstream::in); 202 std::stringstream buffer; 203 buffer << file.rdbuf(); 204 savegame = buffer.str(); 205 } 206 207 StartGame(&attribs, savegame); 195 208 196 209 return true; 197 210 } 198 211 199 212 /**