Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/Simulation2.cpp
Show First 20 Lines • Show All 440 Lines • ▼ Show 20 Lines | if (m_EnableSerializationTest || startRejoinTest) | ||||
} | } | ||||
else | else | ||||
{ | { | ||||
std::wstring mapFile; | std::wstring mapFile; | ||||
scriptInterface.GetProperty(m_InitAttributes, "map", mapFile); | scriptInterface.GetProperty(m_InitAttributes, "map", mapFile); | ||||
VfsPath mapfilename = VfsPath(mapFile).ChangeExtension(L".pmp"); | VfsPath mapfilename = VfsPath(mapFile).ChangeExtension(L".pmp"); | ||||
mapReader->LoadMap(mapfilename, *scriptInterface.GetContext(), JS::UndefinedHandleValue, | mapReader->LoadMap(mapfilename, *scriptInterface.GetContext(), JS::UndefinedHandleValue, | ||||
m_SecondaryTerrain, NULL, NULL, NULL, NULL, NULL, NULL, | m_SecondaryTerrain, NULL, NULL, NULL, NULL, NULL, | ||||
NULL, NULL, m_SecondaryContext, INVALID_PLAYER, true); // throws exception on failure | NULL, NULL, m_SecondaryContext, INVALID_PLAYER, true); // throws exception on failure | ||||
} | } | ||||
LDR_EndRegistering(); | LDR_EndRegistering(); | ||||
ENSURE(LDR_NonprogressiveLoad() == INFO::OK); | ENSURE(LDR_NonprogressiveLoad() == INFO::OK); | ||||
ENSURE(m_SecondaryComponentManager->DeserializeState(primaryStateBefore.state)); | ENSURE(m_SecondaryComponentManager->DeserializeState(primaryStateBefore.state)); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | void CSimulation2Impl::DumpState() | ||||
std::ofstream binfile (OsString(path.ChangeExtension(L".dat")).c_str(), std::ofstream::out | std::ofstream::trunc | std::ofstream::binary); | std::ofstream binfile (OsString(path.ChangeExtension(L".dat")).c_str(), std::ofstream::out | std::ofstream::trunc | std::ofstream::binary); | ||||
m_ComponentManager.SerializeState(binfile); | m_ComponentManager.SerializeState(binfile); | ||||
} | } | ||||
//////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////// | ||||
CSimulation2::CSimulation2(CUnitManager* unitManager, shared_ptr<ScriptContext> cx, CTerrain* terrain) : | CSimulation2::CSimulation2(CUnitManager* unitManager, shared_ptr<ScriptContext> cx, CTerrain* terrain) : | ||||
m(new CSimulation2Impl(unitManager, cx, terrain)) | m(new CSimulation2Impl(unitManager, cx, terrain)) | ||||
phosit: Should be passed by reference. nullptr would lead to UB. | |||||
Done Inline ActionsMh, conceptually I'd rather not, because the simulation should be able to exist without the world. What UB are you referring to ? wraitii: Mh, conceptually I'd rather not, because the simulation should be able to exist without the… | |||||
Done Inline ActionsThe constructor of CSimulation2Impl calls -> on it. phosit: The constructor of CSimulation2Impl calls -> on it. | |||||
Done Inline Actionsfixed that wraitii: fixed that | |||||
{ | { | ||||
} | } | ||||
CSimulation2::~CSimulation2() | CSimulation2::~CSimulation2() | ||||
{ | { | ||||
delete m; | delete m; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 353 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator
Should be passed by reference. nullptr would lead to UB.