本文整理汇总了C++中serializer::Reader::Byte方法的典型用法代码示例。如果您正苦于以下问题:C++ Reader::Byte方法的具体用法?C++ Reader::Byte怎么用?C++ Reader::Byte使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类serializer::Reader
的用法示例。
在下文中一共展示了Reader::Byte方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Load
void ModelSkin::Load(Serializer::Reader &rd)
{
for (unsigned int i = 0; i < 3; i++) {
m_colors[i].r = rd.Byte();
m_colors[i].g = rd.Byte();
m_colors[i].b = rd.Byte();
}
for (unsigned int i = 0; i < MAX_DECAL_MATERIALS; i++)
m_decals[i] = rd.String();
m_label = rd.String();
}
示例2: Load
void Shields::Load(Serializer::Reader &rd)
{
m_enabled = rd.Bool();
const Uint32 NumShields = rd.Int32();
assert(NumShields == m_shields.size());
for (Uint32 iRead = 0; iRead < NumShields; iRead++ ) {
const Uint8 r = rd.Byte();
const Uint8 g = rd.Byte();
const Uint8 b = rd.Byte();
const std::string name = rd.String();
for (ShieldIterator it = m_shields.begin(); it != m_shields.end(); ++it) {
if(name==it->m_mesh->GetName()) {
it->m_colour = Color3ub(r, g, b);
break;
}
}
}
}
示例3: Load
void NavLights::Load(Serializer::Reader &rd)
{
m_time = rd.Float();
m_enabled = rd.Bool();
RefCountedPtr<Graphics::Material> mat;
for (LightIterator it = m_lights.begin(); it != m_lights.end(); ++it) {
Uint8 c = rd.Byte();
it->billboard->SetMaterial(get_material(c));
}
}
示例4:
SectorView::SectorView(Serializer::Reader &rd)
{
InitDefaults();
m_pos.x = m_posMovingTo.x = rd.Float();
m_pos.y = m_posMovingTo.y = rd.Float();
m_pos.z = m_posMovingTo.z = rd.Float();
m_rotX = m_rotXMovingTo = rd.Float();
m_rotZ = m_rotZMovingTo = rd.Float();
m_zoom = m_zoomMovingTo = rd.Float();
m_inSystem = rd.Bool();
m_current = SystemPath::Unserialize(rd);
m_selected = SystemPath::Unserialize(rd);
m_hyperspaceTarget = SystemPath::Unserialize(rd);
m_matchTargetToSelection = rd.Bool();
m_selectionFollowsMovement = rd.Bool();
m_detailBoxVisible = rd.Byte();
InitObject();
}
示例5: InitDefaults
SectorView::SectorView(Serializer::Reader &rd)
{
InitDefaults();
m_pos.x = m_posMovingTo.x = rd.Float();
m_pos.y = m_posMovingTo.y = rd.Float();
m_pos.z = m_posMovingTo.z = rd.Float();
m_rotX = m_rotXMovingTo = rd.Float();
m_rotZ = m_rotZMovingTo = rd.Float();
m_zoom = m_zoomMovingTo = rd.Float();
// XXX I have no idea if this is correct,
// I just copied it from the one other place m_zoomClamped is set
m_zoomClamped = Clamp(m_zoom, 1.f, FAR_LIMIT);
m_inSystem = rd.Bool();
m_current = SystemPath::Unserialize(rd);
m_selected = SystemPath::Unserialize(rd);
m_hyperspaceTarget = SystemPath::Unserialize(rd);
m_matchTargetToSelection = rd.Bool();
m_selectionFollowsMovement = rd.Bool();
m_detailBoxVisible = rd.Byte();
InitObject();
}
示例6: SavedGameWrongVersionException
Game::Game(Serializer::Reader &rd) :
m_timeAccel(TIMEACCEL_PAUSED),
m_requestedTimeAccel(TIMEACCEL_PAUSED),
m_forceTimeAccel(false)
{
// signature check
for (Uint32 i = 0; i < strlen(s_saveStart)+1; i++)
if (rd.Byte() != s_saveStart[i]) throw SavedGameCorruptException();
// version check
rd.SetStreamVersion(rd.Int32());
Output("savefile version: %d\n", rd.StreamVersion());
if (rd.StreamVersion() != s_saveVersion) {
Output("can't load savefile, expected version: %d\n", s_saveVersion);
throw SavedGameWrongVersionException();
}
// XXX This must be done after loading sectors once we can change them in game
Pi::FlushCaches();
Serializer::Reader section;
// game state
section = rd.RdSection("Game");
m_time = section.Double();
m_state = State(section.Int32());
m_wantHyperspace = section.Bool();
m_hyperspaceProgress = section.Double();
m_hyperspaceDuration = section.Double();
m_hyperspaceEndTime = section.Double();
// space, all the bodies and things
section = rd.RdSection("Space");
m_space.reset(new Space(this, section, m_time));
m_player.reset(static_cast<Player*>(m_space->GetBodyByIndex(section.Int32())));
// space transition state
section = rd.RdSection("HyperspaceClouds");
// hyperspace clouds being brought over from the previous system
Uint32 nclouds = section.Int32();
for (Uint32 i = 0; i < nclouds; i++)
m_hyperspaceClouds.push_back(static_cast<HyperspaceCloud*>(Body::Unserialize(section, 0)));
// system political stuff
section = rd.RdSection("Polit");
Polit::Unserialize(section);
// views
LoadViews(rd);
// lua
section = rd.RdSection("LuaModules");
Pi::luaSerializer->Unserialize(section);
// signature check
for (Uint32 i = 0; i < strlen(s_saveEnd)+1; i++)
if (rd.Byte() != s_saveEnd[i]) throw SavedGameCorruptException();
}
示例7: SavedGameWrongVersionException
Game::Game(Serializer::Reader &rd) :
m_timeAccel(TIMEACCEL_PAUSED),
m_requestedTimeAccel(TIMEACCEL_PAUSED),
m_forceTimeAccel(false)
{
// signature check
for (Uint32 i = 0; i < strlen(s_saveStart)+1; i++)
if (rd.Byte() != s_saveStart[i]) throw SavedGameCorruptException();
// version check
rd.SetStreamVersion(rd.Int32());
Output("savefile version: %d\n", rd.StreamVersion());
if (rd.StreamVersion() != s_saveVersion) {
Output("can't load savefile, expected version: %d\n", s_saveVersion);
throw SavedGameWrongVersionException();
}
// XXX This must be done after loading sectors once we can change them in game
Pi::FlushCaches();
Serializer::Reader section;
// Preparing the Lua stuff
LuaRef::InitLoad();
Pi::luaSerializer->InitTableRefs();
// galaxy generator
section = rd.RdSection("GalaxyGen");
std::string genName = section.String();
GalaxyGenerator::Version genVersion = section.Int32();
if (genName != Pi::GetGalaxy()->GetGeneratorName() || genVersion != Pi::GetGalaxy()->GetGeneratorVersion()) {
if (!Pi::CreateGalaxy(genName, genVersion)) {
Output("can't load savefile, unsupported galaxy generator %s, version %d\n", genName.c_str(), genVersion);
throw SavedGameWrongVersionException();
}
}
// game state
section = rd.RdSection("Game");
m_time = section.Double();
m_state = State(section.Int32());
m_wantHyperspace = section.Bool();
m_hyperspaceProgress = section.Double();
m_hyperspaceDuration = section.Double();
m_hyperspaceEndTime = section.Double();
// space, all the bodies and things
section = rd.RdSection("Space");
m_space.reset(new Space(this, section, m_time));
m_player.reset(static_cast<Player*>(m_space->GetBodyByIndex(section.Int32())));
assert(!m_player->IsDead()); // Pioneer does not support necromancy
// space transition state
section = rd.RdSection("HyperspaceClouds");
// hyperspace clouds being brought over from the previous system
Uint32 nclouds = section.Int32();
for (Uint32 i = 0; i < nclouds; i++)
m_hyperspaceClouds.push_back(static_cast<HyperspaceCloud*>(Body::Unserialize(section, 0)));
// system political stuff
section = rd.RdSection("Polit");
Polit::Unserialize(section);
// views
LoadViews(rd);
// lua
section = rd.RdSection("LuaModules");
Pi::luaSerializer->Unserialize(section);
Pi::luaSerializer->UninitTableRefs();
LuaRef::UninitLoad();
// signature check
for (Uint32 i = 0; i < strlen(s_saveEnd)+1; i++)
if (rd.Byte() != s_saveEnd[i]) throw SavedGameCorruptException();
EmitPauseState(IsPaused());
}