If no side is still alive, mark battle as inconclusive ended.
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
This commit is contained in:
parent
32bb641f75
commit
fd1c6e9a0a
|
@ -102,7 +102,7 @@ bool Battle::CanSlotBeFilled(uint8_t side, uint8_t index) const {
|
||||||
|
|
||||||
void Battle::ValidateBattleState() {
|
void Battle::ValidateBattleState() {
|
||||||
bool survivingSideExists = false;
|
bool survivingSideExists = false;
|
||||||
uint8_t winningSide = 0;
|
uint8_t winningSide = 255;
|
||||||
for (uint8_t i = 0; i < _sides.Count(); i++) {
|
for (uint8_t i = 0; i < _sides.Count(); i++) {
|
||||||
auto side = _sides[i];
|
auto side = _sides[i];
|
||||||
if (side->HasFled()) {
|
if (side->HasFled()) {
|
||||||
|
@ -118,6 +118,11 @@ void Battle::ValidateBattleState() {
|
||||||
winningSide = i;
|
winningSide = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (!survivingSideExists) {
|
||||||
|
this->_battleResult = BattleResult::Inconclusive();
|
||||||
|
this->_hasEnded = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
this->_battleResult = BattleResult::Conclusive(winningSide);
|
this->_battleResult = BattleResult::Conclusive(winningSide);
|
||||||
this->_hasEnded = true;
|
this->_hasEnded = true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue