diff --git a/src/game_board.cpp b/src/game_board.cpp index 1882c4412351..065f013aa9ce 100644 --- a/src/game_board.cpp +++ b/src/game_board.cpp @@ -61,6 +61,15 @@ unit_map::iterator game_board::find_visible_unit(const map_location &loc, return u; } +bool game_board::has_visible_unit(const map_location & loc, const team& current_team, bool see_all) +{ + if (!map_.on_board(loc)) return false; + unit_map::iterator u = units_.find(loc); + if (!u.valid() || !u->is_visible_to_team(current_team, see_all)) + return false; + return true; +} + unit* game_board::get_visible_unit(const map_location &loc, const team ¤t_team, bool see_all) { diff --git a/src/game_board.hpp b/src/game_board.hpp index 7e40ef7a4678..4a8f7a5a6bfb 100644 --- a/src/game_board.hpp +++ b/src/game_board.hpp @@ -117,6 +117,10 @@ class game_board { // Global accessor from unit.hpp unit_map::iterator find_visible_unit(const map_location &loc, const team& current_team, bool see_all = false); + unit_map::iterator find_visible_unit(const map_location & loc, size_t team, bool see_all = false) { return find_visible_unit(loc, teams_[team], see_all); } + bool has_visible_unit (const map_location & loc, const team & team, bool see_all = false); + bool has_visible_unit (const map_location & loc, size_t team, bool see_all = false) { return has_visible_unit(loc, teams_[team], see_all); } + unit* get_visible_unit(const map_location &loc, const team ¤t_team, bool see_all = false); //TODO: can this not return a pointer? };