aboutsummaryrefslogtreecommitdiff
path: root/gst/info.c
diff options
context:
space:
mode:
authorjacopo grandi <jak.sk8@hotmail.it>2021-02-22 20:18:25 +0100
committerjacopo grandi <jak.sk8@hotmail.it>2021-02-22 20:18:25 +0100
commitf26a86bcc78c1946f55b6a399039e3bd8fb5dd16 (patch)
tree31feba3fa57b57a9997e34c7b46cf5f5886e9f07 /gst/info.c
parent4842b67ab590250d95ad4be5fe61380a09b1e8ea (diff)
fix maxrange and testing
Diffstat (limited to 'gst/info.c')
-rw-r--r--gst/info.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/gst/info.c b/gst/info.c
index 2329baf..0eaecb3 100644
--- a/gst/info.c
+++ b/gst/info.c
@@ -240,13 +240,14 @@ float info_unit_get_range(infos *info, info_unit *u, int w) {
float info_unit_get_maxrange(infos *info, info_unit *u) {
int lc = u->levels[LEVEL_CHASSIS];
- float sum = 0;
+ float max = 0;
for(int i=0; i<info->chassis[u->chassis].slot_weapon[lc]; i++) {
if (u->weapons[i] != -1) {
- sum += info_unit_get_range(info, u, i);
+ float range = info_unit_get_range(info, u, i);
+ if (range > max) { max = range; }
}
}
- return sum;
+ return max;
}
float info_unit_get_charge_per_shot (infos *info, info_unit *u, int w) {