The Battle for Wesnoth  1.13.4+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

 context
 

Classes

struct  entity_location
 
class  event_handler
 
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  t_event_handlers
 
class  t_pump
 
class  wmi_container
 A container of wml_menu_item. More...
 
class  wml_action
 
class  wml_menu_item
 

Typedefs

typedef boost::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 (volume,, cfg)
 
 WML_HANDLER_FUNCTION (on_undo, event_info, cfg)
 
 WML_HANDLER_FUNCTION (on_redo, event_info, cfg)
 
void change_terrain (const map_location &loc, const t_translation::t_terrain &t, terrain_type_data::tmerge_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

Shared pointer to handler objects.

Definition at line 44 of file handlers.hpp.

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

Storage of event handlers.

Definition at line 49 of file handlers.hpp.

Function Documentation

void game_events::change_terrain ( const map_location loc,
const t_translation::t_terrain t,
terrain_type_data::tmerge_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 
)
static void game_events::on_replay_error ( const std::string message,
bool   
)
static

Definition at line 263 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 257 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 314 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 346 of file action_wml.cpp.

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

game_events::WML_HANDLER_FUNCTION ( move_units_fake  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( recall  ,
cfg   
)

If we should recall units that match a certain description.

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

Definition at line 420 of file action_wml.cpp.

References recall_list_manager::begin(), vconfig::child(), DBG_NG, recall_list_manager::end(), recall_list_manager::erase(), resources::filter_con, unit_map::find_leaders(), pathfind::find_vacant_tile(), resources::gameboard, int(), LOG_NG, LOG_WML, unit_filter::matches(), map_location::null_location(), actions::place_recruit(), resources::teams, resources::units, and pathfind::VACANT_ANY.

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

References variable_info< vit >::as_scalar(), ERR_NG, resources::gamedata, map_location::get_relative_dir(), game_data::get_variable_access_write(), floating_point_emulation::detail::store(), 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 751 of file action_wml.cpp.

References variable_info< vit >::as_container(), ERR_NG, resources::gamedata, game_data::get_variable_access_write(), floating_point_emulation::detail::store(), 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 788 of file action_wml.cpp.

References variable_info< vit >::as_container(), ERR_NG, resources::gamedata, tod_manager::get_time_of_day(), game_data::get_variable_access_write(), floating_point_emulation::detail::store(), 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 ( volume  ,
cfg   
)
game_events::WML_HANDLER_FUNCTION ( on_undo  ,
event_info  ,
cfg   
)

Definition at line 944 of file action_wml.cpp.

References synced_context::add_undo_commands().

game_events::WML_HANDLER_FUNCTION ( on_redo  ,
event_info  ,
cfg   
)

Definition at line 953 of file action_wml.cpp.

References synced_context::add_redo_commands().