本文整理汇总了C++中Stairs::getDirection方法的典型用法代码示例。如果您正苦于以下问题:C++ Stairs::getDirection方法的具体用法?C++ Stairs::getDirection怎么用?C++ Stairs::getDirection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Stairs
的用法示例。
在下文中一共展示了Stairs::getDirection方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: scanForEntrances
void Maze::scanForEntrances() {
for (uint32_t i = 1; i <= getFloorCount(); i++) {
Map* curMap = getFloor(i);
if (i == 1) {
// In this case, we want up stairs.
bool foundEntrance = false;
bool multipleWarned = false;
for (int32_t y = 0; y < curMap->getHeight(); y++) {
for (int32_t x = 0; x < curMap->getWidth(); x++) {
Activatable* act = curMap->getActivatable(x, y);
if (act) {
Stairs* stairs = act->asStairs();
if (stairs && stairs->getDirection() == StairDirection::UP) {
Facing dstFacing = stairs->getDestinationFacing();
// Adjust the position so that when the player enters, they're
// facing the right direction, and in the right position.
int32_t dstX = x;
int32_t dstY = y;
switch(dstFacing) {
case Facing::NORTH:
dstY--;
break;
case Facing::EAST:
dstX++;
break;
case Facing::SOUTH:
dstY++;
break;
case Facing::WEST:
dstX--;
break;
}
if (foundEntrance && !multipleWarned) {
writeToLog(MessageLevel::WARNING, "Maze::scanForEntrances(): Multiple up stairs found on floor of maze.");
multipleWarned = true;
}
else {
if (!curMap->canEntityEnter(dstX, dstY)) {
writeToLog(MessageLevel::WARNING, "Maze::scanForEntrances(): Entrance as specified would place player in solid wall.");
}
else {
mazeEntrance = Entrance(i, dstX, dstY, dstFacing);
foundEntrance = true;
}
}
}
}
}
}
}
else {
// Otherwise, we're looking for geomagnetic poles. This is currently
// not implemented. Mostly because geopoles don't exist.
}
}
}