From de1f2338488815bdb2ed8ebcaa68b82c871e0321 Mon Sep 17 00:00:00 2001 From: Pax1601 Date: Tue, 29 Jul 2025 17:17:15 +0200 Subject: [PATCH] Fixed unarmed ground units not moving --- backend/core/src/groundunit.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/backend/core/src/groundunit.cpp b/backend/core/src/groundunit.cpp index 717696ea..29daee5e 100644 --- a/backend/core/src/groundunit.cpp +++ b/backend/core/src/groundunit.cpp @@ -179,10 +179,9 @@ void GroundUnit::AIloop() double currentAmmo = computeTotalAmmo(); /* Out of ammo */ - if (currentAmmo <= shotsToFire && state != State::IDLE) { + if (shotsToFire > 0 && currentAmmo < shotsToFire && state != State::IDLE && state != State::REACH_DESTINATION) setState(State::IDLE); - } - + /* Account for unit reloading */ if (currentAmmo < oldAmmo) totalShellsFired += oldAmmo - currentAmmo;