add a function to tod_manager to get time of day...

...at the next turn of a particular enemy team
This commit is contained in:
Iurii Chernyi 2011-01-03 16:06:17 +00:00
parent aade3aae19
commit fad3df6dda
2 changed files with 24 additions and 0 deletions

View file

@ -20,6 +20,7 @@
#include "gamestatus.hpp"
#include "log.hpp"
#include "map.hpp"
#include "play_controller.hpp"
#include "resources.hpp"
#include "unit.hpp"
#include "unit_abilities.hpp"
@ -114,6 +115,22 @@ const time_of_day& tod_manager::get_previous_time_of_day() const
return get_time_of_day_turn(times_, turn_ - 1);
}
const time_of_day& tod_manager::get_time_of_day_of_next_turn(const int side, const map_location &loc) const
{
int nturn = turn_;
if (resources::controller->current_side() < side)
{
//that side went before current side, its next turn will be on next game turn
nturn++;
}
if (loc != map_location::null_location)
{
return get_time_of_day(loc, nturn);
}
return get_time_of_day_turn(times_, nturn);
}
const time_of_day& tod_manager::get_time_of_day(const map_location& loc, int n_turn) const
{
if(n_turn == 0)

View file

@ -35,6 +35,13 @@ class tod_manager : public savegame::savegame_config
/** Returns time of day object for current turn. */
const time_of_day& get_time_of_day() const;
const time_of_day& get_previous_time_of_day() const;
/**
* Returns time of day object for the next turn of particular side
* loc - optional location
*/
const time_of_day& get_time_of_day_of_next_turn(const int side, const map_location &loc = map_location::null_location) const;
/**
* Returns time of day object in the turn at a location.
* If nturn = 0 use current turn