game_state Class Reference

#include <gamestatus.hpp>

Inheritance diagram for game_state:

Inheritance graph
[legend]
Collaboration diagram for game_state:

Collaboration graph
[legend]

List of all members.

Public Member Functions

 game_state ()
 game_state (const game_state &state)
 game_state (const config &cfg, bool show_replay=false)
 ~game_state ()
game_stateoperator= (const game_state &state)
player_infoget_player (const std::string &id)
 Return the Nth player, or NULL if no such player exists.
const configget_variables () const
void set_variables (const config &vars)
void set_menu_items (const config::child_list &menu_items)
t_stringget_variable (const std::string &varname)
virtual const t_stringget_variable_const (const std::string &varname) const
configget_variable_cfg (const std::string &varname)
variable_info::array_range get_variable_cfgs (const std::string &varname)
void set_variable (const std::string &varname, const t_string &value)
configadd_variable_cfg (const std::string &varname, const config &value=config())
void clear_variable (const std::string &varname)
void clear_variable_cfg (const std::string &varname)
const simple_rngrng () const
simple_rngrng ()

Public Attributes

std::string label
 Name of the game (e.g. name of save file).
std::string version
 Version game was created with.
std::string campaign_type
 Type of the game - campaign, multiplayer etc.
std::string campaign_define
 If there is a define the campaign uses to customize data.
std::vector< std::string > campaign_xtra_defines
 more customization of data
std::string campaign
 the campaign being played
std::string history
 ancestral IDs
std::string abbrev
 the campaign abbreviation
std::string scenario
 the scenario being played
std::string next_scenario
 the scenario coming next (for campaigns)
std::string completion
 running. victory, or defeat
std::map< std::string,
player_info
players
 Information about campaign players who carry resources from previous levels, indexed by a string identifier.
std::vector
< scoped_wml_variable * > 
scoped_variables
std::map< std::string,
wml_menu_item * > 
wml_menu_items
std::string difficulty
 The difficulty level the game is being played on.
config replay_data
 If the game is saved mid-level, we have a series of replay steps to take the game up to the position it was saved at.
config starting_pos
 Saved starting state of the game.
config snapshot
 Snapshot of the game's current contents.
gamemap::location last_selected
 the last location where a select event fired.

Private Member Functions

void load_recall_list (const config::child_list &players)
 Loads the recall list.

Private Attributes

simple_rng rng_
config variables
config temporaries

Friends

struct variable_info


Detailed Description

Definition at line 97 of file gamestatus.hpp.


Constructor & Destructor Documentation

game_state::game_state (  )  [inline]

Definition at line 100 of file gamestatus.hpp.

Referenced by load_game().

game_state::game_state ( const game_state state  ) 

Definition at line 1171 of file gamestatus.cpp.

game_state::game_state ( const config cfg,
bool  show_replay = false 
)

game_state::~game_state (  ) 

Definition at line 1213 of file gamestatus.cpp.

References clear_wmi(), and wml_menu_items.


Member Function Documentation

game_state & game_state::operator= ( const game_state state  ) 

player_info * game_state::get_player ( const std::string &  id  ) 

const config& game_state::get_variables (  )  const [inline]

Definition at line 156 of file gamestatus.hpp.

References variables.

Referenced by mp::level_to_gamestate(), operator=(), scoped_wml_variable::store(), and write_game().

void game_state::set_variables ( const config vars  ) 

Definition at line 1217 of file gamestatus.cpp.

References config::empty(), variables, and WRN_NG.

Referenced by game_state(), mp::level_to_gamestate(), operator=(), and play_game().

void game_state::set_menu_items ( const config::child_list menu_items  ) 

Definition at line 1225 of file gamestatus.cpp.

References clear_wmi(), wml_menu_items, and WRN_NG.

Referenced by game_state(), mp::level_to_gamestate(), and play_game().

t_string & game_state::get_variable ( const std::string &  varname  ) 

const t_string & game_state::get_variable_const ( const std::string &  varname  )  const [virtual]

config & game_state::get_variable_cfg ( const std::string &  varname  ) 

Definition at line 1100 of file gamestatus.cpp.

References variable_info::TYPE_CONTAINER, and variable_info.

variable_info::array_range game_state::get_variable_cfgs ( const std::string &  varname  ) 

Definition at line 1105 of file gamestatus.cpp.

References variable_info::TYPE_ARRAY, and variable_info.

void game_state::set_variable ( const std::string &  varname,
const t_string value 
)

config & game_state::add_variable_cfg ( const std::string &  varname,
const config value = config() 
)

void game_state::clear_variable ( const std::string &  varname  ) 

void game_state::clear_variable_cfg ( const std::string &  varname  ) 

const simple_rng& game_state::rng (  )  const [inline]

simple_rng& game_state::rng (  )  [inline]

Definition at line 175 of file gamestatus.hpp.

References rng_.

void game_state::load_recall_list ( const config::child_list players  )  [private]

Loads the recall list.

Parameters:
players Reference to the players section to load.

Definition at line 1147 of file gamestatus.cpp.

References read_player().

Referenced by game_state().


Friends And Related Function Documentation

friend struct variable_info [friend]

Definition at line 200 of file gamestatus.hpp.

Referenced by get_variable(), get_variable_cfg(), and get_variable_cfgs().


Member Data Documentation

std::string game_state::label

std::string game_state::version

Version game was created with.

Definition at line 131 of file gamestatus.hpp.

Referenced by extract_summary_data_from_save(), mp::level_to_gamestate(), mp::connect::load_game(), and operator=().

If there is a define the campaign uses to customize data.

Definition at line 134 of file gamestatus.hpp.

Referenced by operator=(), and write_game().

std::vector<std::string> game_state::campaign_xtra_defines

more customization of data

Definition at line 135 of file gamestatus.hpp.

Referenced by operator=(), and write_game().

std::string game_state::campaign

the campaign being played

Definition at line 137 of file gamestatus.hpp.

Referenced by extract_summary_data_from_save(), operator=(), and write_game().

std::string game_state::history

ancestral IDs

Definition at line 138 of file gamestatus.hpp.

Referenced by operator=(), and write_game().

std::string game_state::abbrev

the campaign abbreviation

Definition at line 139 of file gamestatus.hpp.

Referenced by operator=(), play_game(), and write_game().

std::string game_state::scenario

the scenario being played

Definition at line 140 of file gamestatus.hpp.

Referenced by extract_summary_data_from_save(), game_state(), operator=(), play_game(), play_replay(), mp::wait::start_game(), and write_game().

the scenario coming next (for campaigns)

Definition at line 141 of file gamestatus.hpp.

Referenced by game_state(), play_game(), playsingle_controller::play_scenario(), and write_game().

The difficulty level the game is being played on.

Definition at line 177 of file gamestatus.hpp.

Referenced by extract_summary_data_from_save(), game_state(), operator=(), and write_game().

If the game is saved mid-level, we have a series of replay steps to take the game up to the position it was saved at.

Definition at line 181 of file gamestatus.hpp.

Referenced by extract_summary_data_from_save(), game_state(), mp::level_to_gamestate(), mp::connect::load_game(), operator=(), play_game(), play_replay(), replay::save_game(), and write_game().

Saved starting state of the game.

For multiplayer games, the position the game started in may be different to the scenario,

Definition at line 186 of file gamestatus.hpp.

Referenced by playsingle_controller::before_human_turn(), extract_summary_data_from_save(), game_state(), mp::level_to_gamestate(), mp::connect::load_game(), operator=(), play_game(), play_replay(), replay::save_game(), events::menu_handler::save_game(), and write_game().

Snapshot of the game's current contents.

i.e. unless the player selects to view a replay, the game's settings are read in from this object.

Definition at line 191 of file gamestatus.hpp.

Referenced by copy_era(), extract_summary_data_from_save(), extract_summary_from_config(), game_state(), mp::level_to_gamestate(), mp::connect::load_game(), operator=(), play_game(), play_replay(), replay::save_game(), and write_game().

the last location where a select event fired.

Definition at line 194 of file gamestatus.hpp.

Referenced by play_controller::execute_command(), play_controller::expand_wml_commands(), play_controller::init_side(), operator=(), and process_event().

Definition at line 197 of file gamestatus.hpp.

Referenced by game_state(), operator=(), and rng().

Definition at line 198 of file gamestatus.hpp.

Referenced by get_variables(), set_variables(), and variable_info::variable_info().

config game_state::temporaries [mutable, private]

Definition at line 199 of file gamestatus.hpp.

Referenced by get_variable_const(), and variable_info::variable_info().


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