Fixes invalid pointers to a battle dangling when a battle is removed.
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
@@ -79,7 +79,7 @@ void Battle::CheckChoicesSetAndRun() {
|
||||
this->_currentTurnQueue = std::make_unique<ChoiceQueue>(choices);
|
||||
TriggerEventListener<TurnStartEvent>();
|
||||
try {
|
||||
TurnHandler::RunTurn(this->_currentTurnQueue);
|
||||
TurnHandler::RunTurn(this->_currentTurnQueue, this);
|
||||
} catch (const ArbUt::Exception& e) {
|
||||
throw e;
|
||||
} catch (const std::exception& e) {
|
||||
@@ -133,7 +133,7 @@ void Battle::ValidateBattleState() {
|
||||
auto side = _sides[i];
|
||||
if (side->HasFled()) {
|
||||
this->_battleResult = BattleResult::Inconclusive();
|
||||
this->_hasEnded = true;
|
||||
EndBattle();
|
||||
return;
|
||||
}
|
||||
if (!side->IsDefeated()) {
|
||||
@@ -146,11 +146,11 @@ void Battle::ValidateBattleState() {
|
||||
}
|
||||
if (!survivingSideExists) {
|
||||
this->_battleResult = BattleResult::Inconclusive();
|
||||
this->_hasEnded = true;
|
||||
EndBattle();
|
||||
return;
|
||||
}
|
||||
this->_battleResult = BattleResult::Conclusive(winningSide);
|
||||
this->_hasEnded = true;
|
||||
EndBattle();
|
||||
}
|
||||
void Battle::AddVolatileScript(const ArbUt::StringView& key) {
|
||||
auto script = _volatile.Get(key);
|
||||
|
||||
Reference in New Issue
Block a user