当前位置: 首页>>代码示例>>C++>>正文


C++ ObjectHandle::unserialize方法代码示例

本文整理汇总了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);
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:7,代码来源:netcode.cpp

示例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();
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:11,代码来源:netcode.cpp

示例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();
	}
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:16,代码来源:netcode.cpp

示例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();
	}
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:18,代码来源:netcode.cpp

示例5: LaserBeam

RECEIVE(FIRE, id, msg, reliable)
{
	ObjectHandle laser = LaserBeam();
	laser->unserialize(msg[1]);
	game.world->addLaserBeam(laser);
}
开发者ID:FerryT,项目名称:OGO-2.3,代码行数:6,代码来源:netcode.cpp


注:本文中的ObjectHandle::unserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。