Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- src/game_events/handlers.hpp | 1 +
- 1 file changed, 1 insertion(+)
- diff --git a/src/game_events/handlers.hpp b/src/game_events/handlers.hpp
- index db0986a..8592559 100644
- --- a/src/game_events/handlers.hpp
- +++ b/src/game_events/handlers.hpp
- @@ -70,6 +70,7 @@ namespace game_events
- private:
- bool first_time_only_;
- + bool remove_on_fire_;
- bool is_menu_item_;
- handler_vec::size_type index_;
- manager * man_;
- src/game_events/handlers.cpp | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
- diff --git a/src/game_events/handlers.cpp b/src/game_events/handlers.cpp
- index 960828a..83b6416 100644
- --- a/src/game_events/handlers.cpp
- +++ b/src/game_events/handlers.cpp
- @@ -78,6 +78,7 @@ handler_ptr handler_list::iterator::operator*()
- event_handler::event_handler(const config &cfg, bool imi, handler_vec::size_type index, manager & man)
- : first_time_only_(cfg["first_time_only"].to_bool(true))
- + , remove_on_fire_(cfg["remove_on_fire"].to_bool(false))
- , is_menu_item_(imi)
- , index_(index)
- , man_(&man)
- @@ -120,8 +121,7 @@ void event_handler::handle_event(const queued_event& event_info, handler_ptr& ha
- DBG_NG << cfg_["name"] << " will now invoke the following command(s):\n" << cfg_;
- }
- - if (first_time_only_)
- - {
- + if (first_time_only_) {
- // Disable this handler.
- disable();
- // Also remove our caller's hold on us.
- @@ -130,6 +130,10 @@ void event_handler::handle_event(const queued_event& event_info, handler_ptr& ha
- // *WARNING*: At this point, dereferencing this could be a memory violation!
- lk.run_wml_action("command", vcfg, event_info);
- +
- + if (remove_on_fire_) {
- + (*man_->event_handlers_).remove_event_handler(cfg_["id"]);
- + }
- }
- bool event_handler::matches_name(const std::string &name, const game_data * gd) const
Advertisement
Add Comment
Please, Sign In to add comment