Unit Map: added has_unit_at helper function

Just a small wrapper function to check whether a unit is present a certain location.
This commit is contained in:
Charles Dang 2017-07-19 14:17:00 +11:00
parent fc8e9cf07e
commit 1408da68ce
2 changed files with 8 additions and 0 deletions

View file

@ -385,3 +385,8 @@ bool unit_map::has_unit(const unit * const u) const
}
return false;
}
bool unit_map::has_unit_at(const map_location& loc) const
{
return find(loc) != end();
}

View file

@ -394,6 +394,9 @@ public:
*/
bool has_unit(const unit * const u) const ;
/** Tests whether a unit exists at the given location. */
bool has_unit_at(const map_location& loc) const;
private:
umap::iterator begin_core() const ;