summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/game/unit_soldier.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/game/unit_soldier.cpp b/src/game/unit_soldier.cpp
index d511553..c8e46d0 100644
--- a/src/game/unit_soldier.cpp
+++ b/src/game/unit_soldier.cpp
@@ -65,6 +65,9 @@ static v2f_t spread_aim(v2f_t x, v2f_t aim, float cof, procgen::prng_t *prng)
v2f_t tmp;
r = (aim - x).len();
+ if (r <= 0.1f)
+ return aim;
+
r_ = r + cof * r * prng->next_float(-1.0f, 1.0f);
tmp = (aim - x) / r * r_;