Use std::algorithm for Battle::CreatureInField
continuous-integration/drone/push Build is passing Details

This commit is contained in:
Deukhoofd 2020-06-05 14:15:20 +02:00
parent 57e8595bdf
commit 44de4a0799
Signed by: Deukhoofd
GPG Key ID: ADF2E9256009EDCE
1 changed files with 1 additions and 5 deletions

View File

@ -75,11 +75,7 @@ BattleRandom* Battle::GetRandom() noexcept { return &_random; }
bool Battle::CreatureInField(ArbUt::BorrowedPtr<Creature> creature) const { bool Battle::CreatureInField(ArbUt::BorrowedPtr<Creature> creature) const {
AssertNotNull(creature) AssertNotNull(creature)
for (auto s : _sides) { return std::any_of(_sides.begin(), _sides.end(), [creature](auto c) { return c->CreatureOnSide(creature); });
if (s->CreatureOnSide(creature))
return true;
}
return false;
} }
void Battle::ForceRecall(uint8_t side, uint8_t index) { _sides[side]->SetCreature(nullptr, index); } void Battle::ForceRecall(uint8_t side, uint8_t index) { _sides[side]->SetCreature(nullptr, index); }