本文整理汇总了C++中serializer::Writer类的典型用法代码示例。如果您正苦于以下问题:C++ Writer类的具体用法?C++ Writer怎么用?C++ Writer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Writer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Save
void Missile::Save(Serializer::Writer &wr, Space *space)
{
Ship::Save(wr, space);
wr.Int32(space->GetIndexForBody(m_owner));
wr.Int32(m_power);
wr.Bool(m_armed);
}
示例2: Save
void ScannerWidget::Save(Serializer::Writer &wr)
{
wr.Int32(Sint32(m_mode));
wr.Float(m_currentRange);
wr.Float(m_manualRange);
wr.Float(m_targetRange);
}
示例3: Save
void Body::Save(Serializer::Writer &wr, Space *space)
{
wr.Int32(space->GetIndexForFrame(m_frame));
wr.String(m_label);
wr.Bool(m_dead);
wr.Bool(m_hasDoubleFrame);
}
示例4: Save
void Player::Save(Serializer::Writer &wr, Space *space)
{
Ship::Save(wr, space);
MarketAgent::Save(wr);
wr.Int32(m_killCount);
wr.Int32(m_knownKillCount);
}
示例5: SaveToFile
bool GameSaver::SaveToFile(const std::string &filename)
{
bool success = false;
try {
if (!FileSystem::rawFileSystem.MakeDirectory(Pi::GetSaveDir())) {
throw CouldNotOpenFileException();
}
Serializer::Writer wr;
m_game->Serialize(wr);
const std::string data = wr.GetData();
FILE *f = fopen(filename.c_str(), "wb");
if (!f) throw CouldNotOpenFileException();
size_t nwritten = fwrite(data.data(), data.length(), 1, f);
fclose(f);
if (nwritten != 1) throw CouldNotWriteToFileException();
success = true;
}
catch (CouldNotOpenFileException) {
Gui::Screen::ShowBadError(Lang::GAME_LOAD_CANNOT_OPEN);
}
catch (CouldNotWriteToFileException) {
Gui::Screen::ShowBadError(Lang::GAME_SAVE_CANNOT_WRITE);
}
return success;
}
示例6: SaveLmrMaterial
void ShipFlavour::SaveLmrMaterial(Serializer::Writer &wr, LmrMaterial *m)
{
for (int i=0; i<4; i++) wr.Float(m->diffuse[i]);
for (int i=0; i<4; i++) wr.Float(m->specular[i]);
for (int i=0; i<4; i++) wr.Float(m->emissive[i]);
wr.Float(m->shininess);
}
示例7: Save
void ShipFlavour::Save(Serializer::Writer &wr)
{
wr.String(id);
wr.Int32(price);
wr.String(regid);
SaveLmrMaterial(wr, &primaryColor);
SaveLmrMaterial(wr, &secondaryColor);
}
示例8: Save
void ModelBody::Save(Serializer::Writer &wr, Space *space)
{
Body::Save(wr, space);
wr.Bool(m_isStatic);
wr.Bool(m_colliding);
wr.String(m_modelName);
m_model->Save(wr);
}
示例9: Save
void Player::Save(Serializer::Writer &wr)
{
Ship::Save(wr);
wr.Int32(static_cast<int>(m_flightControlState));
wr.Double(m_setSpeed);
wr.Int32(m_killCount);
wr.Int32(m_knownKillCount);
}
示例10: Save
void AICommand::Save(Serializer::Writer &wr)
{
Space *space = Pi::game->GetSpace();
wr.Int32(m_cmdName);
wr.Int32(space->GetIndexForBody(m_ship));
if (m_child) m_child->Save(wr);
else wr.Int32(CMD_NONE);
}
示例11: Save
void Missile::Save(Serializer::Writer &wr)
{
Ship::Save(wr);
wr.Int32(Serializer::LookupBody(m_owner));
wr.Int32(Serializer::LookupBody(m_target));
wr.Double(m_distToTarget);
wr.Int32(m_power);
}
示例12: Save
void Missile::Save(Serializer::Writer &wr, Space *space)
{
Ship::Save(wr, space);
wr.Int32(space->GetIndexForBody(m_owner));
wr.Int32(space->GetIndexForBody(m_target));
wr.Double(m_distToTarget);
wr.Int32(m_power);
}
示例13: Save
void NavLights::Save(Serializer::Writer &wr)
{
wr.Float(m_time);
wr.Bool(m_enabled);
for (LightIterator it = m_lights.begin(); it != m_lights.end(); ++it)
wr.Byte(it->color);
}
示例14: Save
void Projectile::Save(Serializer::Writer &wr, Space *space)
{
Body::Save(wr, space);
wr.Vector3d(m_baseVel);
wr.Vector3d(m_dirVel);
wr.Float(m_age);
wr.Int32(m_type);
wr.Int32(space->GetIndexForBody(m_parent));
}
示例15: Serialize
void Serialize(Serializer::Writer &wr)
{
s_criminalRecord.Serialize(wr);
s_outstandingFine.Serialize(wr);
for (int i=0; i<BLOC_MAX; i++) {
wr.Int64(s_playerPerBlocCrimeRecord[i].record);
wr.Int64(s_playerPerBlocCrimeRecord[i].fine);
}
}