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  handler_list
 This is a wrapper for a list of weak pointers to handlers. More...
 
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 pump_result_t = std::tuple< bool, bool >
 
typedef std::shared_ptr
< event_handler
handler_ptr
 Shared pointer to handler objects. More...
 
typedef std::vector< handler_ptrhandler_vec
 Storage of event handlers. More...
 

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,,)
 
void change_terrain (const map_location &loc, const t_translation::terrain_code &t, terrain_type_data::merge_mode mode, bool replace_if_failed)
 Changes a terrain location. More...
 
bool conditional_passed (const vconfig &cond)
 
bool matches_special_filter (const config &cfg, const vconfig &filter)
 

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

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

Shared pointer to handler objects.

Definition at line 40 of file handlers.hpp.

typedef std::vector<handler_ptr> game_events::handler_vec

Storage of event handlers.

Definition at line 46 of file handlers.hpp.

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

Definition at line 7 of file fwd.hpp.

Function Documentation

void game_events::change_terrain ( const map_location loc,
const t_translation::terrain_code t,
terrain_type_data::merge_mode  mode,
bool  replace_if_failed 
)

Changes a terrain location.

Ensures that villages are properly lost and that new terrains are discovered.

bool game_events::conditional_passed ( const vconfig cond)
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 755 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 791 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 828 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 961 of file action_wml.cpp.

References synced_context::add_undo_commands().

game_events::WML_HANDLER_FUNCTION ( on_redo  )

Definition at line 970 of file action_wml.cpp.