Use better parameters order for get_time_of_day()

This commit is contained in:
Ali El Gariani 2011-12-11 22:02:42 +00:00
parent 86d535e36e
commit 4d0972b7c4
7 changed files with 12 additions and 12 deletions

View file

@ -2205,7 +2205,7 @@ void advance_unit(map_location loc, const std::string &advance_to, const bool &f
int combat_modifier(const map_location &loc,
unit_type::ALIGNMENT alignment, bool is_fearless)
{
const time_of_day &tod = resources::tod_manager->get_illuminated_time_of_day(0, loc);
const time_of_day &tod = resources::tod_manager->get_illuminated_time_of_day(loc);
int bonus;
int lawful_bonus = tod.lawful_bonus;

View file

@ -167,7 +167,7 @@ display::~display()
const time_of_day & display::get_time_of_day(const map_location& loc) const
{
static time_of_day tod;
if(resources::tod_manager != NULL){ tod = resources::tod_manager->get_time_of_day(0, loc); }
if(resources::tod_manager != NULL){ tod = resources::tod_manager->get_time_of_day(loc); }
return tod;
}

View file

@ -955,7 +955,7 @@ static config time_of_day_at(map_location& mouseover_hex)
// Don't show illuminated time on fogged tiles.
tod = resources::tod_manager->get_time_of_day_with_areas(mouseover_hex);
} else {
tod = resources::tod_manager->get_illuminated_time_of_day(0, mouseover_hex);
tod = resources::tod_manager->get_illuminated_time_of_day(mouseover_hex);
}
int b = tod.lawful_bonus;

View file

@ -1723,8 +1723,8 @@ static int intf_get_time_of_day(lua_State *L)
}
const time_of_day& tod = consider_illuminates ?
resources::tod_manager->get_illuminated_time_of_day(for_turn, loc) :
resources::tod_manager->get_time_of_day(for_turn, loc);
resources::tod_manager->get_illuminated_time_of_day(loc, for_turn) :
resources::tod_manager->get_time_of_day(loc, for_turn);
lua_newtable(L);
lua_pushstring(L, tod.id.c_str());

View file

@ -214,7 +214,7 @@ bool terrain_filter::match_internal(const map_location& loc, const bool ignore_x
if(flat_) {
tod = resources::tod_manager->get_time_of_day_with_areas(loc);
} else {
tod = resources::tod_manager->get_illuminated_time_of_day(0, loc);
tod = resources::tod_manager->get_illuminated_time_of_day(loc);
}
}
if(!tod_type.empty()) {

View file

@ -95,8 +95,7 @@ config tod_manager::to_config() const
return cfg;
}
const time_of_day& tod_manager::get_time_of_day(int for_turn
, const map_location& loc) const
const time_of_day& tod_manager::get_time_of_day(const map_location& loc, int for_turn) const
{
if(for_turn == 0) for_turn = turn_;
if(!resources::game_map->on_board(loc)) {
@ -215,7 +214,7 @@ const time_of_day& tod_manager::get_time_of_day_turn(const std::vector<time_of_d
return times[time];
}
const time_of_day tod_manager::get_illuminated_time_of_day(int for_turn, const map_location& loc) const
const time_of_day tod_manager::get_illuminated_time_of_day(const map_location& loc, int for_turn) const
{
if(for_turn == 0) for_turn = turn_;

View file

@ -38,15 +38,16 @@ class tod_manager : public savegame::savegame_config
* for_turn = 0 means current turn
* if loc is on board then tod areas matter (else: scenario main time)
*/
const time_of_day& get_time_of_day(int for_turn = 0
, const map_location& loc = map_location()) const;
const time_of_day& get_time_of_day(const map_location& loc = map_location(),
int for_turn = 0) const;
/**
* Returns time of day object for the passed turn.
* taking account of illumination caused by units
* for_turn = 0 means current turn
* if loc is on board then tod areas matter (else: scenario main time)
*/
const time_of_day get_illuminated_time_of_day(int for_turn, const map_location& loc) const;
const time_of_day get_illuminated_time_of_day(const map_location& loc,
int for_turn = 0) const;
const time_of_day& get_previous_time_of_day() const;