aboutsummaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-03-05 18:00:29 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-03-05 18:00:29 +0100
commite3350de3a2d90922c2b16e5b5e819f259adb3588 (patch)
treec254fe461107335543539030341abb894a150dd7 /gst
parentd1af4269c4130d11d77f61f1a2ac8f3e249f72f2 (diff)
augs, armor and brain stats tweak, scroll stats view
Diffstat (limited to 'gst')
-rw-r--r--gst/generate.h2
-rw-r--r--gst/units.c5
2 files changed, 5 insertions, 2 deletions
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; i<ar->uslen; 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