Reset seen opponents on ClearBattle.
All checks were successful
continuous-integration/drone/push Build is passing

Signed-off-by: Deukhoofd <Deukhoofd@gmail.com>
This commit is contained in:
2021-01-15 15:46:48 +01:00
parent 6edc9da536
commit 66b95a6e4d
4 changed files with 10 additions and 11 deletions

View File

@@ -18,8 +18,9 @@ bool Battle::CanUse(const ArbUt::BorrowedPtr<BaseTurnChoice>& choice) {
bool Battle::TrySetChoice(BaseTurnChoice* choice) {
EnsureNotNull(choice)
if (!CanUse(choice))
if (!CanUse(choice)) {
return false;
}
Ensure(choice->GetUser()->GetBattleSide().HasValue())
choice->GetUser()->GetBattleSide().GetValue()->SetChoice(choice);
CheckChoicesSetAndRun();
@@ -28,12 +29,12 @@ bool Battle::TrySetChoice(BaseTurnChoice* choice) {
void Battle::CheckChoicesSetAndRun() {
try {
for (auto side : _sides) {
for (auto* side : _sides) {
if (!side->AllChoicesSet()) {
return;
}
}
for (auto side : _sides) {
for (auto* side : _sides) {
if (!side->AllPossibleSlotsFilled()) {
return;
}
@@ -48,7 +49,7 @@ void Battle::CheckChoicesSetAndRun() {
auto choices = std::vector<std::shared_ptr<BaseTurnChoice>>(_numberOfSides * _creaturesPerSide);
auto i = 0;
try {
for (auto side : _sides) {
for (auto* side : _sides) {
for (auto choice : side->GetChoices()) {
EnsureNotNull(choice)
if (choice->GetKind() == TurnChoiceKind::Attack) {