Changeset View
Changeset View
Standalone View
Standalone View
source/simulation2/system/ComponentManagerSerialization.cpp
Show First 20 Lines • Show All 175 Lines • ▼ Show 20 Lines | |||||
* (These aren't really needed for networked games (where everyone will have the same | * (These aren't really needed for networked games (where everyone will have the same | ||||
* version), but it doesn't seem worth having a separate codepath for that.) | * version), but it doesn't seem worth having a separate codepath for that.) | ||||
*/ | */ | ||||
bool CComponentManager::SerializeState(std::ostream& stream) const | bool CComponentManager::SerializeState(std::ostream& stream) const | ||||
{ | { | ||||
CStdSerializer serializer(m_ScriptInterface, stream); | CStdSerializer serializer(m_ScriptInterface, stream); | ||||
// We don't serialize the destruction queue, since we'd have to be careful to skip local entities etc | // We don't serialize the destruction queue, since we'd have to be careful to skip local entities etc. | ||||
// and it's (hopefully) easier to just expect callers to flush the queue before serializing | // This means we cannot have non-local entities in the destruction queue at this point. | ||||
ENSURE(m_DestructionQueue.empty()); | ENSURE(m_DestructionQueue.empty() || std::find_if(m_DestructionQueue.begin(), m_DestructionQueue.end(), | ||||
[](entity_id_t ent) { return !ENTITY_IS_LOCAL(ent); }) == m_DestructionQueue.end()); | |||||
serializer.StringASCII("rng", SerializeRNG(m_RNG), 0, 32); | serializer.StringASCII("rng", SerializeRNG(m_RNG), 0, 32); | ||||
serializer.NumberU32_Unbounded("next entity id", m_NextEntityId); | serializer.NumberU32_Unbounded("next entity id", m_NextEntityId); | ||||
std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> >::const_iterator cit; | std::map<ComponentTypeId, std::map<entity_id_t, IComponent*> >::const_iterator cit; | ||||
uint32_t numSystemComponentTypes = 0; | uint32_t numSystemComponentTypes = 0; | ||||
uint32_t numComponentTypes = 0; | uint32_t numComponentTypes = 0; | ||||
▲ Show 20 Lines • Show All 203 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator