MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / eyesOnTarget

Method eyesOnTarget

src/Savegame/SavedBattleGame.cpp:1476–1488  ·  view source on GitHub ↗

* @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 */

Source from the content-addressed store, hash-verified

1474 * @return True when the unit can be seen
1475 */
1476bool 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,

Callers

nothing calls this directly

Calls 2

getFactionMethod · 0.80
getVisibleUnitsMethod · 0.80

Tested by

no test coverage detected