本文整理汇总了C++中ObjectBase::getOwner方法的典型用法代码示例。如果您正苦于以下问题:C++ ObjectBase::getOwner方法的具体用法?C++ ObjectBase::getOwner怎么用?C++ ObjectBase::getOwner使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ObjectBase
的用法示例。
在下文中一共展示了ObjectBase::getOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handleActionClick
void UnitBase::handleActionClick(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();
if(tempTarget->getOwner()->getTeam() != getOwner()->getTeam()) {
// attack
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_ATTACKOBJECT,objectID,tempTarget->getObjectID()));
} else {
// move to object/structure
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_MOVE2OBJECT,objectID,tempTarget->getObjectID()));
}
} else {
// move this unit
currentGame->getCommandManager().addCommand(Command(pLocalPlayer->getPlayerID(), CMD_UNIT_MOVE2POS,objectID,(Uint32) xPos, (Uint32) yPos, (Uint32) true));
}
}
}
}
示例2: getRadarColor
Uint32 Tile::getRadarColor(House* pHouse, bool radar) {
if(isExplored(pHouse->getHouseID()) || debug) {
if(isFogged(pHouse->getHouseID()) && radar) {
return fogColor;
} else {
ObjectBase* pObject = getObject();
if(pObject != NULL) {
int color;
if(pObject->getItemID() == Unit_Sandworm) {
color = COLOR_WHITE;
} else {
switch(pObject->getOwner()->getHouseID()) {
case HOUSE_HARKONNEN:
color = COLOR_HARKONNEN;
break;
case HOUSE_ATREIDES:
color = COLOR_ATREIDES;
break;
case HOUSE_ORDOS:
color = COLOR_ORDOS;
break;
case HOUSE_FREMEN:
color = COLOR_FREMEN;
break;
case HOUSE_SARDAUKAR:
color = COLOR_SARDAUKAR;
break;
case HOUSE_MERCENARY:
color = COLOR_MERCENARY;
break;
default:
color = COLOR_BLACK;
break;
}
}
if(pObject->isAUnit()) {
fogColor = getColorByTerrainType(getType());
} else {
fogColor = color;
}
// units and structures of the enemy are not visible if no radar
if(!radar && !debug && (pObject->getOwner()->getTeam() != pHouse->getTeam())) {
return COLOR_BLACK;
} else {
return color;
}
} else {
fogColor = getColorByTerrainType(getType());
if(!radar && !debug) {
return COLOR_BLACK;
} else {
return fogColor;
}
}
}
} else {
return COLOR_BLACK;
}
}