本文整理汇总了C++中MapSector::getId方法的典型用法代码示例。如果您正苦于以下问题:C++ MapSector::getId方法的具体用法?C++ MapSector::getId怎么用?C++ MapSector::getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MapSector
的用法示例。
在下文中一共展示了MapSector::getId方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: deSerialize
ServerMapSector* ServerMapSector::deSerialize(
std::istream &is,
Map *parent,
v2s16 p2d,
std::map<v2s16, MapSector*> & sectors,
IGameDef *gamedef
)
{
/*
[0] u8 serialization version
+ heightmap data
*/
/*
Read stuff
*/
// Read version
u8 version = SER_FMT_VER_INVALID;
is.read((char*)&version, 1);
if(!ser_ver_supported(version))
throw VersionMismatchException("ERROR: MapSector format not supported");
/*
Add necessary reading stuff here
*/
/*
Get or create sector
*/
ServerMapSector *sector = NULL;
std::map<v2s16, MapSector*>::iterator n = sectors.find(p2d);
if(n != sectors.end())
{
dstream<<"WARNING: deSerializing existent sectors not supported "
"at the moment, because code hasn't been tested."
<<std::endl;
MapSector *sector = n->second;
assert(sector->getId() == MAPSECTOR_SERVER);
return (ServerMapSector*)sector;
}
else
{
sector = new ServerMapSector(parent, p2d, gamedef);
sectors[p2d] = sector;
}
/*
Set stuff in sector
*/
// Nothing here
return sector;
}