MCPcopy Create free account
hub / github.com/OpenDungeons/OpenDungeons / getVisibleForce

Method getVisibleForce

source/gamemap/GameMap.cpp:1705–1744  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1703}
1704
1705std::vector<GameEntity*> GameMap::getVisibleForce(const std::vector<Tile*>& visibleTiles, Seat* seat, bool enemyForce)
1706{
1707 std::vector<GameEntity*> returnList;
1708
1709 // Loop over the visible tiles
1710 for (Tile* tile : visibleTiles)
1711 {
1712 if(tile == nullptr)
1713 {
1714 OD_LOG_ERR("unexpected null tile");
1715 continue;
1716 }
1717
1718 if(enemyForce)
1719 {
1720 tile->fillWithEntities(returnList, SelectionEntityWanted::creatureAliveEnemyAttackable, seat->getPlayer());
1721 Building* building = tile->getCoveringBuilding();
1722 if((building != nullptr) &&
1723 (!building->getSeat()->isAlliedSeat(seat)) &&
1724 (building->isAttackable(tile, seat)) &&
1725 (std::find(returnList.begin(), returnList.end(), building) == returnList.end()))
1726 {
1727 returnList.push_back(building);
1728 }
1729 }
1730 else
1731 {
1732 tile->fillWithEntities(returnList, SelectionEntityWanted::creatureAliveAllied, seat->getPlayer());
1733 Building* building = tile->getCoveringBuilding();
1734 if((building != nullptr) &&
1735 (building->getSeat()->isAlliedSeat(seat)) &&
1736 (std::find(returnList.begin(), returnList.end(), building) == returnList.end()))
1737 {
1738 returnList.push_back(building);
1739 }
1740 }
1741 }
1742
1743 return returnList;
1744}
1745
1746std::vector<GameEntity*> GameMap::getVisibleCreatures(const std::vector<Tile*>& visibleTiles, Seat* seat, bool enemyCreatures)
1747{

Callers

nothing calls this directly

Calls 6

fillWithEntitiesMethod · 0.80
getCoveringBuildingMethod · 0.80
isAlliedSeatMethod · 0.80
getPlayerMethod · 0.45
getSeatMethod · 0.45
isAttackableMethod · 0.45

Tested by

no test coverage detected