game_events.cpp File Reference

Processing of WML-events. More...

#include "global.hpp"
#include "actions.hpp"
#include "construct_dialog.hpp"
#include "game_display.hpp"
#include "dialogs.hpp"
#include "game_errors.hpp"
#include "game_events.hpp"
#include "image.hpp"
#include "language.hpp"
#include "log.hpp"
#include "map.hpp"
#include "menu_events.hpp"
#include "game_preferences.hpp"
#include "replay.hpp"
#include "SDL_timer.h"
#include "sound.hpp"
#include "team.hpp"
#include "terrain_filter.hpp"
#include "unit_display.hpp"
#include "util.hpp"
#include "gettext.hpp"
#include "serialization/string_utils.hpp"
#include "wml_exception.hpp"
#include "foreach.hpp"
#include <cassert>
#include <cstdlib>
#include <deque>
#include <iostream>
#include <iterator>
#include <set>
#include <string>

Include dependency graph for game_events.cpp:

Go to the source code of this file.

Namespaces

namespace  game_events

Defines

#define DBG_NG   LOG_STREAM(debug, engine)
#define LOG_NG   LOG_STREAM(info, engine)
#define WRN_NG   LOG_STREAM(warn, engine)
#define ERR_NG   LOG_STREAM(err, engine)
#define DBG_DP   LOG_STREAM(debug, display)
#define LOG_DP   LOG_STREAM(info, display)
#define ERR_CF   LOG_STREAM(err, config)
#define LOG_NO   LOG_STREAM(info, notifs)
#define WRN_NO   LOG_STREAM(warn, notifs)
#define ERR_NO   LOG_STREAM(err, notifs)

Typedefs

typedef std::pair< std::string,
config * > 
wmi_command_change

Functions

static void show_wml_errors ()
 Shows a summary of the errors encountered in WML thusfar, to avoid a lot of the same messages to be shown.
static bool game_events::unit_matches_filter (const unit &u, const vconfig filter, const gamemap::location &loc)
static bool game_events::matches_special_filter (const config *cfg, const vconfig filter)
game_stategame_events::get_state_of_game ()
static bool game_events::internal_conditional_passed (const unit_map *units, const vconfig cond, bool &backwards_compat)
bool game_events::conditional_passed (const unit_map *units, const vconfig cond, bool backwards_compat)
static bool events_init ()
static gamemap::location cfg_to_loc (const vconfig &cfg, int defaultx=0, int defaulty=0)
static std::vector
< gamemap::location
multiple_locs (const vconfig cfg)
static void commit_new_handlers ()
static void commit_wmi_commands ()
static bool process_event (event_handler &handler, const queued_event &ev)
bool game_events::unit_matches_filter (unit_map::const_iterator itor, const vconfig filter)
void game_events::write_events (config &cfg)
void game_events::raise (const std::string &event, const entity_location &loc1, const entity_location &loc2, const config &data)
bool game_events::fire (const std::string &event, const entity_location &loc1=gamemap::location::null_location, const entity_location &loc2=gamemap::location::null_location, const config &data=config())
 Function to fire an event.
void game_events::add_events (const config::child_list &cfgs, const std::string &id)
bool game_events::pump ()
Uint32 game_events::mutations ()

Variables

game_displayscreen = NULL
soundsource::managersoundsources = NULL
gamemapgame_map = NULL
unit_mapunits = NULL
std::vector< team > * teams = NULL
game_statestate_of_game = NULL
gamestatusstatus_ptr = NULL
int floating_label = 0
Uint32 unit_mutations = 0
std::vector< event_handler > new_handlers
std::vector< wmi_command_changewmi_command_changes
const gui::msecs prevent_misclick_duration = 10
const gui::msecs average_frame_time = 30
std::set< std::string > used_items
std::deque< queued_event > events_queue
std::multimap< std::string,
event_handler > 
events_map
static config::child_list game_events::unit_wml_configs
static std::set< std::string > game_events::unit_wml_ids


Detailed Description

Processing of WML-events.

Definition in file game_events.cpp.


Define Documentation

#define DBG_DP   LOG_STREAM(debug, display)

Definition at line 55 of file game_events.cpp.

#define DBG_NG   LOG_STREAM(debug, engine)

Definition at line 51 of file game_events.cpp.

#define ERR_CF   LOG_STREAM(err, config)

Definition at line 57 of file game_events.cpp.

#define ERR_NG   LOG_STREAM(err, engine)

Definition at line 54 of file game_events.cpp.

#define ERR_NO   LOG_STREAM(err, notifs)

Definition at line 61 of file game_events.cpp.

#define LOG_DP   LOG_STREAM(info, display)

Definition at line 56 of file game_events.cpp.

#define LOG_NG   LOG_STREAM(info, engine)

Definition at line 52 of file game_events.cpp.

#define LOG_NO   LOG_STREAM(info, notifs)

Definition at line 59 of file game_events.cpp.

#define WRN_NG   LOG_STREAM(warn, engine)

#define WRN_NO   LOG_STREAM(warn, notifs)

Definition at line 60 of file game_events.cpp.


Typedef Documentation

typedef std::pair< std::string, config* > wmi_command_change [static]

Definition at line 77 of file game_events.cpp.


Function Documentation

static gamemap::location cfg_to_loc ( const vconfig cfg,
int  defaultx = 0,
int  defaulty = 0 
) [static]

Definition at line 441 of file game_events.cpp.

References lexical_cast_default().

static void @77::commit_new_handlers (  )  [static]

Definition at line 2838 of file game_events.cpp.

References boost::foreach_detail_::end(), LOG_NG, and new_handlers.

Referenced by game_events::pump().

static void @77::commit_wmi_commands (  )  [static]

static bool events_init (  )  [static]

Definition at line 338 of file game_events.cpp.

References screen.

Referenced by game_events::pump(), and game_events::raise().

static std::vector<gamemap::location> multiple_locs ( const vconfig  cfg  )  [static]

Definition at line 449 of file game_events.cpp.

References parse_location_range().

static bool process_event ( event_handler &  handler,
const queued_event &  ev 
) [static]

static void show_wml_errors (  )  [static]

Shows a summary of the errors encountered in WML thusfar, to avoid a lot of the same messages to be shown.

Identical messages are shown once, with (between braces) the number of times that message was encountered. The order in which the messages are shown does not need to be the order in which these messages are encountered. Messages are always written to std::cerr.

Definition at line 116 of file game_events.cpp.

References game_display::add_chat_message(), game_display::MESSAGE_PUBLIC, screen, and lg::wml_error.

Referenced by game_events::pump().


Variable Documentation

const gui::msecs average_frame_time = 30 [static]

Definition at line 81 of file game_events.cpp.

Definition at line 436 of file game_events.cpp.

bool disabled_

Definition at line 434 of file game_events.cpp.

std::multimap<std::string,event_handler> events_map [static]

Definition at line 456 of file game_events.cpp.

std::deque<queued_event> events_queue [static]

Definition at line 433 of file game_events.cpp.

int floating_label = 0 [static]

Definition at line 72 of file game_events.cpp.

Referenced by font::add_floating_label().

gamemap* game_map = NULL [static]

Definition at line 349 of file game_events.cpp.

Referenced by game_events::raise().

Definition at line 350 of file game_events.cpp.

Referenced by game_events::raise().

std::string name

std::vector< std::string > names_

Definition at line 432 of file game_events.cpp.

std::vector< event_handler > new_handlers [static]

Definition at line 75 of file game_events.cpp.

Referenced by commit_new_handlers().

Definition at line 80 of file game_events.cpp.

Definition at line 435 of file game_events.cpp.

game_display* screen = NULL [static]

Definition at line 66 of file game_events.cpp.

Referenced by game_events::manager::manager().

game_state* state_of_game = NULL [static]

gamestatus* status_ptr = NULL [static]

std::vector<team>* teams = NULL [static]

Uint32 unit_mutations = 0 [static]

Definition at line 73 of file game_events.cpp.

Referenced by game_events::mutations().

unit_map* units = NULL [static]

std::set<std::string> used_items [static]

Definition at line 334 of file game_events.cpp.

Referenced by game_events::manager::manager(), and game_events::write_events().

std::vector< wmi_command_change > wmi_command_changes [static]

Definition at line 78 of file game_events.cpp.

Referenced by commit_wmi_commands().


Generated by doxygen 1.5.5 on 23 May 2008 for The Battle for Wesnoth
Gna! | Forum | Wiki | CIA | devdocs