Trigger OnRemove on a Creatures scripts when it gets switched out.
This commit is contained in:
parent
a570e90f67
commit
364bac7de7
|
@ -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> creature, uint8_t index) {
|
||||
auto old = _creatures[index];
|
||||
if (old.HasValue()) {
|
||||
HOOK(OnRemove, this);
|
||||
old.GetValue()->SetOnBattleField(false);
|
||||
}
|
||||
_creatures[index] = creature;
|
||||
|
|
Loading…
Reference in New Issue