* @brief Checks whether anyone on a particular faction is looking at the unit. * * Similar to getSpottingUnits() but returns a bool and stops searching if one positive hit is found. * * @param faction Faction to check through. * @param unit Whom to spot. * @return True when the unit can be seen */
| 1474 | * @return True when the unit can be seen |
| 1475 | */ |
| 1476 | bool SavedBattleGame::eyesOnTarget(UnitFaction faction, BattleUnit* unit) |
| 1477 | { |
| 1478 | for (std::vector<BattleUnit*>::iterator i = getUnits()->begin(); i != getUnits()->end(); ++i) |
| 1479 | { |
| 1480 | if ((*i)->getFaction() != faction) continue; |
| 1481 | |
| 1482 | std::vector<BattleUnit*> *vis = (*i)->getVisibleUnits(); |
| 1483 | if (std::find(vis->begin(), vis->end(), unit) != vis->end()) return true; |
| 1484 | // aliens know the location of all XCom agents sighted by all other aliens due to sharing locations over their space-walkie-talkies |
| 1485 | } |
| 1486 | |
| 1487 | return false; |
| 1488 | } |
| 1489 | |
| 1490 | /** |
| 1491 | * Adds this unit to the vector of falling units, |
nothing calls this directly
no test coverage detected