#include <gamestatus.hpp>
Public Member Functions | |
gamestatus (const config &time_cfg, int num_turns, game_state *s_o_g=NULL) | |
Reads turns and time information from parameters. | |
void | write (config &cfg) const |
time_of_day | get_time_of_day () const |
~eturns time of day object for current turn. | |
time_of_day | get_previous_time_of_day () const |
time_of_day | get_time_of_day (int illuminated, const gamemap::location &loc) const |
time_of_day | get_time_of_day (int illuminated, const gamemap::location &loc, int n_turn) const |
Returns time of day object in the turn. | |
bool | set_time_of_day (int) |
Sets global time of day in this turn. | |
size_t | turn () const |
int | number_of_turns () const |
void | modify_turns (const std::string &mod) |
void | add_turns (int num) |
bool | next_turn () |
Function to move to the next turn. | |
const game_state & | sog () const |
Static Public Member Functions | |
static bool | is_start_ToD (const std::string &) |
Public Attributes | |
std::vector< team > * | teams |
Private Member Functions | |
void | set_start_ToD (config &, game_state *) |
time_of_day | get_time_of_day_turn (int nturn) const |
Returns time of day object in the turn. | |
void | next_time_of_day () |
Private Attributes | |
std::vector< time_of_day > | times_ |
std::vector< area_time_of_day > | areas_ |
size_t | turn_ |
int | numTurns_ |
int | currentTime_ |
const game_state * | state_of_game_ |
Classes | |
struct | area_time_of_day |
Namely the current turn, the number of turns, and the time of day.
Definition at line 209 of file gamestatus.hpp.
gamestatus::gamestatus | ( | const config & | time_cfg, | |
int | num_turns, | |||
game_state * | s_o_g = NULL | |||
) |
Reads turns and time information from parameters.
It sets random starting ToD and current_tod to config.
Definition at line 196 of file gamestatus.cpp.
References areas_, config::get_children(), gamestatus::area_time_of_day::hexes, utils::interpolate_variables_into_string(), parse_location_range(), parse_times(), preferences::random_start_time(), set_start_ToD(), gamestatus::area_time_of_day::times, times_, turn_, gamestatus::area_time_of_day::xsrc, and gamestatus::area_time_of_day::ysrc.
void gamestatus::write | ( | config & | cfg | ) | const |
Definition at line 235 of file gamestatus.cpp.
References config::add_child(), areas_, buf, currentTime_, numTurns_, times_, and turn_.
Referenced by events::menu_handler::write_game_snapshot().
time_of_day gamestatus::get_time_of_day | ( | ) | const |
~eturns time of day object for current turn.
Definition at line 281 of file gamestatus.cpp.
References _, currentTime_, times_, and VALIDATE.
Referenced by game_display::adjust_colours(), game_display::draw(), game_display::draw_report(), reports::generate_report(), get_time_of_day(), play_controller::init_side(), terrain_filter::match_internal(), game_display::new_turn(), ai::power_projection(), and timeofday_at().
time_of_day gamestatus::get_previous_time_of_day | ( | ) | const |
Definition at line 288 of file gamestatus.cpp.
References get_time_of_day_turn(), and turn().
Referenced by game_display::new_turn().
time_of_day gamestatus::get_time_of_day | ( | int | illuminated, | |
const gamemap::location & | loc | |||
) | const |
time_of_day gamestatus::get_time_of_day | ( | int | illuminated, | |
const gamemap::location & | loc, | |||
int | n_turn | |||
) | const |
Returns time of day object in the turn.
It first tries to look for specified. If no area time specified in location, it returns global time.
Definition at line 296 of file gamestatus.cpp.
References _, areas_, time_of_day::bonus_modified, get_time_of_day_turn(), time_of_day::lawful_bonus, and VALIDATE.
bool gamestatus::set_time_of_day | ( | int | newTime | ) |
Sets global time of day in this turn.
Time is a number between 0 and n-1, where n is number of ToDs.
Definition at line 325 of file gamestatus.cpp.
References currentTime_, and times_.
Referenced by set_start_ToD().
size_t gamestatus::turn | ( | ) | const |
Definition at line 393 of file gamestatus.cpp.
References turn_.
Referenced by playsingle_controller::before_human_turn(), play_controller::expand_autosaves(), play_controller::finish_turn(), reports::generate_report(), get_previous_time_of_day(), get_time_of_day(), get_time_of_day_turn(), play_controller::init_side(), playsingle_controller::linger(), playmp_controller::linger(), playmp_controller::play_network_turn(), playsingle_controller::play_scenario(), replay_controller::play_side(), playsingle_controller::play_turn(), events::menu_handler::save_game(), and set_start_ToD().
int gamestatus::number_of_turns | ( | ) | const |
Definition at line 398 of file gamestatus.cpp.
References numTurns_.
Referenced by reports::generate_report(), and playsingle_controller::play_scenario().
void gamestatus::modify_turns | ( | const std::string & | mod | ) |
void gamestatus::add_turns | ( | int | num | ) |
bool gamestatus::next_turn | ( | ) |
Function to move to the next turn.
Returns true iff time has expired.
Definition at line 412 of file gamestatus.cpp.
References next_time_of_day(), numTurns_, and turn_.
Referenced by playsingle_controller::check_time_over(), and replay_controller::play_side().
bool gamestatus::is_start_ToD | ( | const std::string & | random_start_time | ) | [static] |
Definition at line 339 of file gamestatus.cpp.
References utils::string_bool().
Referenced by mp::connect::load_game(), and set_start_ToD().
const game_state& gamestatus::sog | ( | ) | const [inline] |
Definition at line 233 of file gamestatus.hpp.
References state_of_game_.
void gamestatus::set_start_ToD | ( | config & | level, | |
game_state * | s_o_g | |||
) | [private] |
Definition at line 345 of file gamestatus.cpp.
References buf, currentTime_, utils::interpolate_variables_into_string(), is_start_ToD(), preferences::random_start_time(), utils::REMOVE_EMPTY, set_time_of_day(), utils::split(), utils::string_bool(), utils::STRIP_SPACES, times_, and turn().
Referenced by gamestatus().
time_of_day gamestatus::get_time_of_day_turn | ( | int | nturn | ) | const [private] |
Returns time of day object in the turn.
Correct time is calculated from current time.
Definition at line 266 of file gamestatus.cpp.
References _, currentTime_, times_, turn(), and VALIDATE.
Referenced by get_previous_time_of_day(), and get_time_of_day().
void gamestatus::next_time_of_day | ( | ) | [private] |
Definition at line 386 of file gamestatus.cpp.
References _, currentTime_, times_, and VALIDATE.
Referenced by next_turn().
std::vector<team>* gamestatus::teams |
Definition at line 235 of file gamestatus.hpp.
Referenced by ai_interface::get_value(), terrain_filter::match_internal(), and play_controller::play_controller().
std::vector<time_of_day> gamestatus::times_ [private] |
Definition at line 242 of file gamestatus.hpp.
Referenced by gamestatus(), get_time_of_day(), get_time_of_day_turn(), next_time_of_day(), set_start_ToD(), set_time_of_day(), and write().
std::vector<area_time_of_day> gamestatus::areas_ [private] |
Definition at line 257 of file gamestatus.hpp.
Referenced by gamestatus(), get_time_of_day(), and write().
size_t gamestatus::turn_ [private] |
Definition at line 259 of file gamestatus.hpp.
Referenced by gamestatus(), next_turn(), turn(), and write().
int gamestatus::numTurns_ [private] |
Definition at line 260 of file gamestatus.hpp.
Referenced by add_turns(), modify_turns(), next_turn(), number_of_turns(), and write().
int gamestatus::currentTime_ [private] |
Definition at line 261 of file gamestatus.hpp.
Referenced by get_time_of_day(), get_time_of_day_turn(), next_time_of_day(), set_start_ToD(), set_time_of_day(), and write().
const game_state* gamestatus::state_of_game_ [private] |
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |