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
void game_events::add_events | ( | const config::child_list & | cfgs, | |
const std::string & | id | |||
) |
Definition at line 3191 of file game_events.cpp.
References lg::config, boost::foreach_detail_::end(), unit_wml_configs, and unit_wml_ids.
Referenced by unit::advance_to(), unit::read(), unit::set_game_context(), mp::wait::start_game(), and mp::connect::start_game().
bool game_events::conditional_passed | ( | const unit_map * | units, | |
const vconfig | cond, | |||
bool | backwards_compat | |||
) |
Definition at line 277 of file game_events.cpp.
References vconfig::all_children_iterator::get_child(), vconfig::get_children(), vconfig::all_children_iterator::get_key(), internal_conditional_passed(), vconfig::ordered_begin(), vconfig::ordered_end(), utils::string_bool(), and lg::wml_error.
Referenced by play_controller::expand_wml_commands(), and show_intro().
bool game_events::fire | ( | const std::string & | event, | |
const entity_location & | loc1, | |||
const entity_location & | loc2, | |||
const config & | data | |||
) |
Function to fire an event.
Definition at line 3182 of file game_events.cpp.
References pump().
Referenced by advance_unit(), dialogs::animate_unit_advancement(), attack::attack(), playsingle_controller::check_time_over(), check_victory(), events::console_handler::do_event(), do_replay_handle(), play_controller::execute_command(), play_controller::finish_turn(), attack::fire_event(), play_controller::fire_prestart(), play_controller::fire_start(), team::get_village(), play_controller::init_side(), ai_interface::move_unit_partial(), playsingle_controller::play_scenario(), ai::play_turn(), sample_ai::play_turn(), idle_ai::play_turn(), recruit_unit(), and events::mouse_handler::select_hex().
game_state * game_events::get_state_of_game | ( | ) |
Definition at line 164 of file game_events.cpp.
References state_of_game.
Referenced by check_checksums(), do_replay_handle(), playsingle_controller::play_scenario(), team::team(), replay::undo(), and verify().
static bool game_events::internal_conditional_passed | ( | const unit_map * | units, | |
const vconfig | cond, | |||
bool & | backwards_compat | |||
) | [static] |
Definition at line 169 of file game_events.cpp.
References unit_map::begin(), unit_map::end(), game_map, vconfig::get_attribute(), vconfig::get_children(), game_state::get_variable_const(), name, state_of_game, status_ptr, utils::string_bool(), unit_matches_filter(), and value.
Referenced by conditional_passed().
Definition at line 3008 of file game_events.cpp.
References vconfig::all_children_iterator::get_child(), vconfig::all_children_iterator::get_key(), vconfig::ordered_begin(), and vconfig::ordered_end().
Referenced by process_event().
Uint32 game_events::mutations | ( | ) |
bool game_events::pump | ( | ) |
Definition at line 3208 of file game_events.cpp.
References buf, unit::clear_status_caches(), commit_new_handlers(), commit_wmi_commands(), events_init(), events_queue, LOG_NG, process_event(), screen, game_state::set_variable(), show_wml_errors(), state_of_game, CVideo::update_locked(), and display::video().
Referenced by apply_shroud_changes(), clear_shroud(), play_controller::finish_side_turn(), fire(), events::mouse_handler::left_click(), move_unit(), and recalculate_fog().
void game_events::raise | ( | const std::string & | event, | |
const entity_location & | loc1, | |||
const entity_location & | loc2, | |||
const config & | data | |||
) |
Definition at line 3171 of file game_events.cpp.
References data, events_init(), events_queue, loc1, and loc2.
Referenced by apply_shroud_changes(), events::mouse_handler::left_click(), and move_unit().
bool game_events::unit_matches_filter | ( | unit_map::const_iterator | itor, | |
const vconfig | filter | |||
) |
Definition at line 3056 of file game_events.cpp.
bool game_events::unit_matches_filter | ( | const unit & | u, | |
const vconfig | filter, | |||
const gamemap::location & | loc | |||
) | [static] |
Definition at line 3051 of file game_events.cpp.
References unit::matches_filter().
Referenced by ai::find_threats(), internal_conditional_passed(), and process_event().
void game_events::write_events | ( | config & | cfg | ) |
Definition at line 3124 of file game_events.cpp.
References config::add_child(), screen, unit_wml_ids, used_items, and game_display::write_overlays().
Referenced by events::menu_handler::write_game_snapshot().
Definition at line 3061 of file game_events.cpp.
Referenced by add_events(), and game_events::manager::~manager().
std::set<std::string> game_events::unit_wml_ids [static] |
Definition at line 3062 of file game_events.cpp.
Referenced by add_events(), game_events::manager::manager(), write_events(), and game_events::manager::~manager().
Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth | Gna! | Forum | Wiki | CIA | devdocs |