aboutsummaryrefslogtreecommitdiff
path: root/gst/units.c
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-20 00:11:23 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-20 00:11:23 +0100
commit2eef87c8970db643c4ef09e0fd9e8110c8193043 (patch)
tree78a9bcc7932ab8edb8669ded755ee2c81afc0912 /gst/units.c
parentc135f85fcdc1eeedd04e0c9e9f626b907500f20a (diff)
finish condition and bad cost function
Diffstat (limited to 'gst/units.c')
-rw-r--r--gst/units.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/gst/units.c b/gst/units.c
index dbf177b..b247e3c 100644
--- a/gst/units.c
+++ b/gst/units.c
@@ -168,18 +168,18 @@ int army_move_step (infos *info, army *ar, map *m) {
else return 1;
}
-void army_move (infos *info, army *ar, map *m) {
+int army_move (infos *info, army *ar, map *m) {
for (int i=0; i<ar->uslen; i++) {
ar->us[i].move_points += info_unit_get_speed(info, &ar->us[i].info);
}
- int iter = 0, finished = 0;
+ int iter = 0, finished = army_move_step(info, ar, m);
for (; iter<5 && !finished; iter++) {
finished = army_move_step(info, ar, m);
}
- //printf("stepped %d %d\n", iter, finished);
+ return iter;
}
-void army_fire (infos *info, army *ar, map *m) {
+int army_fire (infos *info, army *ar, map *m) {
for (int i=0; i<ar->uslen; i++) {
unit *u = ar->us+i;
int lw = u->info.levels[LEVEL_CHASSIS];
@@ -216,6 +216,7 @@ void army_fire (infos *info, army *ar, map *m) {
unit_dead(ar, m, dmgs[i].u);
}
}
+ return dmgslen;
}
void army_upkeep (infos *info, army *ar, map *m) {