Domain specific events. More...
Namespaces | |
context | |
Classes | |
struct | entity_location |
class | event_handler |
class | handler_list |
This is a wrapper for a list of weak pointers to handlers. More... | |
class | manager |
The game event manager loads the scenario configuration object, and ensures that events are handled according to the scenario configuration for its lifetime. More... | |
struct | pump_impl |
struct | queued_event |
class | t_event_handlers |
class | t_pump |
class | wmi_container |
A container of wml_menu_item. More... | |
class | wml_action |
class | wml_menu_item |
Typedefs | |
typedef boost::shared_ptr < event_handler > | handler_ptr |
Shared pointer to handler objects. More... | |
typedef std::vector< handler_ptr > | handler_vec |
Storage of event handlers. More... | |
Functions | |
WML_HANDLER_FUNCTION (clear_global_variable,, pcfg) | |
Experimental data persistence. More... | |
static void | on_replay_error (const std::string &message, bool) |
WML_HANDLER_FUNCTION (do_command,, cfg) | |
WML_HANDLER_FUNCTION (get_global_variable,, pcfg) | |
Experimental data persistence. More... | |
WML_HANDLER_FUNCTION (modify_turns,, cfg) | |
WML_HANDLER_FUNCTION (move_unit_fake,, cfg) | |
Moving a 'unit' - i.e. More... | |
WML_HANDLER_FUNCTION (move_units_fake,, cfg) | |
WML_HANDLER_FUNCTION (recall,, cfg) | |
If we should recall units that match a certain description. More... | |
WML_HANDLER_FUNCTION (replace_map,, cfg) | |
Experimental map replace. More... | |
WML_HANDLER_FUNCTION (set_global_variable,, pcfg) | |
Experimental data persistence. More... | |
WML_HANDLER_FUNCTION (set_variables,, cfg) | |
WML_HANDLER_FUNCTION (store_relative_direction,, cfg) | |
Store the relative direction from one hex to another in a WML variable. More... | |
WML_HANDLER_FUNCTION (store_rotate_map_location,, cfg) | |
Store the rotation of one hex around another in a WML variable. More... | |
WML_HANDLER_FUNCTION (store_time_of_day,, cfg) | |
Store time of day config in a WML variable. More... | |
WML_HANDLER_FUNCTION (terrain_mask,, cfg) | |
Creating a mask of the terrain. More... | |
WML_HANDLER_FUNCTION (tunnel,, cfg) | |
WML_HANDLER_FUNCTION (unit,, cfg) | |
If we should spawn a new unit on the map somewhere. More... | |
WML_HANDLER_FUNCTION (volume,, cfg) | |
WML_HANDLER_FUNCTION (on_undo, event_info, cfg) | |
WML_HANDLER_FUNCTION (on_redo, event_info, cfg) | |
void | change_terrain (const map_location &loc, const t_translation::t_terrain &t, terrain_type_data::tmerge_mode mode, bool replace_if_failed) |
Changes a terrain location. More... | |
bool | conditional_passed (const vconfig &cond) |
bool | matches_special_filter (const config &cfg, const vconfig &filter) |
Domain specific events.
This module defines the game's event mechanism. Events might be units moving or fighting, or when victory or defeat occurs. A scenario's configuration file will define actions to take when certain events occur. This module is responsible for making sure that when the events occur, the actions take place.
Game events have nothing to do with mouse movement, keyboard events, etc. These kinds of system events can be handled using namespace events
Shared pointer to handler objects.
Definition at line 44 of file handlers.hpp.
typedef std::vector<handler_ptr> game_events::handler_vec |
Storage of event handlers.
Definition at line 49 of file handlers.hpp.
void game_events::change_terrain | ( | const map_location & | loc, |
const t_translation::t_terrain & | t, | ||
terrain_type_data::tmerge_mode | mode, | ||
bool | replace_if_failed | ||
) |
Changes a terrain location.
Ensures that villages are properly lost and that new terrains are discovered.
bool game_events::conditional_passed | ( | const vconfig & | cond | ) |
Definition at line 195 of file conditional_wml.cpp.
References vconfig::all_children_iterator::get_child(), vconfig::all_children_iterator::get_key(), vconfig::ordered_begin(), and vconfig::ordered_end().
Referenced by game_events::wml_menu_item::can_show(), game_events::t_pump::filter_event(), intf_eval_conditional(), storyscreen::controller::resolve_wml(), and storyscreen::part::resolve_wml().
Definition at line 227 of file conditional_wml.cpp.
References vconfig::get_parsed_config(), attack_type::matches_filter(), and WRN_NG.
Referenced by game_events::t_pump::filter_event().
|
static |
Definition at line 263 of file action_wml.cpp.
References ERR_NG.
Referenced by WML_HANDLER_FUNCTION().
game_events::WML_HANDLER_FUNCTION | ( | clear_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 257 of file action_wml.cpp.
References resources::controller, and verify_and_clear_global_variable().
game_events::WML_HANDLER_FUNCTION | ( | do_command | , |
cfg | |||
) |
Definition at line 271 of file action_wml.cpp.
References ERR_NG, resources::gamedata, i, on_replay_error(), game_data::phase(), game_data::PLAY, synced_context::run_in_synced_context_if_not_already(), game_data::START, and resources::whiteboard.
game_events::WML_HANDLER_FUNCTION | ( | get_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 314 of file action_wml.cpp.
References verify_and_get_global_variable().
game_events::WML_HANDLER_FUNCTION | ( | modify_turns | , |
cfg | |||
) |
Definition at line 319 of file action_wml.cpp.
References config::attribute_value::empty(), ERR_NG, resources::gamedata, tod_manager::modify_turns_by_wml(), game_display::new_turn(), tod_manager::number_of_turns(), resources::screen, tod_manager::set_number_of_turns_by_wml(), tod_manager::set_turn_by_wml(), config::attribute_value::to_int(), resources::tod_manager, and tod_manager::turn().
game_events::WML_HANDLER_FUNCTION | ( | move_unit_fake | , |
cfg | |||
) |
Moving a 'unit' - i.e.
a dummy unit that is just moving for the visual effect
Definition at line 346 of file action_wml.cpp.
References fake_unit_ptr::get(), fake_unit_ptr::get_unit_ptr(), unit_display::move_unit(), map_location::NDIRECTIONS, and utils::split().
game_events::WML_HANDLER_FUNCTION | ( | move_units_fake | , |
cfg | |||
) |
Definition at line 367 of file action_wml.cpp.
References DBG_NG, resources::fake_units, LOG_NG, unit_display::move_unit(), fake_unit_ptr::place_on_fake_unit_manager(), utils::split(), and resources::units.
game_events::WML_HANDLER_FUNCTION | ( | recall | , |
cfg | |||
) |
If we should recall units that match a certain description.
Definition at line 420 of file action_wml.cpp.
References recall_list_manager::begin(), vconfig::child(), DBG_NG, recall_list_manager::end(), recall_list_manager::erase(), resources::filter_con, unit_map::find_leaders(), pathfind::find_vacant_tile(), resources::gameboard, int(), LOG_NG, LOG_WML, unit_filter::matches(), map_location::null_location(), actions::place_recruit(), resources::teams, resources::units, and pathfind::VACANT_ANY.
game_events::WML_HANDLER_FUNCTION | ( | replace_map | , |
cfg | |||
) |
Experimental map replace.
Definition at line 544 of file action_wml.cpp.
References e, resources::gameboard, mp_sync::get_user_choice(), game_board::map(), game_display::needs_rebuild(), ai::manager::raise_map_changed(), gamemap::read(), display::reload_map(), game_board::replace_map(), resources::screen, twml_exception::show(), gamemap::total_height(), gamemap::total_width(), and lg::wml_error().
game_events::WML_HANDLER_FUNCTION | ( | set_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 604 of file action_wml.cpp.
References resources::controller, and verify_and_set_global_variable().
game_events::WML_HANDLER_FUNCTION | ( | set_variables | , |
cfg | |||
) |
Definition at line 610 of file action_wml.cpp.
References config::append(), non_const_variable_info< vit >::append_array(), variable_info< vit >::as_array(), vconfig::empty(), t_string::empty(), ERR_NG, variable_info< vit >::explicit_index(), resources::gamedata, game_data::get_variable_access_read(), game_data::get_variable_access_write(), i, non_const_variable_info< vit >::insert_array(), non_const_variable_info< vit >::merge_array(), utils::REMOVE_EMPTY, non_const_variable_info< vit >::replace_array(), utils::split(), and utils::STRIP_SPACES.
game_events::WML_HANDLER_FUNCTION | ( | store_relative_direction | , |
cfg | |||
) |
Store the relative direction from one hex to another in a WML variable.
This is mainly useful as a diagnostic tool, but could be useful for some kind of scenario.
Definition at line 715 of file action_wml.cpp.
References variable_info< vit >::as_scalar(), ERR_NG, resources::gamedata, map_location::get_relative_dir(), game_data::get_variable_access_write(), floating_point_emulation::detail::store(), map_location::write_direction(), and WRN_NG.
game_events::WML_HANDLER_FUNCTION | ( | store_rotate_map_location | , |
cfg | |||
) |
Store the rotation of one hex around another in a WML variable.
In increments of 60 degrees, clockwise. This is mainly useful as a diagnostic tool, but could be useful for some kind of scenario.
Definition at line 751 of file action_wml.cpp.
References variable_info< vit >::as_container(), ERR_NG, resources::gamedata, game_data::get_variable_access_write(), floating_point_emulation::detail::store(), and WRN_NG.
game_events::WML_HANDLER_FUNCTION | ( | store_time_of_day | , |
cfg | |||
) |
Store time of day config in a WML variable.
This is useful for those who are too lazy to calculate the corresponding time of day for a given turn, or if the turn / time-of-day sequence mutates in a scenario.
Definition at line 788 of file action_wml.cpp.
References variable_info< vit >::as_container(), ERR_NG, resources::gamedata, tod_manager::get_time_of_day(), game_data::get_variable_access_write(), floating_point_emulation::detail::store(), resources::tod_manager, and time_of_day::write().
game_events::WML_HANDLER_FUNCTION | ( | terrain_mask | , |
cfg | |||
) |
Creating a mask of the terrain.
Definition at line 811 of file action_wml.cpp.
References e, ERR_NG, filesystem::file_exists(), resources::gameboard, filesystem::get_wml_location(), game_display::needs_rebuild(), game_board::overlay_map(), gamemap::read(), filesystem::read_file(), resources::screen, and twml_exception::show().
game_events::WML_HANDLER_FUNCTION | ( | tunnel | , |
cfg | |||
) |
Definition at line 842 of file action_wml.cpp.
References pathfind::manager::add(), ERR_WML, pathfind::manager::remove(), utils::split(), and resources::tunnels.
game_events::WML_HANDLER_FUNCTION | ( | unit | , |
cfg | |||
) |
If we should spawn a new unit on the map somewhere.
Definition at line 867 of file action_wml.cpp.
References unit_creator::add_unit(), unit_creator::allow_add_to_recall(), unit_creator::allow_discover(), unit_creator::allow_get_village(), unit_creator::allow_invalidate(), unit_creator::allow_rename_side(), unit_creator::allow_show(), config::attribute_value::blank(), config::clear(), DBG_NG, config::debug(), ERR_NG, resources::gameboard, resources::gamedata, config::get(), game_data::get_variable_cfg(), config::remove_attribute(), resources::teams, and unit::write().
game_events::WML_HANDLER_FUNCTION | ( | volume | , |
cfg | |||
) |
Definition at line 916 of file action_wml.cpp.
References preferences::music_volume(), sound::set_music_volume(), sound::set_sound_volume(), and preferences::sound_volume().
game_events::WML_HANDLER_FUNCTION | ( | on_undo | , |
event_info | , | ||
cfg | |||
) |
Definition at line 944 of file action_wml.cpp.
References synced_context::add_undo_commands().
game_events::WML_HANDLER_FUNCTION | ( | on_redo | , |
event_info | , | ||
cfg | |||
) |
Definition at line 953 of file action_wml.cpp.
References synced_context::add_redo_commands().