#include <pump.hpp>
Public Member Functions | |
wml_event_pump (manager &) | |
~wml_event_pump () | |
bool | undo_disabled () |
Context: The general environment within which events are processed. More... | |
void | set_undo_disabled (bool mutated) |
[allow_undo] implementation More... | |
bool | action_canceled () |
Returns whether or not wml wants to abort the currently executed user action. More... | |
void | set_action_canceled () |
Sets whether or not wml wants to abort the currently executed user action. More... | |
bool | context_skip_messages () |
Returns whether or not we are skipping messages. More... | |
void | context_skip_messages (bool skip) |
Sets whether or not we are skipping messages. More... | |
void | put_wml_message (const std::string &logger, const std::string &message, bool in_chat) |
Helper function which determines whether a wml_message text can really be pushed into the wml_messages_stream, and does it. More... | |
pump_result_t | fire (const std::string &event, const entity_location &loc1=entity_location::null_entity, const entity_location &loc2=entity_location::null_entity, const config &data=config()) |
Function to fire an event. More... | |
pump_result_t | fire (const std::string &event, const std::string &id, const entity_location &loc1=entity_location::null_entity, const entity_location &loc2=entity_location::null_entity, const config &data=config()) |
void | raise (const std::string &event, const std::string &id, const entity_location &loc1=entity_location::null_entity, const entity_location &loc2=entity_location::null_entity, const config &data=config()) |
void | raise (const std::string &event, const entity_location &loc1=entity_location::null_entity, const entity_location &loc2=entity_location::null_entity, const config &data=config()) |
pump_result_t | operator() () |
void | flush_messages () |
Flushes WML messages and errors. More... | |
Private Member Functions | |
void | process_event (handler_ptr &handler_p, const queued_event &ev) |
Processes an event through a single event handler. More... | |
void | fill_wml_messages_map (std::map< std::string, int > &msg_map, std::stringstream &source) |
Helper function for show_wml_messages(), which gathers the messages from a stringstream. More... | |
void | show_wml_messages (std::stringstream &source, const std::string &caption) |
Shows a summary of messages/errors generated so far by WML. More... | |
void | show_wml_errors () |
Shows a summary of the errors encountered in WML so far, to avoid a lot of the same messages to be shown. More... | |
void | show_wml_messages () |
Shows a summary of the messages generated so far by WML. More... | |
void | put_wml_message (lg::logger &logger, const std::string &prefix, const std::string &message, bool in_chat) |
Private Attributes | |
const std::unique_ptr< pump_impl > | impl_ |
game_events::wml_event_pump::wml_event_pump | ( | manager & | man | ) |
bool game_events::wml_event_pump::action_canceled | ( | ) |
bool game_events::wml_event_pump::context_skip_messages | ( | ) |
void game_events::wml_event_pump::context_skip_messages | ( | bool | skip | ) |
|
private |
Helper function for show_wml_messages(), which gathers the messages from a stringstream.
Definition at line 234 of file pump.cpp.
References wfl::msg().
Referenced by show_wml_messages().
pump_result_t game_events::wml_event_pump::fire | ( | const std::string & | event, |
const entity_location & | loc1 = entity_location::null_entity , |
||
const entity_location & | loc2 = entity_location::null_entity , |
||
const config & | data = config() |
||
) |
Function to fire an event.
Events may have up to two arguments, both of which must be locations.
Definition at line 399 of file pump.cpp.
References data.
Referenced by advance_unit(), play_controller::check_time_over(), play_controller::check_victory(), playsingle_controller::do_end_level(), play_controller::do_init_side(), play_controller::finish_side_turn_events(), play_controller::finish_turn(), game_events::wml_menu_item::fire_event(), play_controller::fire_preload(), play_controller::fire_prestart(), play_controller::fire_start(), team::get_village(), game_lua_kernel::intf_fire_event(), game_lua_kernel::intf_put_unit(), ai::manager::play_turn(), unit_creator::post_create(), events::mouse_handler::select_hex(), and SYNCED_COMMAND_HANDLER_FUNCTION().
pump_result_t game_events::wml_event_pump::fire | ( | const std::string & | event, |
const std::string & | id, | ||
const entity_location & | loc1 = entity_location::null_entity , |
||
const entity_location & | loc2 = entity_location::null_entity , |
||
const config & | data = config() |
||
) |
void game_events::wml_event_pump::flush_messages | ( | ) |
Flushes WML messages and errors.
Definition at line 521 of file pump.cpp.
References game_display::get_singleton(), and video::headless().
Referenced by SYNCED_COMMAND_HANDLER_FUNCTION().
pump_result_t game_events::wml_event_pump::operator() | ( | ) |
Definition at line 430 of file pump.cpp.
References unit::clear_status_caches(), DBG_EH, lg::debug(), ERR_NG, game_events::entity_location::filter_loc(), resources::gamedata, game_display::get_singleton(), game_data::get_variable(), game_events::queued_event::id, impl_, game_events::queued_event::loc1, game_events::queued_event::loc2, log_event_handler, resources::lua_kernel, game_config::max_loop, game_events::queued_event::name, game_lua_kernel::run_event(), resources::whiteboard, map_location::wml_x(), and map_location::wml_y().
|
private |
Processes an event through a single event handler.
This includes checking event filters, but not checking that the event name matches.
[in,out] | handler_p | The handler to offer the event to. This may be reset during processing. |
[in] | ev | The event information. |
Definition at line 195 of file pump.cpp.
References game_events::queued_event::data, DBG_EH, resources::gameboard, resources::gamedata, game_display::get_singleton(), game_events::queued_event::id, impl_, game_data::last_selected, game_events::queued_event::loc1, game_events::queued_event::loc2, resources::lua_kernel, game_display::maybe_rebuild(), game_events::queued_event::name, config::optional_child(), and game_board::units().
void game_events::wml_event_pump::put_wml_message | ( | const std::string & | logger, |
const std::string & | message, | ||
bool | in_chat | ||
) |
Helper function which determines whether a wml_message text can really be pushed into the wml_messages_stream, and does it.
Definition at line 386 of file pump.cpp.
References _(), lg::debug(), lg::err(), lg::info(), log_wml, and lg::warn().
Referenced by storyscreen::story_parser::resolve_wml().
|
private |
Definition at line 315 of file pump.cpp.
References FORCE_LOG_TO, impl_, and log_wml.
|
inline |
void game_events::wml_event_pump::raise | ( | const std::string & | event, |
const std::string & | id, | ||
const entity_location & | loc1 = entity_location::null_entity , |
||
const entity_location & | loc2 = entity_location::null_entity , |
||
const config & | data = config() |
||
) |
Definition at line 416 of file pump.cpp.
References data, DBG_EH, game_display::get_singleton(), id, and impl_.
Referenced by actions::actor_sighted(), and actions::shroud_clearer::fire_events().
void game_events::wml_event_pump::set_action_canceled | ( | ) |
Sets whether or not wml wants to abort the currently executed user action.
Definition at line 363 of file pump.cpp.
References impl_.
Referenced by game_lua_kernel::intf_cancel_action().
void game_events::wml_event_pump::set_undo_disabled | ( | bool | mutated | ) |
[allow_undo] implementation
Definition at line 351 of file pump.cpp.
Referenced by game_lua_kernel::intf_allow_undo().
|
private |
Shows a summary of the errors encountered in WML so far, to avoid a lot of the same messages to be shown.
Identical messages are shown once, with (between parentheses) 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 298 of file pump.cpp.
References lg::log_to_chat(), and show_wml_messages().
|
private |
Shows a summary of the messages generated so far by WML.
Identical messages are shown once, with (between parentheses) 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.
Definition at line 310 of file pump.cpp.
References impl_.
Referenced by show_wml_errors().
|
private |
Shows a summary of messages/errors generated so far by WML.
Identical messages are shown once, with (between parentheses) 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.
source | The source to be parsed before being displayed. |
caption | The text to display before each message parsed from source. |
Definition at line 269 of file pump.cpp.
References display_chat_manager::add_chat_message(), fill_wml_messages_map(), game_display::get_chat_manager(), game_display::get_singleton(), events::chat_handler::MESSAGE_PUBLIC, and wfl::msg().
bool game_events::wml_event_pump::undo_disabled | ( | ) |
|
private |
Definition at line 75 of file pump.hpp.
Referenced by process_event(), put_wml_message(), and show_wml_messages().