本文整理汇总了C++中Town::setTemplePosition方法的典型用法代码示例。如果您正苦于以下问题:C++ Town::setTemplePosition方法的具体用法?C++ Town::setTemplePosition怎么用?C++ Town::setTemplePosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Town
的用法示例。
在下文中一共展示了Town::setTemplePosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: loadMap
//.........这里部分代码省略.........
warning(wxT("Invalid town id"));
continue;
}
Town* town = map.towns.getTown(town_id);
if(town) {
warning(wxT("Duplicate town id %d, discarding duplicate"), town_id);
continue;
} else {
town = newd Town(town_id);
if(!map.towns.addTown(town)) {
delete town;
continue;
}
}
std::string town_name;
if(!townNode->getString(town_name)) {
warning(wxT("Invalid town name"));
continue;
}
town->setName(town_name);
Position pos;
uint16_t x;
uint16_t y;
uint8_t z;
if(!townNode->getU16(x) ||
!townNode->getU16(y) ||
!townNode->getU8(z))
{
warning(wxT("Invalid town temple position"));
continue;
}
pos.x = x;
pos.y = y;
pos.z = z;
town->setTemplePosition(pos);
} while(townNode->advance());
} break;
case OTMM_HOUSE_DATA: {
BinaryNode* houseNode = mapNode->getChild();
if(houseNode) do {
uint8_t house_type;
if(!houseNode->getByte(house_type)) {
warning(wxT("Could not read house type"));
continue;
}
if(house_type != OTMM_HOUSE) {
warning(wxT("Unknown house type."));
continue;
}
uint32_t house_id;
if(!houseNode->getU32(house_id)) {
warning(wxT("Could not read house id."));
continue;
}
House* house = map.houses.getHouse(house_id);
if(!house) {
continue;
}
std::string house_name;
if(!houseNode->getString(house_name)) {
warning(wxT("Could not read house name."));
continue;
}
uint32_t town_id;
if(!houseNode->getU32(town_id)) {
warning(wxT("Could not read house town id."));
continue;
}
uint32_t rent;
if(!houseNode->getU32(rent)) {
warning(wxT("Could not read house rent."));
continue;
}
house->name = house_name;
house->townid = town_id;
house->rent = rent;
uint16_t x;
uint16_t y;
uint8_t z;
if(!houseNode->getU16(x) ||
!houseNode->getU16(y) ||
!houseNode->getU8(z))
{
warning(wxT("Invalid town temple position"));
continue;
}
house->setExit(Position(x, y, z));
} while(houseNode->advance());
} break;
}
} while(mapNode->advance());
return true;
}