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:
parent
57f16bc420
commit
8897f2282f
|
@ -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) {
|
||||
|
|
Loading…
Reference in New Issue