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

#include <handlers.hpp>

Public Member Functions

 event_handler (const config &cfg, bool is_menu_item, handler_vec::size_type index, manager &)
 
handler_vec::size_type index () const
 The index of *this should only be of interest when controlling iterations. More...
 
bool matches_name (const std::string &name, const game_data *data) const
 
bool is_menu_item () const
 
void disable ()
 Disables *this, removing it from the game. More...
 
void handle_event (const queued_event &event_info, handler_ptr &handler_p, game_lua_kernel &)
 Handles the queued event, according to our WML instructions. More...
 
const configget_config () const
 

Private Attributes

bool first_time_only_
 
bool is_menu_item_
 
handler_vec::size_type index_
 
managerman_
 
config cfg_
 

Detailed Description

Definition at line 52 of file handlers.hpp.

Constructor & Destructor Documentation

game_events::event_handler::event_handler ( const config cfg,
bool  is_menu_item,
handler_vec::size_type  index,
manager man 
)

Definition at line 78 of file handlers.cpp.

Member Function Documentation

void game_events::event_handler::disable ( )

Disables *this, removing it from the game.

(Technically, the handler is only removed once no one is hanging on to a handler_ptr to *this. So be careful how long they persist.)

WARNING: *this may be destroyed at the end of this call, unless the caller maintains a handler_ptr to this.

Definition at line 94 of file handlers.cpp.

References game_events::manager::event_handlers_, index_, and man_.

Referenced by handle_event().

const config& game_events::event_handler::get_config ( ) const
inline

Definition at line 69 of file handlers.hpp.

References cfg_.

Referenced by game_events::t_pump::filter_event().

void game_events::event_handler::handle_event ( const queued_event event_info,
handler_ptr handler_p,
game_lua_kernel lk 
)

Handles the queued event, according to our WML instructions.

WARNING: *this may be destroyed at the end of this call, unless the caller maintains a handler_ptr to this.

Parameters
[in]event_infoInformation about the event that needs handling.
[in,out]handler_pThe caller's smart pointer to *this. It may be reset() during processing.

Definition at line 113 of file handlers.cpp.

References cfg_, DBG_NG, disable(), first_time_only_, is_menu_item_, and game_lua_kernel::run_wml_action().

handler_vec::size_type game_events::event_handler::index ( ) const
inline

The index of *this should only be of interest when controlling iterations.

Definition at line 59 of file handlers.hpp.

References index_.

bool game_events::event_handler::is_menu_item ( ) const
inline

Definition at line 63 of file handlers.hpp.

References is_menu_item_.

bool game_events::event_handler::matches_name ( const std::string name,
const game_data data 
) const

Member Data Documentation

config game_events::event_handler::cfg_
private

Definition at line 76 of file handlers.hpp.

Referenced by get_config(), handle_event(), and matches_name().

bool game_events::event_handler::first_time_only_
private

Definition at line 72 of file handlers.hpp.

Referenced by handle_event().

handler_vec::size_type game_events::event_handler::index_
private

Definition at line 74 of file handlers.hpp.

Referenced by disable(), and index().

bool game_events::event_handler::is_menu_item_
private

Definition at line 73 of file handlers.hpp.

Referenced by handle_event(), and is_menu_item().

manager* game_events::event_handler::man_
private

Definition at line 75 of file handlers.hpp.

Referenced by disable().


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