本文整理汇总了C++中Town::setPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::setPosition方法的具体用法?C++ Town::setPosition怎么用?C++ Town::setPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::setPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMap
//.........这里部分代码省略.........
while(nodeTown != NO_NODE)
{
if(type == OTBM_TOWN)
{
if(!f.getProps(nodeTown, propStream))
{
setLastErrorString("Could not read town data.");
return false;
}
uint32_t townId = 0;
if(!propStream.getLong(townId))
{
setLastErrorString("Could not read town id.");
return false;
}
Town* town = Towns::getInstance()->getTown(townId);
if(!town)
{
town = new Town(townId);
Towns::getInstance()->addTown(townId, town);
}
std::string townName;
if(!propStream.getString(townName))
{
setLastErrorString("Could not read town name.");
return false;
}
town->setName(townName);
OTBM_Destination_coords *townCoords;
if(!propStream.getStruct(townCoords))
{
setLastErrorString("Could not read town coordinates.");
return false;
}
town->setPosition(Position(townCoords->_x, townCoords->_y, townCoords->_z));
}
else
{
setLastErrorString("Unknown town node.");
return false;
}
nodeTown = f.getNextNode(nodeTown, type);
}
}
else if(type == OTBM_WAYPOINTS && headerVersion > 1)
{
NODE nodeWaypoint = f.getChildNode(nodeMapData, type);
while(nodeWaypoint != NO_NODE)
{
if(type == OTBM_WAYPOINT)
{
if(!f.getProps(nodeWaypoint, propStream))
{
setLastErrorString("Could not read waypoint data.");
return false;
}
std::string name;
if(!propStream.getString(name))
{
setLastErrorString("Could not read waypoint name.");
return false;
}
OTBM_Destination_coords* waypoint_coords;
if(!propStream.getStruct(waypoint_coords))
{
setLastErrorString("Could not read waypoint coordinates.");
return false;
}
map->waypoints.addWaypoint(WaypointPtr(new Waypoint(name,
Position(waypoint_coords->_x, waypoint_coords->_y, waypoint_coords->_z))));
}
else
{
setLastErrorString("Unknown waypoint node.");
return false;
}
nodeWaypoint = f.getNextNode(nodeWaypoint, type);
}
}
else
{
setLastErrorString("Unknown map node.");
return false;
}
nodeMapData = f.getNextNode(nodeMapData, type);
}
return true;
}