37 #include <boost/unordered_map.hpp>
42 #define DBG_NG LOG_STREAM(debug, log_engine)
43 #define LOG_NG LOG_STREAM(info, log_engine)
44 #define WRN_NG LOG_STREAM(warn, log_engine)
47 #define DBG_EH LOG_STREAM(debug, log_event_handler)
62 while (
iter_.derefable() ) {
79 : first_time_only_(cfg[
"first_time_only"].to_bool(true))
99 assert ( index_ < man_->event_handlers_->size() );
120 DBG_NG <<
cfg_[
"name"] <<
" will now invoke the following command(s):\n" <<
cfg_;
139 std::string::const_iterator
itor,
140 it_begin = my_names.begin(),
141 it_end = my_names.end(),
142 match_it = name.begin(),
143 match_begin = name.begin(),
144 match_end = name.end();
146 for(itor = it_begin; itor != it_end; ++
itor) {
151 if(itor - it_begin - skip_count == match_it - match_begin && match_it == match_end) {
155 match_it = match_begin;
163 do_skip = (match_it == match_begin || match_it == match_end);
166 do_skip = (match_it == match_begin || match_it == match_end);
169 do_eat = (match_it != match_end && (*match_it ==
' ' || *match_it ==
'_'));
172 do_eat = (match_it != match_end && *match_it == *
itor);
185 match_it = match_begin;
189 if(itor - it_begin - skip_count == match_it - match_begin && match_it == match_end) {
handler_ptr operator*()
Dereference.
std::string interpolate_variables_into_string(const std::string &str, const string_map *const symbols)
Function which will interpolate variables, starting with '$' in the string 'str' with the equivalent ...
bool run_wml_action(std::string const &, vconfig const &, game_events::queued_event const &)
Runs a command from an event handler.
boost::shared_ptr< event_handler > handler_ptr
Shared pointer to handler objects.
bool matches_name(const std::string &name, const game_data *data) const
void handle_event(const queued_event &event_info, handler_ptr &handler_p, game_lua_kernel &)
Handles the queued event, according to our WML instructions.
static lg::log_domain log_engine("engine")
Templates and utility-routines for strings and numbers.
handler_vec::size_type index_
void disable()
Disables *this, removing it from the game.
list_t::iterator iter_
The current element.
std::map< std::string, tfilter >::iterator itor
static iterator erase(const iterator &pos)
static lg::log_domain log_event_handler("event_handler")
Define the game's event mechanism.
The game event manager loads the scenario configuration object, and ensures that events are handled a...
GLuint const GLchar * name
Define the handlers for the game's events mechanism.
bool find(E event, F functor)
Tests whether an event handler is available.
A variable-expanding proxy for the config class.
Standard logging facilities (interface).
boost::scoped_ptr< t_event_handlers > event_handlers_
A config object defines a single node in a WML file, with access to child nodes.
GLsizei const GLcharARB ** string
event_handler(const config &cfg, bool is_menu_item, handler_vec::size_type index, manager &)