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)); } } } }
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; } }