本文整理汇总了C++中ObjectHandle::unserialize方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectHandle::unserialize方法的具体用法?C++ ObjectHandle::unserialize怎么用?C++ ObjectHandle::unserialize使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectHandle
的用法示例。
在下文中一共展示了ObjectHandle::unserialize方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
RECEIVE(DROP, id, msg, reliable)
{
ObjectHandle item = Object::construct((string) msg[1]);
if (!item) return;
item->unserialize(msg[1]);
game.world->temporary.push_back(item);
}
示例2: ToGridPoint
RECEIVE(BUILD, id, msg, reliable)
{
if (!reliable) return;
GridPoint g = ToGridPoint(msg[1]);
if (!g.isValid()) return;
ObjectHandle structure = Object::construct((string) msg[2]);
if (!structure) return;
structure->unserialize(msg[2]);
game.world->terrain->structures[g] = structure;
TO(Structure,structure)->updateTextures();
}
示例3: Player
RECEIVE(PLAYERINFO, id, msg, reliable)
{
if (!reliable) return;
for (size_t i = 1; i < msg.size(); i += 2)
{
ObjectHandle player = Player();
player->unserialize((string) msg[i+1]);
Player *p = TO(Player,player);
Player::Id pid = p->id;
game.topId = MAX(game.topId,pid) + 1;
game.root->children.insert(player);
game.players[pid] = player;
nodes[(long) msg[i]] = pid;
p->updateTextures();
}
}
示例4: TO
RECEIVE(STRUCTINFO, id, msg, reliable)
{
if (!reliable) return;
Terrain *t = TO(Terrain,game.world->terrain);
t->structures.clear();
for (size_t i = 1; i < msg.size(); i += 2)
{
GridPoint g = ToGridPoint(msg[i]);
if (!g.isValid()) continue;
ObjectHandle structure = Object::construct((string) msg[i+1]);
if (!structure) continue;
structure->unserialize(msg[i+1]);
t->structures[g] = structure;
TO(Structure,structure)->updateTextures();
}
}
示例5: LaserBeam
RECEIVE(FIRE, id, msg, reliable)
{
ObjectHandle laser = LaserBeam();
laser->unserialize(msg[1]);
game.world->addLaserBeam(laser);
}