#include <gamestatus.hpp>
Public Member Functions | |
game_state () | |
game_state (const game_state &state) | |
game_state (const config &cfg, bool show_replay=false) | |
~game_state () | |
game_state & | operator= (const game_state &state) |
player_info * | get_player (const std::string &id) |
Return the Nth player, or NULL if no such player exists. | |
const config & | get_variables () const |
void | set_variables (const config &vars) |
void | set_menu_items (const config::child_list &menu_items) |
t_string & | get_variable (const std::string &varname) |
virtual const t_string & | get_variable_const (const std::string &varname) const |
config & | get_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) |
config & | add_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_rng & | rng () const |
simple_rng & | rng () |
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 |
Definition at line 97 of file gamestatus.hpp.
game_state::game_state | ( | ) | [inline] |
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 | |||
) |
Definition at line 444 of file gamestatus.cpp.
References campaign_type, config::child(), difficulty, config::empty(), statistics::fresh_stats(), config::get_children(), load_recall_list(), log_scope, next_scenario, statistics::read_stats(), replay_data, rng_, scenario, simple_rng::seed_random(), set_menu_items(), set_variables(), snapshot, and starting_pos.
game_state::~game_state | ( | ) |
game_state & game_state::operator= | ( | const game_state & | state | ) |
Definition at line 1176 of file gamestatus.cpp.
References abbrev, campaign, campaign_define, campaign_type, campaign_xtra_defines, clear_wmi(), completion, difficulty, get_variables(), history, label, last_selected, players, replay_data, rng_, scenario, scoped_variables, set_variables(), snapshot, starting_pos, version, and wml_menu_items.
player_info * game_state::get_player | ( | const std::string & | id | ) |
Return the Nth player, or NULL if no such player exists.
Definition at line 123 of file gamestatus.cpp.
References lg::engine, LOG_STREAM, players, and lg::warn.
Referenced by scoped_recall_unit::activate(), do_replay_handle(), get_player_info(), play_game(), playsingle_controller::play_scenario(), events::menu_handler::recall(), events::menu_handler::redo(), and events::menu_handler::undo().
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 | ) |
Definition at line 1088 of file gamestatus.cpp.
References variable_info::TYPE_SCALAR, and variable_info.
Referenced by events::console_handler::do_show_var(), playsingle_controller::play_scenario(), and set_variable().
const t_string & game_state::get_variable_const | ( | const std::string & | varname | ) | const [virtual] |
Implements variable_set.
Definition at line 1093 of file gamestatus.cpp.
References variable_info::as_scalar(), variable_info::is_valid, temporaries, and variable_info::TYPE_SCALAR.
Referenced by game_events::internal_conditional_passed().
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 | |||
) |
Definition at line 1110 of file gamestatus.cpp.
References get_variable().
Referenced by do_replay_handle(), events::console_handler::do_set_var(), play_controller::expand_wml_commands(), play_controller::finish_turn(), play_controller::fire_start(), play_controller::init_side(), and game_events::pump().
config & game_state::add_variable_cfg | ( | const std::string & | varname, | |
const config & | value = config() | |||
) |
Definition at line 1115 of file gamestatus.cpp.
References config::add_child(), variable_info::key, variable_info::TYPE_ARRAY, and variable_info::vars.
Referenced by scoped_wml_variable::store(), and scoped_wml_variable::~scoped_wml_variable().
void game_state::clear_variable | ( | const std::string & | varname | ) |
Definition at line 1132 of file gamestatus.cpp.
References config::clear_children(), variable_info::explicit_index, variable_info::index, variable_info::is_valid, variable_info::key, config::remove_child(), to_clear, config::values, and variable_info::vars.
void game_state::clear_variable_cfg | ( | const std::string & | varname | ) |
Definition at line 1121 of file gamestatus.cpp.
References config::clear_children(), variable_info::explicit_index, variable_info::index, variable_info::is_valid, variable_info::key, config::remove_child(), to_clear, variable_info::TYPE_CONTAINER, and variable_info::vars.
Referenced by scoped_wml_variable::store(), and scoped_wml_variable::~scoped_wml_variable().
const simple_rng& game_state::rng | ( | ) | const [inline] |
Definition at line 174 of file gamestatus.hpp.
References rng_.
Referenced by unit::generate_gender(), unit::generate_traits(), mp::level_to_gamestate(), mp::connect::load_game(), play_game(), unit::read(), and write_game().
simple_rng& game_state::rng | ( | ) | [inline] |
void game_state::load_recall_list | ( | const config::child_list & | players | ) | [private] |
Loads the recall list.
players | Reference to the players section to load. |
Definition at line 1147 of file gamestatus.cpp.
References read_player().
Referenced by game_state().
friend struct variable_info [friend] |
Definition at line 200 of file gamestatus.hpp.
Referenced by get_variable(), get_variable_cfg(), and get_variable_cfgs().
std::string game_state::label |
Name of the game (e.g. name of save file).
Definition at line 130 of file gamestatus.hpp.
Referenced by playsingle_controller::before_human_turn(), play_controller::expand_autosaves(), extract_summary_data_from_save(), operator=(), play_game(), play_replay(), replay::save_game(), events::menu_handler::save_game(), save_game(), and write_game().
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=().
std::string game_state::campaign_type |
Type of the game - campaign, multiplayer etc.
Definition at line 132 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(), playsingle_controller::play_scenario(), and write_game().
std::string game_state::campaign_define |
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().
std::string game_state::next_scenario |
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().
std::string game_state::completion |
running. victory, or defeat
Definition at line 142 of file gamestatus.hpp.
Referenced by playsingle_controller::linger(), playmp_controller::linger(), operator=(), play_game(), playsingle_controller::play_scenario(), playsingle_controller::playsingle_controller(), replay::set_save_info_completion(), and write_game().
std::map<std::string, player_info> game_state::players |
Information about campaign players who carry resources from previous levels, indexed by a string identifier.
Definition at line 148 of file gamestatus.hpp.
Referenced by preferences::encounter_recallable_units(), extract_summary_data_from_save(), extract_summary_from_config(), get_player(), get_player_info(), operator=(), playsingle_controller::play_scenario(), write_game(), and events::menu_handler::write_game_snapshot().
std::vector<scoped_wml_variable*> game_state::scoped_variables |
Definition at line 153 of file gamestatus.hpp.
Referenced by activate_scope_variable(), operator=(), scoped_wml_variable::scoped_wml_variable(), and scoped_wml_variable::~scoped_wml_variable().
std::map<std::string, wml_menu_item*> game_state::wml_menu_items |
Definition at line 154 of file gamestatus.hpp.
Referenced by commit_wmi_commands(), play_controller::expand_wml_commands(), game_events::manager::manager(), operator=(), set_menu_items(), write_game(), and ~game_state().
std::string game_state::difficulty |
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().
simple_rng game_state::rng_ [private] |
config game_state::variables [private] |
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().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |