本文整理汇总了C++中Direction::value方法的典型用法代码示例。如果您正苦于以下问题:C++ Direction::value方法的具体用法?C++ Direction::value怎么用?C++ Direction::value使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Direction
的用法示例。
在下文中一共展示了Direction::value方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
/*
* Do the actual work of showing me with arrow in top-down view
*/
void
showMe(Loc x_loc, Loc y_loc, Direction dir)
{
register BitCell *bp;
Rat rp;
bp = normalArrows;
HackMazeBitmap(x_loc, y_loc, &bp[dir.value()]);
rp = M->rat(MY_RAT_INDEX);
rp.playing = TRUE;
rp.x = x_loc;
rp.y = y_loc;
rp.dir = dir;
M->ratIs(rp, MY_RAT_INDEX);
}
示例2: hidden
void
ShowView(Loc x, Loc y, Direction dir)
{
register XYpair *tp = viewTable;
register int tx = x.value();
register int ty = y.value();
RatIndexType ratIndex(0);
RatLook ratLook;
bool oldVisible;
ClearView();
prevEdge3 = prevEdge7 = FALSE;
while (!M->maze_[tx][ty]) {
tp = hidden(tx, ty, dir, tp); /* draw a cell */
switch (dir.value()) {
case NORTH: tx++; break;
case SOUTH: tx--; break;
case EAST: ty++; break;
case WEST: ty--; break;
}
}
if (prevEdge3)
(void) plotLine(edge3Lines, TRUE);
if (prevEdge7)
(void) plotLine(edge7Lines, TRUE);
/* show the tokens */
for (ratIndex = 0; ratIndex < MAX_RATS; ratIndex = RatIndexType(ratIndex.value() + 1)) {
if (ratIndex == MY_RAT_INDEX)
continue;
ratLook = &Rats2Display[ratIndex.value()];
oldVisible = ratLook->visible;
TokenVisible(ratIndex);
if (ratLook->visible == TRUE)
XORToken(ratIndex);
if (ratLook->visible != oldVisible)
UpdateScoreCard(ratIndex);
}
}
示例3: canWalkTo
bool Actor::canWalkTo(Position pos, Direction dir)
{
switch(dir.value()){
case enums::NORTH: pos.y += -1; break;
case enums::WEST: pos.x += -1; break;
case enums::EAST: pos.x += 1; break;
case enums::SOUTH: pos.y += 1; break;
default:
break;
}
if(isInSpawnRange(pos)){
if(getWalkCache(pos) == 0){
return false;
}
Tile* tile = g_game.getParentTile(pos.x, pos.y, pos.z);
if(tile && tile->getTopVisibleCreature(this) == NULL && tile->__queryAdd(0, this, 1, FLAG_PATHFINDING) == RET_NOERROR){
return true;
}
}
return false;
}