29 #define ERR_NG LOG_STREAM(err, log_engine)
30 #define WRN_NG LOG_STREAM(warn, log_engine)
31 #define LOG_NG LOG_STREAM(info, log_engine)
32 #define DBG_NG LOG_STREAM(debug, log_engine)
39 , variables_(
level.child_or_empty(
"variables"))
41 , can_end_turn_(
level[
"can_end_turn"].to_bool(true))
42 , end_turn_forced_(
level[
"end_turn"].to_bool())
43 , cannot_end_turn_reason_(
level[
"cannot_end_turn_reason"].t_str())
44 , next_scenario_(
level[
"next_scenario"])
46 , theme_(
level[
"theme"])
54 , scoped_variables(
data.scoped_variables)
55 , last_selected(
data.last_selected)
57 , variables_(
data.variables_)
59 , can_end_turn_(
data.can_end_turn_)
60 , end_turn_forced_(
data.end_turn_forced_)
61 , next_scenario_(
data.next_scenario_)
96 ERR_NG <<
"variable " << key <<
"cannot be set to " << value;
102 std::vector<config> temp {value};
150 bool recursive_activation =
false;
156 if (recursive_activation) {
161 if(itor != var_name.end()) {
162 var_name.erase(itor, var_name.end());
166 if (v->name() == var_name) {
167 recursive_activation =
true;
168 if (!v->activated()) {
171 recursive_activation =
false;
179 if(cfg[
"playing_team"].empty()) {
182 if(!cfg[
"init_side_done"].to_bool()) {
Variant for storing WML attributes.
A config object defines a single node in a WML file, with access to child nodes.
config_attribute_value attribute_value
Variant for storing WML attributes.
bool has_child(config_key_type key) const
Determine whether a config has a child or not.
config & add_child(config_key_type key)
void clear_variable(const std::string &varname)
Clears attributes config children does nothing if varname is no valid variable name.
std::vector< scoped_wml_variable * > scoped_variables
t_string cannot_end_turn_reason_
virtual config::attribute_value get_variable_const(const std::string &varname) const
returns a blank attribute value if varname is no valid variable name.
bool is_before_screen() const
void clear_variable_cfg(const std::string &varname)
Clears only the config children does nothing if varname is no valid variable name.
@ PRELOAD
the preload [event] is fired next phase: PRESTART (normal game), TURN_STARTING_WAITING (reloaded game...
@ INITIAL
creating intitial [unit]s, executing toplevel [lua] etc.
@ GAME_ENDED
The game has ended and the user is observing the final state "lingering" The game can be saved here.
@ PRESTART
the prestart [event] is fired next phase: START (default), GAME_ENDING
@ TURN_PLAYING
The User is controlling the game and invoking actions The game can be saved here.
@ TURN_ENDED
The turn_end, side_turn_end etc [events] are fired next phase: TURN_STARTING_WAITING (default),...
@ TURN_STARTING_WAITING
we are waiting for the turn to start.
@ START
the start [event] is fired next phase: TURN_STARTING_WAITING (default), GAME_ENDING
@ TURN_STARTING
the turn, side turn etc.
static PHASE read_phase(const config &cfg)
variable_access_throw get_variable_access_throw(const std::string &varname)
Used to delete variables.
void activate_scope_variable(std::string var_name) const
bool has_current_player() const
returns where there is currently a well defiend "current player", that is for example not the case du...
variable_access_create get_variable_access_write(const std::string &varname)
returns a variable_access that can be used to change the game variables
config & get_variable_cfg(const std::string &varname)
throws invalid_variablename_exception if varname is no valid variable name.
void write_snapshot(config &cfg) const
variable_access_const get_variable_access_read(const std::string &varname) const
returns a variable_access that cannot be used to change the game variables
static void write_phase(config &cfg, game_data::PHASE phase)
config::attribute_value & get_variable(const std::string &varname)
throws invalid_variablename_exception if varname is no valid variable name.
config & add_variable_cfg(const std::string &varname, const config &value=config())
throws invalid_variablename_exception if varname is no valid variable name.
std::vector< std::string > victory_music_
game_data(const config &level)
std::string next_scenario_
the scenario coming next (for campaigns)
std::vector< std::string > defeat_music_
bool is_after_start() const
void set_variable(const std::string &varname, const t_string &value)
does nothing if varname is no valid variable name.
std::string get_random_seed_str() const
unsigned int get_random_calls() const
void clear(bool only_tables=false) const
Clears the value this object points to.
config::child_itors append_array(std::vector< config > children) const
maybe_const_t< config::attribute_value, V > & as_scalar() const
If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference mi...
maybe_const_t< config, V > & as_container() const
If instantiated with vi_policy_const, the lifetime of the returned const attribute_value reference mi...
static lg::log_domain log_engine("engine")
Standard logging facilities (interface).
auto reversed_view(T &container)
std::string join(const T &v, const std::string &s=",")
Generates a new string joining container items in a list.
std::vector< std::string > split(const config_attribute_value &val)
auto * find(Container &container, const Value &value)
Convenience wrapper for using find on a container without needing to comare to end()
std::string::const_iterator iterator
Encapsulates the map of the game.