From aa311fd68a4cb03f11d67670c936ecbbb2c9cbc8 Mon Sep 17 00:00:00 2001 From: Anonymissimus Date: Mon, 15 Nov 2010 15:08:29 +0000 Subject: [PATCH] introduced [recall]fire_event=yes|no (default no) parameter (fixes bug #17083) --- changelog | 1 + src/actions.cpp | 14 +++++++++----- src/actions.hpp | 2 +- src/game_events.cpp | 2 +- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/changelog b/changelog index 3a0e5e49940..c5fc34b00e4 100644 --- a/changelog +++ b/changelog @@ -14,6 +14,7 @@ Version 1.9.2+svn: * Converted some dialog boxes to GUI2 * WML Engine: * Created tag [petrify] (bug #17077). Moved [unpetrify] to lua. + * Introduced [recall]fire_event=yes|no (default no) parameter (fixes bug #17083). Version 1.9.2: * Campaigns: diff --git a/src/actions.cpp b/src/actions.cpp index 9d8e2dc3d33..346306a9b57 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -404,7 +404,7 @@ std::string find_recruit_location(int side, map_location &recruit_loc, bool need } void place_recruit(const unit &u, const map_location &recruit_location, - bool is_recall, bool show, bool full_movement, + bool is_recall, bool show, bool fire_event, bool full_movement, bool wml_triggered) { LOG_NG << "placing new unit on location " << recruit_location << "\n"; @@ -425,8 +425,10 @@ void place_recruit(const unit &u, const map_location &recruit_location, if (is_recall) { - LOG_NG << "firing prerecall event\n"; - game_events::fire("prerecall",recruit_location); + if (fire_event) { + LOG_NG << "firing prerecall event\n"; + game_events::fire("prerecall",recruit_location); + } } else { @@ -451,8 +453,10 @@ void place_recruit(const unit &u, const map_location &recruit_location, } if (is_recall) { - LOG_NG << "firing recall event\n"; - game_events::fire("recall",recruit_location); + if (fire_event) { + LOG_NG << "firing recall event\n"; + game_events::fire("recall",recruit_location); + } } else { diff --git a/src/actions.hpp b/src/actions.hpp index 9f62dde6b57..b19c2c3cf1a 100644 --- a/src/actions.hpp +++ b/src/actions.hpp @@ -96,7 +96,7 @@ std::string find_recruit_location(int side, map_location &recruit_location, * through a call to recruit_location(). */ void place_recruit(const unit &u, const map_location &recruit_location, - bool is_recall, bool show = false, bool full_movement = false, + bool is_recall, bool show = false, bool fire_event = true, bool full_movement = false, bool wml_triggered = false); /** Structure describing the statistics of a unit involved in the battle. */ diff --git a/src/game_events.cpp b/src/game_events.cpp index 264032aca5a..2dc2474db23 100644 --- a/src/game_events.cpp +++ b/src/game_events.cpp @@ -1638,7 +1638,7 @@ WML_HANDLER_FUNCTION(recall, /*event_info*/, cfg) unit to_recruit(*u); avail.erase(u); // Erase before recruiting, since recruiting can fire more events find_recruit_location(index + 1, loc, false); - place_recruit(to_recruit, loc, true, cfg["show"].to_bool(true), true, true); + place_recruit(to_recruit, loc, true, cfg["show"].to_bool(true), cfg["fire_event"].to_bool(false), true, true); unit_recalled = true; break; }