void SerializedGameData::ReadSnapshot(GameWorld& gw, EventManager& evMgr) { Prepare(true); em = &evMgr; expectedObjectsReadCount = PopUnsignedInt(); GameObject::SetObjCount(expectedObjectsReadCount); gw.Deserialize(*this); evMgr.Deserialize(*this); for (unsigned i = 0; i < GAMECLIENT.GetPlayerCount(); ++i) GAMECLIENT.GetPlayer(i).Deserialize(*this); em = NULL; readObjects.clear(); }
void SerializedGameData::ReadSnapshot(GameWorld& gw) { Prepare(true); em = &gw.GetEvMgr(); expectedObjectsCount = PopUnsignedInt(); GameObject::SetObjCount(0); gw.Deserialize(*this); em->Deserialize(*this); for (unsigned i = 0; i < gw.GetPlayerCount(); ++i) gw.GetPlayer(i).Deserialize(*this); // If this check fails, we did not serialize all objects or there was an async RTTR_Assert(expectedObjectsCount == GameObject::GetObjCount()); RTTR_Assert(expectedObjectsCount == objectsCount + 1); // "Nothing" nodeObj does not get serialized em = NULL; readObjects.clear(); }