From 2eef87c8970db643c4ef09e0fd9e8110c8193043 Mon Sep 17 00:00:00 2001 From: jacopo grandi Date: Sat, 20 Feb 2021 00:11:23 +0100 Subject: finish condition and bad cost function --- gst/units.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'gst/units.c') 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; iuslen; 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; iuslen; 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) { -- cgit v1.2.3-54-g00ecf