From e3350de3a2d90922c2b16e5b5e819f259adb3588 Mon Sep 17 00:00:00 2001 From: jacopo grandi Date: Fri, 5 Mar 2021 18:00:29 +0100 Subject: augs, armor and brain stats tweak, scroll stats view --- gst/generate.h | 2 +- gst/units.c | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) (limited to 'gst') diff --git a/gst/generate.h b/gst/generate.h index 4c30a96..dcc8148 100644 --- a/gst/generate.h +++ b/gst/generate.h @@ -3,7 +3,7 @@ #include "info.h" -#define GENERATE_UNIT_MAX_ATTEMPTS 128 +#define GENERATE_UNIT_MAX_ATTEMPTS 32 void generate_init (); int generate_unit (infos *info, info_unit *u, float cost); diff --git a/gst/units.c b/gst/units.c index b5d05a9..aeced1b 100644 --- a/gst/units.c +++ b/gst/units.c @@ -244,7 +244,10 @@ void army_upkeep (infos *info, army *ar, map *m, stats_unit *ustats) { for (int i=0; iuslen; i++) { unit *u = ar->us+i; if (u->hp <= 0) continue; - u->charge -= ustats[i].frame.upkeep; + float dcharge = -ustats[i].frame.upkeep; + // if delta charge >0, see if the battery can be recharged + if (dcharge > 0) dcharge *= ustats[i].frame.recharge; + u->charge += dcharge; if (u->charge < 0) u->charge = 0; } } \ No newline at end of file -- cgit v1.2.3-54-g00ecf