The Battle for Wesnoth  1.19.4+dev
Namespaces | Classes | Typedefs | Functions
game_events Namespace Reference

Domain specific events. More...

Namespaces

 builtin_conditions
 
 context
 

Classes

class  wml_action
 
struct  entity_location
 
struct  filter_condition
 
struct  filter_side
 
struct  filter_unit
 
struct  filter_attack
 
struct  filter_formula
 
struct  filter_dynamic
 This is a dynamic wrapper for any filter type, specified via [insert_tag]. More...
 
struct  event_filter
 Represents a single filter condition on an event. More...
 
class  event_handler
 
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...
 
class  pending_event_handler
 Represents a handler that is about to be added to the events manager but is still waiting for some data. More...
 
class  event_handlers
 
class  wml_menu_item
 
struct  pump_impl
 
struct  queued_event
 
class  wml_event_pump
 
class  wmi_manager
 

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)
 
 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 (tunnel,, cfg)
 
 WML_HANDLER_FUNCTION (unit,, cfg)
 If we should spawn a new unit on the map somewhere. More...
 
bool conditional_passed (const vconfig &cond)
 
static std::unique_ptr< event_filtermake_filter (const std::string &key, const vconfig &contents)
 

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

◆ handler_list

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

Definition at line 27 of file fwd.hpp.

◆ handler_ptr

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

Definition at line 25 of file fwd.hpp.

◆ pump_result_t

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

Definition at line 29 of file fwd.hpp.

◆ weak_handler_ptr

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

Definition at line 26 of file fwd.hpp.

Function Documentation

◆ conditional_passed()

bool game_events::conditional_passed ( const vconfig cond)

◆ make_filter()

static std::unique_ptr<event_filter> game_events::make_filter ( const std::string &  key,
const vconfig contents 
)
static

◆ on_replay_error()

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

Definition at line 250 of file action_wml.cpp.

References ERR_NG.

Referenced by WML_HANDLER_FUNCTION().

◆ WML_HANDLER_FUNCTION() [1/14]

game_events::WML_HANDLER_FUNCTION ( clear_global_variable  ,
pcfg   
)

Experimental data persistence.

Todo:
Finish experimenting.

Definition at line 244 of file action_wml.cpp.

References resources::controller, and verify_and_clear_global_variable().

◆ WML_HANDLER_FUNCTION() [2/14]

game_events::WML_HANDLER_FUNCTION ( do_command  ,
cfg   
)

◆ WML_HANDLER_FUNCTION() [3/14]

game_events::WML_HANDLER_FUNCTION ( get_global_variable  ,
pcfg   
)

Experimental data persistence.

Todo:
Finish experimenting.

Definition at line 324 of file action_wml.cpp.

References verify_and_get_global_variable().

◆ WML_HANDLER_FUNCTION() [4/14]

game_events::WML_HANDLER_FUNCTION ( modify_turns  ,
cfg   
)

◆ WML_HANDLER_FUNCTION() [5/14]

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 358 of file action_wml.cpp.

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

◆ WML_HANDLER_FUNCTION() [6/14]

game_events::WML_HANDLER_FUNCTION ( move_units_fake  ,
cfg   
)

◆ WML_HANDLER_FUNCTION() [7/14]

game_events::WML_HANDLER_FUNCTION ( recall  ,
cfg   
)

If we should recall units that match a certain description.

If you change attributes specific to [recall] (that is, not a Standard Unit Filter) be sure to update data/lua/wml_tag, auto_recall feature for [role] to reflect your changes.

FIXME: we should design the WML to avoid these types of collisions; filters should be named consistently and always have a distinct scope.

Definition at line 441 of file action_wml.cpp.

References recall_list_manager::begin(), vconfig::child(), DBG_NG, recall_list_manager::end(), recall_list_manager::erase(), unit_map::find_leaders(), pathfind::find_vacant_tile(), resources::gameboard, LOG_NG, LOG_WML, game_board::map(), unit_filter::matches(), map_location::null_location(), map_location::parse_direction(), actions::place_recruit(), config::remove_attribute(), gamemap_base::special_locations(), t, game_board::units(), and pathfind::VACANT_ANY.

◆ WML_HANDLER_FUNCTION() [8/14]

game_events::WML_HANDLER_FUNCTION ( replace_map  ,
cfg   
)

◆ WML_HANDLER_FUNCTION() [9/14]

game_events::WML_HANDLER_FUNCTION ( set_global_variable  ,
pcfg   
)

Experimental data persistence.

Todo:
Finish experimenting.

Definition at line 633 of file action_wml.cpp.

References resources::controller, and verify_and_set_global_variable().

◆ WML_HANDLER_FUNCTION() [10/14]

game_events::WML_HANDLER_FUNCTION ( set_variables  ,
cfg   
)

◆ WML_HANDLER_FUNCTION() [11/14]

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 749 of file action_wml.cpp.

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

◆ WML_HANDLER_FUNCTION() [12/14]

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 787 of file action_wml.cpp.

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

◆ WML_HANDLER_FUNCTION() [13/14]

game_events::WML_HANDLER_FUNCTION ( tunnel  ,
cfg   
)

◆ WML_HANDLER_FUNCTION() [14/14]

game_events::WML_HANDLER_FUNCTION ( unit  ,
cfg   
)