get_area_by_id() method. Will be used in the SLF.

This commit is contained in:
fendrin 2013-12-20 02:20:41 +01:00
parent 2abb7cb8f1
commit b4ceb5f272
2 changed files with 15 additions and 0 deletions

View file

@ -244,6 +244,15 @@ std::vector<std::string> tod_manager::get_area_ids() const
return areas;
}
const std::set<map_location>& tod_manager::get_area_by_id(const std::string& id) const
{
BOOST_FOREACH(const area_time_of_day& area, areas_) {
if (area.id == id)
return area.hexes;
}
return areas_[0].hexes;
}
const std::set<map_location>& tod_manager::get_area_by_index(int index) const
{
return areas_[index].hexes;

View file

@ -81,6 +81,12 @@ class tod_manager : public savegame::savegame_config
*/
const std::set<map_location>& get_area_by_index(int index) const;
/**
* @param id
* @returns the area with @id
*/
const std::set<map_location>& get_area_by_id(const std::string& id) const;
/**
* Adds a new local time area from config, making it follow its own
* time-of-day sequence.