Put the check for slots filled behind the check whether all choices are set.

This because this check can be more expensive, and should run as little times
as possible. In this case it should only run when all choices are set,
which should be in most cases once a turn.
This commit is contained in:
Deukhoofd 2019-12-07 12:49:18 +01:00
parent 57f16bc420
commit 8897f2282f
1 changed files with 6 additions and 3 deletions

View File

@ -26,13 +26,16 @@ bool Battle::TrySetChoice(BaseTurnChoice* choice) {
void Battle::CheckChoicesSetAndRun() {
for (auto side : _sides) {
if (!side->AllPossibleSlotsFilled()) {
return;
}
if (!side->AllChoicesSet()) {
return;
}
}
for (auto side : _sides) {
if (!side->AllPossibleSlotsFilled()) {
return;
}
}
auto choices = std::vector<BaseTurnChoice*>(_numberOfSides * _creaturesPerSide);
auto i = 0;
for (auto side : _sides) {