Property changes on: binaries/data/mods/public/gui/session
___________________________________________________________________
Deleted: svn:mergeinfo
## -0,0 +0,0 ##
|
|
|
45 | 45 | |
46 | 46 | #include <iomanip> |
47 | 47 | |
| 48 | int hashStart = 124; |
| 49 | |
48 | 50 | #if MSC_VERSION |
49 | 51 | #include <process.h> |
50 | 52 | #define getpid _getpid // use the non-deprecated function name |
… |
… |
|
65 | 67 | CSimulation2Impl(CUnitManager* unitManager, shared_ptr<ScriptRuntime> rt, CTerrain* terrain) : |
66 | 68 | m_SimContext(), m_ComponentManager(m_SimContext, rt), |
67 | 69 | m_EnableOOSLog(false), m_EnableSerializationTest(false), |
68 | | m_MapSettings(rt->m_rt), m_InitAttributes(rt->m_rt) |
| 70 | m_MapSettings(rt->m_rt), m_InitAttributes(rt->m_rt), secondaryComponentManager(secondaryContext, rt) |
69 | 71 | { |
70 | 72 | m_SimContext.m_UnitManager = unitManager; |
71 | 73 | m_SimContext.m_Terrain = terrain; |
… |
… |
|
79 | 81 | CFG_GET_VAL("ooslog", m_EnableOOSLog); |
80 | 82 | CFG_GET_VAL("serializationtest", m_EnableSerializationTest); |
81 | 83 | } |
| 84 | |
| 85 | // Initialise the secondary simulation |
| 86 | secondaryContext.m_Terrain = &secondaryTerrain; |
| 87 | secondaryComponentManager.LoadComponentTypes(); |
82 | 88 | } |
83 | 89 | |
84 | 90 | ~CSimulation2Impl() |
… |
… |
|
134 | 140 | bool m_EnableOOSLog; |
135 | 141 | |
136 | 142 | |
| 143 | // Initialise the secondary simulation |
| 144 | CTerrain secondaryTerrain; |
| 145 | CSimContext secondaryContext; |
| 146 | CComponentManager secondaryComponentManager; |
| 147 | |
| 148 | std::set<VfsPath> secondaryLoadedScripts; |
| 149 | |
| 150 | |
137 | 151 | // Functions and data for the serialization test mode: (see Update() for relevant comments) |
138 | 152 | |
139 | 153 | bool m_EnableSerializationTest; |
… |
… |
|
346 | 360 | SerializationTestState primaryStateBefore; |
347 | 361 | ScriptInterface& scriptInterface = m_ComponentManager.GetScriptInterface(); |
348 | 362 | |
349 | | if (m_EnableSerializationTest) |
| 363 | if (m_EnableSerializationTest && m_TurnNumber == hashStart) |
350 | 364 | { |
| 365 | ENSURE(LoadDefaultScripts(secondaryComponentManager, &secondaryLoadedScripts)); |
| 366 | } |
| 367 | |
| 368 | if (m_TurnNumber >= hashStart) |
| 369 | { |
351 | 370 | ENSURE(m_ComponentManager.SerializeState(primaryStateBefore.state)); |
352 | 371 | if (serializationTestDebugDump) |
353 | 372 | ENSURE(m_ComponentManager.DumpDebugState(primaryStateBefore.debug, false)); |
… |
… |
|
360 | 379 | |
361 | 380 | if (m_EnableSerializationTest) |
362 | 381 | { |
363 | | // Initialise the secondary simulation |
364 | | CTerrain secondaryTerrain; |
365 | | CSimContext secondaryContext; |
366 | | secondaryContext.m_Terrain = &secondaryTerrain; |
367 | | CComponentManager secondaryComponentManager(secondaryContext, scriptInterface.GetRuntime()); |
368 | | secondaryComponentManager.LoadComponentTypes(); |
369 | | std::set<VfsPath> secondaryLoadedScripts; |
370 | | ENSURE(LoadDefaultScripts(secondaryComponentManager, &secondaryLoadedScripts)); |
| 382 | if (m_TurnNumber == hashStart) |
| 383 | { |
371 | 384 | ResetComponentState(secondaryComponentManager, false, false); |
372 | 385 | |
373 | 386 | // Load the trigger scripts after we have loaded the simulation. |
… |
… |
|
405 | 418 | |
406 | 419 | LDR_EndRegistering(); |
407 | 420 | ENSURE(LDR_NonprogressiveLoad() == INFO::OK); |
408 | | |
409 | 421 | ENSURE(secondaryComponentManager.DeserializeState(primaryStateBefore.state)); |
410 | | |
| 422 | } |
| 423 | if (m_TurnNumber >= hashStart) |
| 424 | { |
411 | 425 | SerializationTestState secondaryStateBefore; |
412 | 426 | ENSURE(secondaryComponentManager.SerializeState(secondaryStateBefore.state)); |
413 | 427 | if (serializationTestDebugDump) |
… |
… |
|
443 | 457 | ReportSerializationFailure(&primaryStateBefore, &primaryStateAfter, &secondaryStateBefore, &secondaryStateAfter); |
444 | 458 | } |
445 | 459 | } |
| 460 | } |
446 | 461 | |
447 | 462 | // if (m_TurnNumber == 0) |
448 | 463 | // m_ComponentManager.GetScriptInterface().DumpHeap(); |
… |
… |
|
462 | 477 | else |
463 | 478 | scriptInterface.GetRuntime()->MaybeIncrementalGC(0.0f); |
464 | 479 | |
465 | | if (m_EnableOOSLog) |
| 480 | if (m_EnableOOSLog && m_TurnNumber >= hashStart) |
466 | 481 | DumpState(); |
467 | 482 | |
468 | 483 | // Start computing AI for the next turn |