本文整理汇总了C++中MoverPtr::getCellPosition方法的典型用法代码示例。如果您正苦于以下问题:C++ MoverPtr::getCellPosition方法的具体用法?C++ MoverPtr::getCellPosition怎么用?C++ MoverPtr::getCellPosition使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MoverPtr
的用法示例。
在下文中一共展示了MoverPtr::getCellPosition方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: calcJumpGoals
long MoverGroup::calcJumpGoals (Stuff::Vector3D goal, long numMovers, Stuff::Vector3D* goalList, GameObjectPtr DFATarget) {
long numJumping = 0;
//-----------------------------
// First, build the jump map...
long jumpMap[JUMPMAP_CELL_DIM][JUMPMAP_CELL_DIM];
//------------------------------------------------------------
// The initial goal tile is placed at the center of the map...
long goalCell[2] = {0, 0};
land->worldToCell(goal, goalCell[0], goalCell[1]);
long mapCellUL[2] = {0, 0};
mapCellUL[0] = goalCell[0] - JUMPMAP_CELL_DIM / 2;
mapCellUL[1] = goalCell[1] - JUMPMAP_CELL_DIM / 2;
// -1 = OPEN
// -2 = BLOCKED
// 0 thru # = already selected for that # mover in the group
for (long r = 0; r < JUMPMAP_CELL_DIM; r++)
for (long c = 0; c < JUMPMAP_CELL_DIM; c++) {
long cellRow = mapCellUL[0] + r;
long cellCol = mapCellUL[1] + c;
if (GameMap->inBounds(cellRow, cellCol)) {
MapCellPtr mapCell = GameMap->getCell(cellRow, cellCol);
//-----------------------
// Tile (terrain) type...
//long tileType = curTile.getTileType();
if (!mapCell->getPassable())
jumpMap[r][c] = -2;
else
jumpMap[r][c] = -1;
#ifdef USE_OVERLAYS_IN_MC2
long overlay = mapCell->getOverlay();
if (OverlayIsBridge[overlay]) {
switch (overlay) {
case OVERLAY_WATER_BRIDGE_NS:
case OVERLAY_RAILROAD_WATER_BRIDGE_NS:
jumpMap[row][col] = -2;
jumpMap[row][col + 2] = -2;
jumpMap[row + 1][col] = -2;
jumpMap[row + 1][col + 2] = -2;
jumpMap[row + 2][col] = -2;
jumpMap[row + 2][col + 2] = -2;
break;
case OVERLAY_WATER_BRIDGE_EW:
case OVERLAY_RAILROAD_WATER_BRIDGE_EW:
jumpMap[row][col] = -2;
jumpMap[row][col + 1] = -2;
jumpMap[row][col + 2] = -2;
jumpMap[row + 2][col] = -2;
jumpMap[row + 2][col + 1] = -2;
jumpMap[row + 2][col + 2] = -2;
break;
case OVERLAY_WATER_BRIDGE_NS_DESTROYED:
case OVERLAY_RAILROAD_WATER_BRIDGE_NS_DESTROYED:
case OVERLAY_WATER_BRIDGE_EW_DESTROYED:
case OVERLAY_RAILROAD_WATER_BRIDGE_EW_DESTROYED:
jumpMap[row][col] = -2;
jumpMap[row][col + 1] = -2;
jumpMap[row][col + 2] = -2;
jumpMap[row + 1][col] = -2;
jumpMap[row + 1][col + 1] = -2;
jumpMap[row + 1][col + 2] = -2;
jumpMap[row + 2][col] = -2;
jumpMap[row + 2][col + 1] = -2;
jumpMap[row + 2][col + 2] = -2;
break;
}
}
#endif
}
else
jumpMap[r][c] = -2;
}
long moverCount = ObjectManager->getNumMovers();
for (long i = 0; i < moverCount; i++) {
MoverPtr mover = ObjectManager->getMover(i);
if ((mover->getObjectClass() != ELEMENTAL) && (mover != DFATarget) && !mover->isDisabled()) {
long mapCellRow, mapCellCol;
mover->getCellPosition(mapCellRow, mapCellCol);
mapCellRow -= mapCellUL[0];
mapCellCol -= mapCellUL[1];
if (inMapBounds(mapCellRow, mapCellCol, JUMPMAP_CELL_DIM, JUMPMAP_CELL_DIM))
jumpMap[mapCellRow][mapCellCol] = -2;
}
}
#ifdef _DEBUG
#if DEBUGJUMPGOALS
char debugStr[256];
sprintf(debugStr, "GROUP JUMP(%.2f,%.2f,%.2f)--UL = %d,%d: ", goal.x, goal.y, goal.z,mapCellUL[0], mapCellUL[1]);
#endif
#endif
//-----------------------------------------------------------------
//.........这里部分代码省略.........