aboutsummaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
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