From 44c47d64bdcfeb6867fa99dd29953030fe91e8f4 Mon Sep 17 00:00:00 2001 From: Deukhoofd Date: Tue, 13 Apr 2021 18:33:10 +0200 Subject: [PATCH] When cloning a battle, ensure the old battle data is always cleared from the cloned party. --- src/Battling/Battle/Battle.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/Battling/Battle/Battle.cpp b/src/Battling/Battle/Battle.cpp index 71af441..42fb2c5 100644 --- a/src/Battling/Battle/Battle.cpp +++ b/src/Battling/Battle/Battle.cpp @@ -17,7 +17,13 @@ void PkmnLib::Battling::Battle::ClearWeather() { PkmnLib::Battling::Battle* PkmnLib::Battling::Battle::Clone() const { auto parties = ArbUt::List(_parties.Count()); for (auto* party : _parties) { - parties.Append(party->Clone()); + auto* partyClone = party->Clone(); + parties.Append(partyClone); + for (auto* m : partyClone->GetParty()->GetParty()) { + if (m != nullptr) { + m->ClearBattleData(); + } + } } auto* battle =