Domain specific events. More...
Classes | |
| struct | manager |
| struct | entity_location |
| struct | queued_event |
| class | event_handler |
Typedefs | |
| typedef void(* | action_handler )(const game_events::queued_event &, const vconfig &) |
Functions | |
| static bool | matches_special_filter (const config &cfg, const vconfig &filter) |
| static bool | internal_conditional_passed (const vconfig &cond, bool &backwards_compat) |
| bool | conditional_passed (const vconfig &cond, bool backwards_compat) |
| void | handle_wml_log_message (const config &cfg) |
| Used for [wml_message]. | |
| void | handle_deprecated_message (const config &cfg) |
| Used for [deprecated_message]. | |
| std::vector< int > | get_sides_vector (const vconfig &cfg) |
| Gets a vector of sides from side= attribute in a given config node. | |
| void | handle_event_commands (const queued_event &event_info, const vconfig &cfg) |
| Runs the action handler associated to the command sequence cfg. | |
| void | handle_event_command (const std::string &cmd, const queued_event &event_info, const vconfig &cfg) |
| Runs the action handler associated to cmd with parameters cfg. | |
| bool | unit_matches_filter (const unit &u, const vconfig &filter) |
| void | write_events (config &cfg) |
| void | raise (const std::string &event, const entity_location &loc1, const entity_location &loc2, const config &data) |
| bool | fire (const std::string &event, const entity_location &loc1=map_location::null_location, const entity_location &loc2=map_location::null_location, const config &data=config()) |
| Function to fire an event. | |
| void | add_events (const config::const_child_itors &cfgs, const std::string &type) |
| void | commit () |
| Handles newly-created handlers. | |
| bool | pump () |
Variables | |
| static std::set< std::string > | unit_wml_ids |
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
| typedef void(* game_events::action_handler)(const game_events::queued_event &, const vconfig &) |
Definition at line 157 of file game_events.hpp.
| void game_events::add_events | ( | const config::const_child_itors & | cfgs, | |
| const std::string & | type | |||
| ) |
Referenced by unit::advance_to(), play_controller::init(), replay_controller::reset_replay(), and unit::unit().

| void game_events::commit | ( | ) |
Handles newly-created handlers.
Flushes WML messages and errors.
Referenced by events::console_handler::do_lua().

| bool game_events::conditional_passed | ( | const vconfig & | cond, | |
| bool | backwards_compat | |||
| ) |
Referenced by play_controller::expand_wml_commands(), intf_eval_conditional(), process_event(), storyscreen::part::resolve_wml(), storyscreen::controller::resolve_wml(), and WML_HANDLER_FUNCTION().

| bool game_events::fire | ( | const std::string & | event, | |
| const entity_location & | loc1 = map_location::null_location, |
|||
| const entity_location & | loc2 = map_location::null_location, |
|||
| const config & | data = config() | |||
| ) |
Function to fire an event.
Events may have up to two arguments, both of which must be locations.
Referenced by advance_unit(), playsingle_controller::check_time_over(), play_controller::check_victory(), events::console_handler::do_event(), play_controller::do_init_side(), do_replay_handle(), play_controller::execute_command(), play_controller::finish_side_turn(), play_controller::finish_turn(), attack::fire_event(), play_controller::fire_prestart(), play_controller::fire_start(), team::get_village(), intf_fire_event(), attack::perform_hit(), place_recruit(), playsingle_controller::play_scenario(), ai::idle_ai::play_turn(), events::mouse_handler::select_hex(), gui2::trepeating_button::signal_handler_left_button_down(), attack::unit_killed(), and WML_HANDLER_FUNCTION().

| std::vector< int > game_events::get_sides_vector | ( | const vconfig & | cfg | ) |
Gets a vector of sides from side= attribute in a given config node.
Promotes consistent behaviour.
Referenced by toggle_shroud(), and WML_HANDLER_FUNCTION().

| void game_events::handle_deprecated_message | ( | const config & | cfg | ) |
Used for [deprecated_message].
Referenced by storyscreen::part::resolve_wml(), storyscreen::controller::resolve_wml(), and WML_HANDLER_FUNCTION().

| void game_events::handle_event_command | ( | const std::string & | cmd, | |
| const game_events::queued_event & | event_info, | |||
| const vconfig & | cfg | |||
| ) |
Runs the action handler associated to cmd with parameters cfg.
Referenced by events::menu_handler::objectives().

| void game_events::handle_event_commands | ( | const game_events::queued_event & | event_info, | |
| const vconfig & | cfg | |||
| ) |
Runs the action handler associated to the command sequence cfg.
Referenced by game_events::event_handler::handle_event(), and WML_HANDLER_FUNCTION().

| void game_events::handle_wml_log_message | ( | const config & | cfg | ) |
Used for [wml_message].
Referenced by storyscreen::part::resolve_wml(), storyscreen::controller::resolve_wml(), and WML_HANDLER_FUNCTION().

| static bool game_events::internal_conditional_passed | ( | const vconfig & | cond, | |
| bool & | backwards_compat | |||
| ) | [static] |
Definition at line 330 of file game_events.cpp.
References vconfig::get_children(), game_state::get_variable_const(), unit::hitpoints(), in_ranges(), utils::parse_ranges(), resources::state_of_game, config::attribute_value::str(), resources::teams, TEST_ATTR, TEST_NUM_ATTR, TEST_STR_ATTR, config::attribute_value::to_bool(), config::attribute_value::to_double(), unit_matches_filter(), and resources::units.

Definition at line 3374 of file game_events.cpp.
References vconfig::all_children_iterator::get_child(), vconfig::all_children_iterator::get_key(), vconfig::get_parsed_config(), attack_type::matches_filter(), vconfig::ordered_begin(), vconfig::ordered_end(), and WRN_NG.
Referenced by process_event().


| bool game_events::pump | ( | ) |
Referenced by apply_shroud_changes(), clear_shroud(), and recalculate_fog().

| void game_events::raise | ( | const std::string & | event, | |
| const entity_location & | loc1, | |||
| const entity_location & | loc2, | |||
| const config & | data | |||
| ) |
Referenced by internal_conditional_passed(), process_event(), unit_display::wml_animation_internal(), and WML_HANDLER_FUNCTION().

| void game_events::write_events | ( | config & | cfg | ) |
std::set<std::string> game_events::unit_wml_ids [static] |
Definition at line 3417 of file game_events.cpp.
Referenced by game_events::manager::manager(), and game_events::manager::~manager().
| Generated by doxygen 1.7.1 on Fri May 25 2012 01:19:50 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |