void SerializedGameData::MakeSnapshot(GameWorld& gw, EventManager& evMgr) { Prepare(false); // Anzahl Objekte reinschreiben PushUnsignedInt(GameObject::GetObjCount()); // Objektmanager serialisieren gw.Serialize(*this); // EventManager serialisieren evMgr.Serialize(*this); // Spieler serialisieren for(unsigned i = 0; i < GAMECLIENT.GetPlayerCount(); ++i) GAMECLIENT.GetPlayer(i).Serialize(*this); writtenObjIds.clear(); }
void SerializedGameData::MakeSnapshot(GameWorld& gw) { Prepare(false); // Anzahl Objekte reinschreiben expectedObjectsCount = GameObject::GetObjCount(); PushUnsignedInt(expectedObjectsCount); // Objektmanager serialisieren gw.Serialize(*this); // EventManager serialisieren gw.GetEvMgr().Serialize(*this); // Spieler serialisieren for(unsigned i = 0; i < gw.GetPlayerCount(); ++i) gw.GetPlayer(i).Serialize(*this); // If this check fails, we missed some objects or some objects were destroyed without decreasing the obj count RTTR_Assert(writtenObjIds.size() == objectsCount); RTTR_Assert(expectedObjectsCount == objectsCount + 1); // "Nothing" nodeObj does not get serialized writtenObjIds.clear(); }