本文整理汇总了C++中ObjectBase::getObjectID方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectBase::getObjectID方法的具体用法?C++ ObjectBase::getObjectID怎么用?C++ ObjectBase::getObjectID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectBase
的用法示例。
在下文中一共展示了ObjectBase::getObjectID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setType
void Tile::setType(int newType) {
type = newType;
destroyedStructureTile = DestroyedStructure_None;
if (type == Terrain_Spice) {
spice = currentGame->randomGen.rand(RANDOMSPICEMIN, RANDOMSPICEMAX);
} else if (type == Terrain_ThickSpice) {
spice = currentGame->randomGen.rand(RANDOMTHICKSPICEMIN, RANDOMTHICKSPICEMAX);
} else if (type == Terrain_Dunes) {
} else {
spice = 0;
if (isRock()) {
sandRegion = NONE;
if (hasAnUndergroundUnit()) {
ObjectBase* current;
std::list<Uint32>::const_iterator iter;
iter = assignedUndergroundUnitList.begin();
do {
current = currentGame->getObjectManager().getObject(*iter);
++iter;
if(current == NULL)
continue;
unassignUndergroundUnit(current->getObjectID());
current->destroy();
} while(iter != assignedUndergroundUnitList.end());
}
if(type == Terrain_Mountain) {
if(hasANonInfantryGroundObject()) {
ObjectBase* current;
std::list<Uint32>::const_iterator iter;
iter = assignedNonInfantryGroundObjectList.begin();
do {
current = currentGame->getObjectManager().getObject(*iter);
++iter;
if(current == NULL)
continue;
unassignNonInfantryGroundObject(current->getObjectID());
current->destroy();
} while(iter != assignedNonInfantryGroundObjectList.end());
}
}
}
}
for (int i=location.x; i <= location.x+3; i++) {
for (int j=location.y; j <= location.y+3; j++) {
if (currentGameMap->tileExists(i, j)) {
currentGameMap->getTile(i, j)->clearTerrain();
}
}
}
}
示例2: handleAttackClick
void UnitBase::handleAttackClick(int xPos, int yPos) {
if(respondable) {
if(currentGameMap->tileExists(xPos, yPos)) {
if(currentGameMap->getTile(xPos,yPos)->hasAnObject()) {
// attack unit/structure or move to structure
ObjectBase* tempTarget = currentGameMap->getTile(xPos,yPos)->getObject();
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_ATTACKOBJECT,objectID,tempTarget->getObjectID()));
} else {
// attack pos
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_ATTACKPOS,objectID,(Uint32) xPos, (Uint32) yPos, (Uint32) true));
}
}
}
}