本文整理汇总了C++中House::getEmptyDoorID方法的典型用法代码示例。如果您正苦于以下问题:C++ House::getEmptyDoorID方法的具体用法?C++ House::getEmptyDoorID怎么用?C++ House::getEmptyDoorID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::getEmptyDoorID方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: draw
void DoorBrush::draw(BaseMap* map, Tile* tile, void* parameter) {
for(ItemVector::iterator item_iter = tile->items.begin();
item_iter != tile->items.end();)
{
Item* item = *item_iter;
if(item->isWall() == false) {
++item_iter;
continue;
}
WallBrush* wb = item->getWallBrush();
if(!wb) {
++item_iter;
continue;
}
BorderType wall_alignment = item->getWallAlignment();
uint16_t discarded_id = 0; // The id of a discarded match
bool close_match = false;
bool perfect_match = false;
bool open = false;
if(parameter) {
open = *reinterpret_cast<bool*>(parameter);
}
if(item->isBrushDoor()) {
open = item->isOpen();
}
WallBrush* test_brush = wb;
do {
for(std::vector<WallBrush::DoorType>::iterator iter = test_brush->door_items[wall_alignment].begin();
iter != test_brush->door_items[wall_alignment].end();
++iter)
{
WallBrush::DoorType& dt = *iter;
if(dt.type == doortype) {
ASSERT(dt.id);
ItemType& it = item_db[dt.id];
ASSERT(it.id != 0);
if(it.isOpen == open) {
item = transformItem(item, dt.id, tile);
perfect_match = true;
break;
} else if(close_match == false) {
discarded_id = dt.id;
close_match = true;
}
if(!close_match && discarded_id == 0) {
discarded_id = dt.id;
}
}
}
test_brush = test_brush->redirect_to;
if(perfect_match) {
break;
}
} while(test_brush != wb && test_brush != nullptr);
// If we've found no perfect match, use a close-to perfect
if(perfect_match == false && discarded_id) {
item = transformItem(item, discarded_id, tile);
}
if(settings.getInteger(Config::AUTO_ASSIGN_DOORID) && tile->isHouseTile()) {
Map* mmap = dynamic_cast<Map*>(map);
Door* door = dynamic_cast<Door*>(item);
if(mmap && door) {
House* house = mmap->houses.getHouse(tile->getHouseID());
ASSERT(house);
Map* real_map = dynamic_cast<Map*>(map);
if(real_map) {
door->setDoorID(house->getEmptyDoorID());
}
}
}
// We need to consider decorations!
while(true) {
// Vector has been modified, before we can use the iterator again we need to find the wall item again
item_iter = tile->items.begin();
while(true) {
if(item_iter == tile->items.end()) {
return;
}
if(*item_iter == item) {
++item_iter;
if(item_iter == tile->items.end()) {
return;
}
break;
}
++item_iter;
}
// Now it points to the correct item!
item = *item_iter;
if(item->isWall()) {
//.........这里部分代码省略.........