From 364bac7de740e2c9e3c25e0c188b42d3c125bd1b Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Fri, 19 Nov 2021 13:49:19 +0100 Subject: [PATCH] Trigger OnRemove on a Creatures scripts when it gets switched out. --- src/Battling/Models/BattleSide.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Battling/Models/BattleSide.cpp b/src/Battling/Models/BattleSide.cpp index 9589b1e..245746a 100644 --- a/src/Battling/Models/BattleSide.cpp +++ b/src/Battling/Models/BattleSide.cpp @@ -1,6 +1,7 @@ #include "BattleSide.hpp" #include "../EventHooks/EventDataClasses.hpp" #include "Battle.hpp" +#include "../ScriptHandling/ScriptMacros.hpp" using namespace CreatureLib::Battling; @@ -52,6 +53,7 @@ void BattleSide::SetChoice(BaseTurnChoice* choice) { void BattleSide::SetCreature(ArbUt::OptionalBorrowedPtr creature, uint8_t index) { auto old = _creatures[index]; if (old.HasValue()) { + HOOK(OnRemove, this); old.GetValue()->SetOnBattleField(false); } _creatures[index] = creature;