introduced [recall]fire_event=yes|no (default no) parameter

(fixes bug #17083)
This commit is contained in:
Anonymissimus 2010-11-15 15:08:29 +00:00
parent 2b90cd1ed3
commit aa311fd68a
4 changed files with 12 additions and 7 deletions

View File

@ -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:

View File

@ -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
{

View File

@ -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. */

View File

@ -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;
}