Rework clearing battle from creatures.
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:
@@ -48,7 +48,7 @@ namespace CreatureLib::Battling {
|
||||
}
|
||||
}
|
||||
|
||||
virtual ~Battle() = default;
|
||||
virtual ~Battle() { ClearBattle(); }
|
||||
|
||||
[[nodiscard]] const ArbUt::BorrowedPtr<const BattleLibrary>& GetLibrary() const noexcept;
|
||||
[[nodiscard]] uint32_t GetCurrentTurn() const noexcept { return _currentTurn; }
|
||||
@@ -117,13 +117,16 @@ namespace CreatureLib::Battling {
|
||||
|
||||
long GetLastTurnTimeMicroseconds() const noexcept { return _lastTurnTime; }
|
||||
|
||||
void EndBattle() {
|
||||
this->_hasEnded = true;
|
||||
void EndBattle() { this->_hasEnded = true; }
|
||||
|
||||
void ClearBattle() {
|
||||
for (size_t i = 0; i < _numberOfSides; i++) {
|
||||
auto side = _sides[i];
|
||||
for (auto c : side->GetCreatures()) {
|
||||
if (c.HasValue()) {
|
||||
c.GetValue()->ClearBattleData();
|
||||
if (c.GetValue()->GetBattle() == this) {
|
||||
c.GetValue()->ClearBattleData();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user