Domain specific events. More...
Namespaces | |
builtin_conditions | |
context | |
Classes | |
struct | entity_location |
struct | event_filter |
Represents a single filter condition on an event. More... | |
class | event_handler |
class | event_handlers |
struct | filter_attack |
struct | filter_condition |
struct | filter_dynamic |
This is a dynamic wrapper for any filter type, specified via [insert_tag]. More... | |
struct | filter_formula |
struct | filter_side |
struct | filter_unit |
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... | |
struct | pump_impl |
struct | queued_event |
class | wmi_manager |
class | wml_action |
class | wml_event_pump |
class | wml_menu_item |
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... | |
WML_HANDLER_FUNCTION (on_undo, event_info, cfg) | |
bool | conditional_passed (const vconfig &cond) |
bool | matches_special_filter (const config &cfg, const vconfig &filter) |
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 192 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 290 of file handlers.cpp.
Referenced by game_events::filter_dynamic::operator()(), and game_events::event_handler::read_filters().
Definition at line 215 of file conditional_wml.cpp.
References vconfig::get_parsed_config(), and WRN_NG.
Referenced by game_events::filter_attack::operator()().
|
static |
Definition at line 267 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 261 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 275 of file action_wml.cpp.
References events::commands_disabled, resources::controller, ERR_NG, resources::gamedata, ai::manager::get_singleton(), synced_context::get_synced_state(), on_replay_error(), game_data::phase(), game_data::PLAY, ai::manager::raise_gamestate_changed(), synced_context::run_in_synced_context_if_not_already(), game_data::START, synced_context::UNSYNCED, and resources::whiteboard.
game_events::WML_HANDLER_FUNCTION | ( | get_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 351 of file action_wml.cpp.
References verify_and_get_global_variable().
game_events::WML_HANDLER_FUNCTION | ( | modify_turns | , |
cfg | |||
) |
Definition at line 356 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 385 of file action_wml.cpp.
References fake_unit_ptr::get(), fake_unit_ptr::get_unit_ptr(), unit_display::move_unit(), map_location::NDIRECTIONS, game_config::path, and utils::split().
game_events::WML_HANDLER_FUNCTION | ( | move_units_fake | , |
cfg | |||
) |
Definition at line 408 of file action_wml.cpp.
References DBG_NG, resources::fake_units, LOG_NG, unit_display::move_unit(), map_location::NDIRECTIONS, 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 468 of file action_wml.cpp.
References recall_list_manager::begin(), vconfig::child(), DBG_NG, recall_list_manager::end(), recall_list_manager::erase(), filename_, unit_map::find_leaders(), pathfind::find_vacant_tile(), resources::gameboard, utf8::index(), LOG_NG, LOG_WML, game_board::map(), unit_filter::matches(), map_location::null_location(), map_location::parse_direction(), actions::place_recruit(), config::remove_attribute(), utf8::size(), gamemap_base::special_locations(), game_board::teams(), game_board::units(), and pathfind::VACANT_ANY.
game_events::WML_HANDLER_FUNCTION | ( | replace_map | , |
cfg | |||
) |
Experimental map replace.
Definition at line 591 of file action_wml.cpp.
References deprecated_message(), e, ERR_WML, resources::gameboard, game_display::get_singleton(), display::get_singleton(), ai::manager::get_singleton(), mp_sync::get_user_choice(), INDEFINITE, lg::log_to_chat(), game_board::map(), game_display::needs_rebuild(), ai::manager::raise_map_changed(), gamemap::read(), display::reload_map(), game_board::replace_map(), wml_exception::show(), gamemap_base::total_height(), and gamemap_base::total_width().
game_events::WML_HANDLER_FUNCTION | ( | set_global_variable | , |
pcfg | |||
) |
Experimental data persistence.
Definition at line 660 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 666 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(), t_string::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 776 of file action_wml.cpp.
References variable_info< V >::as_scalar(), ERR_NG, resources::gamedata, map_location::get_relative_dir(), game_data::get_variable_access_write(), 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 814 of file action_wml.cpp.
References variable_info< V >::as_container(), ERR_NG, resources::gamedata, game_data::get_variable_access_write(), and WRN_NG.
game_events::WML_HANDLER_FUNCTION | ( | tunnel | , |
cfg | |||
) |
Definition at line 847 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 873 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(), ERR_NG, resources::gameboard, resources::gamedata, config::get(), game_board::get_team(), game_data::get_variable_cfg(), config::remove_attribute(), utf8::size(), and game_board::teams().
game_events::WML_HANDLER_FUNCTION | ( | on_undo | , |
event_info | , | ||
cfg | |||
) |
Definition at line 923 of file action_wml.cpp.
References synced_context::add_undo_commands().