The Battle for Wesnoth  1.13.10+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Namespaces | Classes | Typedefs | Functions
game_events Namespace Reference

Domain specific events. More...

Namespaces

 builtin_conditions
 
 context
 

Classes

struct  entity_location
 
class  event_handler
 
class  event_handlers
 
class  manager
 The game event manager loads the scenario configuration object, and ensures that events are handled according to the scenario configuration for its lifetime. More...
 
struct  pump_impl
 
struct  queued_event
 
class  wmi_manager
 
class  wml_action
 
class  wml_event_pump
 
class  wml_menu_item
 

Typedefs

using handler_ptr = std::shared_ptr< event_handler >
 
using weak_handler_ptr = std::weak_ptr< event_handler >
 
using handler_list = std::list< weak_handler_ptr >
 
using pump_result_t = std::tuple< bool, bool >
 

Functions

 WML_HANDLER_FUNCTION (clear_global_variable,, pcfg)
 Experimental data persistence. More...
 
static void on_replay_error (const std::string &message, bool)
 
 WML_HANDLER_FUNCTION (do_command,, cfg)
 
 WML_HANDLER_FUNCTION (get_global_variable,, pcfg)
 Experimental data persistence. More...
 
 WML_HANDLER_FUNCTION (modify_turns,, cfg)
 
 WML_HANDLER_FUNCTION (move_unit_fake,, cfg)
 Moving a 'unit' - i.e. More...
 
 WML_HANDLER_FUNCTION (move_units_fake,, cfg)
 
 WML_HANDLER_FUNCTION (recall,, cfg)
 If we should recall units that match a certain description. More...
 
 WML_HANDLER_FUNCTION (replace_map,, cfg)
 Experimental map replace. More...
 
 WML_HANDLER_FUNCTION (set_global_variable,, pcfg)
 Experimental data persistence. More...
 
 WML_HANDLER_FUNCTION (set_variables,, cfg)
 
 WML_HANDLER_FUNCTION (store_relative_direction,, cfg)
 Store the relative direction from one hex to another in a WML variable. More...
 
 WML_HANDLER_FUNCTION (store_rotate_map_location,, cfg)
 Store the rotation of one hex around another in a WML variable. More...
 
 WML_HANDLER_FUNCTION (store_time_of_day,, cfg)
 Store time of day config in a WML variable. More...
 
 WML_HANDLER_FUNCTION (terrain_mask,, cfg)
 Creating a mask of the terrain. More...
 
 WML_HANDLER_FUNCTION (tunnel,, cfg)
 
 WML_HANDLER_FUNCTION (unit,, cfg)
 If we should spawn a new unit on the map somewhere. More...
 
 WML_HANDLER_FUNCTION (on_undo, event_info, cfg)
 
 WML_HANDLER_FUNCTION (on_redo,,)
 
bool conditional_passed (const vconfig &cond)
 
bool matches_special_filter (const config &cfg, const vconfig &filter)
 
static handler_ptr lock_ptr (const handler_list &list, handler_list::iterator iter)
 

Detailed Description

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 Documentation

using game_events::handler_list = typedef std::list<weak_handler_ptr>

Definition at line 26 of file fwd.hpp.

using game_events::handler_ptr = typedef std::shared_ptr<event_handler>

Definition at line 24 of file fwd.hpp.

using game_events::pump_result_t = typedef std::tuple<bool , bool >

Definition at line 28 of file fwd.hpp.

using game_events::weak_handler_ptr = typedef std::weak_ptr<event_handler>

Definition at line 25 of file fwd.hpp.

Function Documentation

bool game_events::conditional_passed ( const vconfig cond)
static handler_ptr game_events::lock_ptr ( const handler_list &  list,
handler_list::iterator  iter 
)
static

Definition at line 136 of file manager.cpp.

Referenced by game_events::manager::iteration::operator*().

bool game_events::matches_special_filter ( const config cfg,
const vconfig filter 
)

Definition at line 209 of file conditional_wml.cpp.

References vconfig::get_parsed_config(), and WRN_NG.

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

static void game_events::on_replay_error ( const std::string &  message,
bool   
)
static

Definition at line 265 of file action_wml.cpp.

References ERR_NG.

Referenced by WML_HANDLER_FUNCTION().

game_events::WML_HANDLER_FUNCTION ( clear_global_variable  ,
pcfg   
)

Experimental data persistence.

Todo:
Finish experimenting.

Definition at line 259 of file action_wml.cpp.

References resources::controller, and verify_and_clear_global_variable().

game_events::WML_HANDLER_FUNCTION ( do_command  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( get_global_variable  ,
pcfg   
)

Experimental data persistence.

Todo:
Finish experimenting.

Definition at line 346 of file action_wml.cpp.

References verify_and_get_global_variable().

game_events::WML_HANDLER_FUNCTION ( modify_turns  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( move_unit_fake  ,
cfg   
)

Moving a 'unit' - i.e.

a dummy unit that is just moving for the visual effect

Definition at line 378 of file action_wml.cpp.

References fake_unit_ptr::get(), fake_unit_ptr::get_unit_ptr(), unit_display::move_unit(), map_location::NDIRECTIONS, game_config::path, and utils::split().

game_events::WML_HANDLER_FUNCTION ( move_units_fake  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( recall  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( replace_map  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( set_global_variable  ,
pcfg   
)

Experimental data persistence.

Todo:
Finish experimenting.

Definition at line 644 of file action_wml.cpp.

References resources::controller, and verify_and_set_global_variable().

game_events::WML_HANDLER_FUNCTION ( set_variables  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( store_relative_direction  ,
cfg   
)

Store the relative direction from one hex to another in a WML variable.

This is mainly useful as a diagnostic tool, but could be useful for some kind of scenario.

Definition at line 758 of file action_wml.cpp.

References variable_info< V >::as_scalar(), ERR_NG, resources::gamedata, map_location::get_relative_dir(), game_data::get_variable_access_write(), map_location::write_direction(), and WRN_NG.

game_events::WML_HANDLER_FUNCTION ( store_rotate_map_location  ,
cfg   
)

Store the rotation of one hex around another in a WML variable.

In increments of 60 degrees, clockwise. This is mainly useful as a diagnostic tool, but could be useful for some kind of scenario.

Definition at line 794 of file action_wml.cpp.

References variable_info< V >::as_container(), ERR_NG, resources::gamedata, game_data::get_variable_access_write(), and WRN_NG.

game_events::WML_HANDLER_FUNCTION ( store_time_of_day  ,
cfg   
)

Store time of day config in a WML variable.

This is useful for those who are too lazy to calculate the corresponding time of day for a given turn, or if the turn / time-of-day sequence mutates in a scenario.

Definition at line 831 of file action_wml.cpp.

References variable_info< V >::as_container(), ERR_NG, resources::gamedata, tod_manager::get_time_of_day(), game_data::get_variable_access_write(), resources::tod_manager, and time_of_day::write().

game_events::WML_HANDLER_FUNCTION ( terrain_mask  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( tunnel  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( unit  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( on_undo  ,
event_info  ,
cfg   
)

Definition at line 964 of file action_wml.cpp.

References synced_context::add_undo_commands().

game_events::WML_HANDLER_FUNCTION ( on_redo  )

Definition at line 973 of file action_wml.cpp.