When cloning a battle, ensure the old battle data is always cleared from the cloned party.
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2021-04-13 18:33:10 +02:00
parent 44ffadb439
commit 44c47d64bd
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
1 changed files with 7 additions and 1 deletions

View File

@ -17,7 +17,13 @@ void PkmnLib::Battling::Battle::ClearWeather() {
PkmnLib::Battling::Battle* PkmnLib::Battling::Battle::Clone() const {
auto parties = ArbUt::List<CreatureLib::Battling::BattleParty*>(_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 =