The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Member Functions | Public Attributes | List of all members
game_events::manager Class Reference

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>

Inheritance diagram for game_events::manager:
Inheritance graph

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_pumppump ()
 

Public Attributes

boost::scoped_ptr
< t_event_handlers
event_handlers_
 
std::set< std::stringunit_wml_ids_
 
boost::scoped_ptr
< game_events::t_pump
pump_
 
game_events::wmi_container wml_menu_items_
 

Detailed Description

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.

Constructor & Destructor Documentation

game_events::manager::manager ( )
explicit

Definition at line 64 of file manager.cpp.

game_events::manager::~manager ( )

Definition at line 86 of file manager.cpp.

Member Function Documentation

void game_events::manager::add_event_handler ( const config handler,
bool  is_menu_item = false 
)
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 ( )
void game_events::manager::read_scenario ( const config scenario_cfg)
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().

void game_events::manager::write_events ( config cfg)

Member Data Documentation

boost::scoped_ptr<t_event_handlers> game_events::manager::event_handlers_
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().


The documentation for this class was generated from the following files: