本文整理汇总了C++中serializer::Writer::WrSection方法的典型用法代码示例。如果您正苦于以下问题:C++ Writer::WrSection方法的具体用法?C++ Writer::WrSection怎么用?C++ Writer::WrSection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serializer::Writer
的用法示例。
在下文中一共展示了Writer::WrSection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Serialize
void Body::Serialize(Serializer::Writer &_wr, Space *space)
{
Serializer::Writer wr;
wr.Int32(int(GetType()));
switch (GetType()) {
case Object::STAR:
case Object::PLANET:
case Object::SPACESTATION:
case Object::SHIP:
case Object::PLAYER:
case Object::MISSILE:
case Object::CARGOBODY:
case Object::PROJECTILE:
case Object::HYPERSPACECLOUD:
Save(wr, space);
break;
default:
assert(0);
}
wr.Vector3d(GetPosition());
matrix4x4d m;
GetRotMatrix(m);
for (int i=0; i<16; i++) wr.Double(m[i]);
_wr.WrSection("Body", wr.GetData());
}
示例2: Serialize
void Pi::Serialize(Serializer::Writer &wr)
{
Serializer::Writer section;
Serializer::IndexFrames();
Serializer::IndexBodies();
Serializer::IndexSystemBodies(currentSystem);
section = Serializer::Writer();
section.Double(gameTime);
StarSystem::Serialize(section, selectedSystem);
StarSystem::Serialize(section, currentSystem);
wr.WrSection("PiMisc", section.GetData());
section = Serializer::Writer();
Space::Serialize(section);
wr.WrSection("Space", section.GetData());
section = Serializer::Writer();
Polit::Serialize(section);
wr.WrSection("Polit", section.GetData());
section = Serializer::Writer();
sectorView->Save(section);
wr.WrSection("SectorView", section.GetData());
section = Serializer::Writer();
worldView->Save(section);
wr.WrSection("WorldView", section.GetData());
section = Serializer::Writer();
PiLuaModules::Serialize(section);
wr.WrSection("LuaModules", section.GetData());
}
示例3: Serialize
void Space::Serialize(Serializer::Writer &wr)
{
RebuildFrameIndex();
RebuildBodyIndex();
RebuildSystemBodyIndex();
StarSystem::Serialize(wr, m_starSystem.Get());
Serializer::Writer section;
Frame::Serialize(section, m_rootFrame.Get(), this);
wr.WrSection("Frames", section.GetData());
wr.Int32(m_bodies.size());
for (BodyIterator i = m_bodies.begin(); i != m_bodies.end(); ++i)
(*i)->Serialize(wr, this);
}
示例4: Serialize
void Space::Serialize(Serializer::Writer &wr)
{
RebuildFrameIndex();
RebuildBodyIndex();
RebuildSystemBodyIndex();
StarSystem::Serialize(wr, m_starSystem.Get());
Serializer::Writer section;
Frame::Serialize(section, m_rootFrame.get(), this);
wr.WrSection("Frames", section.GetData());
wr.Int32(m_bodies.size());
for (Body* b : m_bodies)
b->Serialize(wr, this);
}
示例5: Serialize
void Body::Serialize(Serializer::Writer &_wr, Space *space)
{
Serializer::Writer wr;
wr.Int32(int(GetType()));
switch (GetType()) {
case Object::STAR:
case Object::PLANET:
case Object::SPACESTATION:
case Object::SHIP:
case Object::PLAYER:
case Object::MISSILE:
case Object::CARGOBODY:
case Object::PROJECTILE:
case Object::HYPERSPACECLOUD:
Save(wr, space);
break;
default:
assert(0);
}
_wr.WrSection("Body", wr.GetData());
}
示例6: Serialize
void Game::Serialize(Serializer::Writer &wr)
{
// leading signature
for (Uint32 i = 0; i < strlen(s_saveStart)+1; i++)
wr.Byte(s_saveStart[i]);
// version
wr.Int32(s_saveVersion);
Serializer::Writer section;
// game state
section.Double(m_time);
section.Int32(Uint32(m_state));
section.Bool(m_wantHyperspace);
section.Double(m_hyperspaceProgress);
section.Double(m_hyperspaceDuration);
section.Double(m_hyperspaceEndTime);
wr.WrSection("Game", section.GetData());
// space, all the bodies and things
section = Serializer::Writer();
m_space->Serialize(section);
section.Int32(m_space->GetIndexForBody(m_player.get()));
wr.WrSection("Space", section.GetData());
// space transition state
section = Serializer::Writer();
// hyperspace clouds being brought over from the previous system
section.Int32(m_hyperspaceClouds.size());
for (std::list<HyperspaceCloud*>::const_iterator i = m_hyperspaceClouds.begin(); i != m_hyperspaceClouds.end(); ++i)
(*i)->Serialize(section, m_space.get());
wr.WrSection("HyperspaceClouds", section.GetData());
// system political data (crime etc)
section = Serializer::Writer();
Polit::Serialize(section);
wr.WrSection("Polit", section.GetData());
// views. must be saved in init order
section = Serializer::Writer();
Pi::cpan->Save(section);
wr.WrSection("ShipCpanel", section.GetData());
section = Serializer::Writer();
Pi::sectorView->Save(section);
wr.WrSection("SectorView", section.GetData());
section = Serializer::Writer();
Pi::worldView->Save(section);
wr.WrSection("WorldView", section.GetData());
// lua
section = Serializer::Writer();
Pi::luaSerializer->Serialize(section);
wr.WrSection("LuaModules", section.GetData());
// trailing signature
for (Uint32 i = 0; i < strlen(s_saveEnd)+1; i++)
wr.Byte(s_saveEnd[i]);
}