From 3290e875764b8d3973d8b63d40e84a805580526a Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Mon, 4 Feb 2008 21:38:38 +0100 Subject: [PATCH] Get rid of the need to fix up lchr[]. Mil are not required for building units since 4.0.0. l_mil was still initialized to l_item[I_MILIT], and used instead of that in a couple of places. Fix those, and remove the initialization. --- include/land.h | 2 +- src/lib/global/init.c | 15 --------------- src/lib/subs/lndsub.c | 5 +++-- src/lib/update/revolt.c | 4 ++-- 4 files changed, 6 insertions(+), 20 deletions(-) diff --git a/include/land.h b/include/land.h index 0469533e1..339cf410c 100644 --- a/include/land.h +++ b/include/land.h @@ -103,7 +103,7 @@ struct lchrstr { char *l_name; /* full name of type of land unit */ int l_lcm; /* units of lcm to build */ int l_hcm; /* units of hcm to build */ - int l_mil; /* how many mil it takes to build */ + int l_mil; /* how many mil it takes to build (unused) */ int l_gun; /* how many guns it takes to build (unused) */ int l_shell; /* #shells it takes to build (unused) */ int l_tech; /* tech required to build */ diff --git a/src/lib/global/init.c b/src/lib/global/init.c index 5cfe3427c..dc344e009 100644 --- a/src/lib/global/init.c +++ b/src/lib/global/init.c @@ -34,8 +34,6 @@ #include -#include "land.h" -#include "misc.h" #include "optlist.h" #include "plane.h" #include "product.h" @@ -45,7 +43,6 @@ static void init_mchr(void); static void init_pchr(void); static void init_plchr(void); -static void init_lchr(void); void global_init(void) @@ -53,7 +50,6 @@ global_init(void) init_pchr(); init_mchr(); init_plchr(); - init_lchr(); } static void @@ -90,14 +86,3 @@ init_pchr(void) } } } - -static void -init_lchr() -{ - int i; - - for (i = 0; lchr[i].l_name; i++) { - /* Fix up the military values */ - lchr[i].l_mil = lchr[i].l_item[I_MILIT]; - } -} diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 259aefcae..df3c98409 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -172,7 +172,7 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas) llp->unit.land.lnd_effic = 0; } else { eff_eq = ldround(cas * 100.0 / - ((struct lchrstr *)llp->chrp)->l_mil, 1); + ((struct lchrstr *)llp->chrp)->l_item[I_MILIT], 1); llp->unit.land.lnd_effic -= eff_eq; lnd_submil(&llp->unit.land, cas); } @@ -274,7 +274,8 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas) if (nowhere_to_go) { /* nowhere to go.. take more casualties */ llp->unit.land.lnd_effic -= 10; - lnd_submil(&llp->unit.land, ((struct lchrstr *)llp->chrp)->l_mil / 10); + lnd_submil(&llp->unit.land, + ((struct lchrstr *)llp->chrp)->l_item[I_MILIT] / 10); if (llp->unit.land.lnd_effic < LAND_MINEFF) lnd_delete(llp, "has nowhere to retreat, and dies!"); else diff --git a/src/lib/update/revolt.c b/src/lib/update/revolt.c index 836d26058..8684eaa2a 100644 --- a/src/lib/update/revolt.c +++ b/src/lib/update/revolt.c @@ -478,7 +478,7 @@ take_casualties(struct sctstr *sp, int mc) lp->lnd_effic -= deq; lp->lnd_mobil -= deq / 2; - deq = lchr[(int)lp->lnd_type].l_mil * (deq / 100.0); + deq = lchr[(int)lp->lnd_type].l_item[I_MILIT] * (deq / 100.0); lnd_submil(lp, deq); if (mc <= 0) return; @@ -503,7 +503,7 @@ take_casualties(struct sctstr *sp, int mc) lp->lnd_effic -= deq; lp->lnd_mobil -= deq / 2; - deq = lchr[(int)lp->lnd_type].l_mil * (deq / 100.0); + deq = lchr[(int)lp->lnd_type].l_item[I_MILIT] * (deq / 100.0); lnd_submil(lp, deq); if (mc <= 0) return; -- 2.43.0