gamestatus Class Reference

Contains the global status of the game. More...

#include <gamestatus.hpp>

Collaboration diagram for gamestatus:

Collaboration graph
[legend]

List of all members.

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_statesog () 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_daytimes_
std::vector< area_time_of_dayareas_
size_t turn_
int numTurns_
int currentTime_
const game_statestate_of_game_

Classes

struct  area_time_of_day


Detailed Description

Contains the global status of the game.

Namely the current turn, the number of turns, and the time of day.

Definition at line 209 of file gamestatus.hpp.


Constructor & Destructor Documentation

gamestatus::gamestatus ( const config time_cfg,
int  num_turns,
game_state s_o_g = NULL 
)


Member Function Documentation

void gamestatus::write ( config cfg  )  const

time_of_day gamestatus::get_time_of_day (  )  const

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

Definition at line 318 of file gamestatus.cpp.

References get_time_of_day(), and turn().

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

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  ) 

Definition at line 402 of file gamestatus.cpp.

References utils::apply_modifier(), and numTurns_.

void gamestatus::add_turns ( int  num  ) 

Definition at line 406 of file gamestatus.cpp.

References numTurns_.

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]

Todo:
FIXME: since gamestatus may be constructed with NULL game_state* (by default), you should not rely on this function to return the current game_state.

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]

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().


Member Data Documentation

std::vector<team>* gamestatus::teams

std::vector<time_of_day> gamestatus::times_ [private]

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 262 of file gamestatus.hpp.

Referenced by sog().


The documentation for this class was generated from the following files:

Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs