The game event manager loads the scenario configuration object, and ensures that events are handled according to the scenario configuration for its lifetime. More...
#include <manager.hpp>
Classes | |
class | iteration |
This class is similar to an input iterator through event handlers, except each instance knows its own end (determined when constructed). More... | |
Public Member Functions | |
manager () | |
void | read_scenario (const config &scenario_cfg) |
~manager () | |
void | add_event_handler (const config &handler, bool is_menu_item=false) |
Create an event handler. More... | |
void | remove_event_handler (const std::string &id) |
Removes an event handler. More... | |
void | add_events (const config::const_child_itors &cfgs, const std::string &type=std::string()) |
void | write_events (config &cfg) |
game_events::t_pump & | pump () |
Public Attributes | |
boost::scoped_ptr < t_event_handlers > | event_handlers_ |
std::set< std::string > | unit_wml_ids_ |
boost::scoped_ptr < game_events::t_pump > | pump_ |
game_events::wmi_container | wml_menu_items_ |
The game event manager loads the scenario configuration object, and ensures that events are handled according to the scenario configuration for its lifetime.
Thus, a manager object should be created when a scenario is played, and destroyed at the end of the scenario. If a second manager object is created before destroying the previous one, the game will crash with an assertion failure.
Definition at line 47 of file manager.hpp.
|
explicit |
Definition at line 64 of file manager.cpp.
game_events::manager::~manager | ( | ) |
Definition at line 86 of file manager.cpp.
Create an event handler.
Definition at line 50 of file manager.cpp.
References event_handlers_.
Referenced by add_events(), game_events::wml_menu_item::init_handler(), game_lua_kernel::intf_add_event(), read_scenario(), and game_events::wml_menu_item::update_command().
void game_events::manager::add_events | ( | const config::const_child_itors & | cfgs, |
const std::string & | type = std::string() |
||
) |
Definition at line 165 of file manager.cpp.
References add_event_handler(), gui2::event::find(), unit_wml_ids_, and WRN_NG.
Referenced by unit::advance_to(), and unit::unit().
game_events::t_pump & game_events::manager::pump | ( | ) |
Definition at line 194 of file manager.cpp.
References pump_.
Referenced by actions::actor_sighted(), advance_unit(), advance_unit_at(), game_events::wml_menu_item::fire_event(), actions::shroud_clearer::fire_events(), team::get_village(), actions::place_recruit(), ai::manager::play_turn(), unit_creator::post_create(), storyscreen::controller::resolve_wml(), storyscreen::part::resolve_wml(), and SYNCED_COMMAND_HANDLER_FUNCTION().
Definition at line 72 of file manager.cpp.
References add_event_handler(), config::child_range(), game_events::wmi_container::init_handlers(), game_events::wmi_container::set_menu_items(), utils::split(), unit_wml_ids_, and wml_menu_items_.
void game_events::manager::remove_event_handler | ( | const std::string & | id | ) |
Removes an event handler.
Definition at line 56 of file manager.cpp.
References event_handlers_.
Referenced by game_events::wml_menu_item::finish_handler(), and game_events::wml_menu_item::update_command().
Definition at line 181 of file manager.cpp.
References config::add_child(), event_handlers_, utils::join(), game_events::wmi_container::to_config(), unit_wml_ids_, and wml_menu_items_.
Referenced by gui2::event_mode_controller::show_stuff_list().
boost::scoped_ptr<t_event_handlers> game_events::manager::event_handlers_ |
Definition at line 99 of file manager.hpp.
Referenced by add_event_handler(), game_events::event_handler::disable(), remove_event_handler(), and write_events().
boost::scoped_ptr<game_events::t_pump> game_events::manager::pump_ |
Definition at line 102 of file manager.hpp.
Referenced by pump().
std::set<std::string> game_events::manager::unit_wml_ids_ |
Definition at line 100 of file manager.hpp.
Referenced by add_events(), read_scenario(), and write_events().
game_events::wmi_container game_events::manager::wml_menu_items_ |
Definition at line 103 of file manager.hpp.
Referenced by read_scenario(), and write_events().