aboutsummaryrefslogtreecommitdiff
path: root/gst/units.c
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-03-05 16:54:26 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-03-05 16:54:26 +0100
commitd1af4269c4130d11d77f61f1a2ac8f3e249f72f2 (patch)
tree05618430db0951262bd22e7bbe77b663c3c0346f /gst/units.c
parent02e55b0647eb5c631e7d7669a13fd0d47ec26c15 (diff)
unit generator in hud, minor fix in movement, % in view and cost weights
Diffstat (limited to 'gst/units.c')
-rw-r--r--gst/units.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/gst/units.c b/gst/units.c
index 0297266..b5d05a9 100644
--- a/gst/units.c
+++ b/gst/units.c
@@ -155,10 +155,8 @@ int army_move_step (infos *info, army *ar, map *m, stats_unit *ustats) {
}
}
// execution
- int sum = 0, lastsum = -1, step = 0;
+ int sum = 0, step = 0;
for (; step<MAXSOLVESTEPS; step++) {
- if (sum == lastsum) { break; }
- lastsum = sum;
sum = 0;
for (int i=0; i<mclen; i++) {
int dest[2] = {
@@ -170,9 +168,10 @@ int army_move_step (infos *info, army *ar, map *m, stats_unit *ustats) {
mcs[i].done = 1;
mcs[i].u->move_points -= 1;
orders++;
+ sum++;
}
- sum += mcs[i].done;
}
+ if (sum == 0) { break; }
}
if (step == MAXSOLVESTEPS) { printf("army: max steps reached\n"); }
if (orders > 0) return 0;