Domain specific events. More...
Namespaces | |
builtin_conditions | |
context | |
Classes | |
class | wml_action |
struct | entity_location |
struct | filter_condition |
struct | filter_side |
struct | filter_unit |
struct | filter_attack |
struct | filter_formula |
struct | filter_dynamic |
This is a dynamic wrapper for any filter type, specified via [insert_tag]. More... | |
struct | event_filter |
Represents a single filter condition on an event. More... | |
class | event_handler |
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... | |
class | pending_event_handler |
Represents a handler that is about to be added to the events manager but is still waiting for some data. More... | |
class | event_handlers |
class | wml_menu_item |
struct | pump_impl |
struct | queued_event |
class | wml_event_pump |
class | wmi_manager |
Typedefs | |
using | handler_ptr = std::shared_ptr< event_handler > |
using | weak_handler_ptr = std::weak_ptr< event_handler > |
using | handler_list = std::list< weak_handler_ptr > |
using | pump_result_t = std::tuple< bool, bool > |
Functions | |
WML_HANDLER_FUNCTION (clear_global_variable,, pcfg) | |
Experimental data persistence. More... | |
static void | on_replay_error (const std::string &message) |
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 (tunnel,, cfg) | |
WML_HANDLER_FUNCTION (unit,, cfg) | |
If we should spawn a new unit on the map somewhere. More... | |
bool | conditional_passed (const vconfig &cond) |
static std::unique_ptr< event_filter > | make_filter (const std::string &key, const vconfig &contents) |
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
using game_events::handler_list = typedef std::list<weak_handler_ptr> |
using game_events::handler_ptr = typedef std::shared_ptr<event_handler> |
using game_events::pump_result_t = typedef std::tuple<bool , bool > |
using game_events::weak_handler_ptr = typedef std::weak_ptr<event_handler> |
bool game_events::conditional_passed | ( | const vconfig & | cond | ) |
Definition at line 191 of file conditional_wml.cpp.
References vconfig::all_ordered().
Referenced by game_events::wml_menu_item::can_show(), intf_eval_conditional(), game_events::filter_condition::operator()(), and storyscreen::story_parser::resolve_wml().
|
static |
Definition at line 316 of file handlers.cpp.
Referenced by game_events::filter_dynamic::operator()(), and game_events::event_handler::read_filters().
|
static |
Definition at line 250 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 244 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 258 of file action_wml.cpp.
References events::commands_disabled, resources::controller, ERR_NG, resources::gamedata, ai::manager::get_singleton(), synced_context::get_synced_state(), game_data::INITIAL, on_replay_error(), game_data::phase(), game_data::PRELOAD, synced_context::run_in_synced_context_if_not_already(), game_data::TURN_PLAYING, synced_context::UNSYNCED, and resources::whiteboard.
game_events::WML_HANDLER_FUNCTION | ( | get_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 324 of file action_wml.cpp.
References verify_and_get_global_variable().
game_events::WML_HANDLER_FUNCTION | ( | modify_turns | , |
cfg | |||
) |
Definition at line 329 of file action_wml.cpp.
References config_attribute_value::empty(), ERR_NG, resources::gamedata, game_display::get_singleton(), tod_manager::modify_turns_by_wml(), game_display::new_turn(), tod_manager::number_of_turns(), 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 358 of file action_wml.cpp.
References fake_unit_ptr::get(), fake_unit_ptr::get_unit_ptr(), map_location::indeterminate, unit_display::move_unit(), game_config::path, and utils::split().
game_events::WML_HANDLER_FUNCTION | ( | move_units_fake | , |
cfg | |||
) |
Definition at line 381 of file action_wml.cpp.
References DBG_NG, resources::fake_units, map_location::indeterminate, LOG_NG, unit_display::move_unit(), fake_unit_ptr::place_on_fake_unit_manager(), utf8::size(), and utils::split().
game_events::WML_HANDLER_FUNCTION | ( | recall | , |
cfg | |||
) |
If we should recall units that match a certain description.
If you change attributes specific to [recall] (that is, not a Standard Unit Filter) be sure to update data/lua/wml_tag, auto_recall feature for [role] to reflect your changes.
FIXME: we should design the WML to avoid these types of collisions; filters should be named consistently and always have a distinct scope.
Definition at line 441 of file action_wml.cpp.
References recall_list_manager::begin(), vconfig::child(), DBG_NG, recall_list_manager::end(), recall_list_manager::erase(), unit_map::find_leaders(), pathfind::find_vacant_tile(), resources::gameboard, LOG_NG, LOG_WML, game_board::map(), unit_filter::matches(), map_location::null_location(), map_location::parse_direction(), actions::place_recruit(), config::remove_attribute(), gamemap_base::special_locations(), t, game_board::units(), and pathfind::VACANT_ANY.
game_events::WML_HANDLER_FUNCTION | ( | replace_map | , |
cfg | |||
) |
Experimental map replace.
Definition at line 564 of file action_wml.cpp.
References deprecated_message(), e, ERR_WML, resources::gameboard, ai::manager::get_singleton(), display::get_singleton(), game_display::get_singleton(), mp_sync::get_user_choice(), INDEFINITE, lg::log_to_chat(), game_board::map(), game_display::needs_rebuild(), gamemap::read(), display::reload_map(), game_board::replace_map(), gamemap_base::total_height(), and gamemap_base::total_width().
game_events::WML_HANDLER_FUNCTION | ( | set_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 633 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 639 of file action_wml.cpp.
References config::append(), variable_info_mutable< V >::append_array(), variable_info< V >::as_array(), c, data, config::debug(), vconfig::empty(), ERR_NG, variable_info< V >::explicit_index(), resources::gamedata, vconfig::get_config(), game_data::get_variable_access_read(), game_data::get_variable_access_write(), i, variable_info_mutable< V >::insert_array(), variable_info_mutable< V >::merge_array(), p, utils::REMOVE_EMPTY, variable_info_mutable< V >::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 749 of file action_wml.cpp.
References variable_info< V >::as_scalar(), dst, ERR_NG, resources::gamedata, game_data::get_variable_access_write(), src, 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 787 of file action_wml.cpp.
References variable_info< V >::as_container(), dst, ERR_NG, resources::gamedata, game_data::get_variable_access_write(), src, and WRN_NG.
game_events::WML_HANDLER_FUNCTION | ( | tunnel | , |
cfg | |||
) |
Definition at line 820 of file action_wml.cpp.
References pathfind::manager::add(), ERR_WML, gui2::dialogs::tip::remove(), 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 851 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(), unit::create(), DBG_NG, config::debug(), e, ERR_NG, ERR_WML, resources::gameboard, resources::gamedata, config::get(), game_board::get_team(), game_data::get_variable_cfg(), config::remove_attribute(), utf8::size(), and game_board::teams().