Ticket #4279: visualreplay+savegame_v1.patch
File visualreplay+savegame_v1.patch, 2.0 KB (added by , 7 years ago) |
---|
-
source/simulation2/components/CCmpCinemaManager.cpp
public: 111 111 } 112 112 } 113 113 114 114 virtual void Deserialize(const CParamNode& UNUSED(paramNode), IDeserializer& deserialize) 115 115 { 116 if (!g_Game || !g_Game->GetView())116 //if (!g_Game || !g_Game->GetView()) 117 117 return; 118 118 119 119 CinematicSimulationData* p_CinematicSimulationData = g_Game->GetView()->GetCinema()->GetCinematicSimulationData(); 120 120 deserialize.Bool("MapRevealed", p_CinematicSimulationData->m_MapRevealed); 121 121 uint32_t numberOfPaths = 0; -
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 /**