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.
This commit is contained in:
Markus Armbruster 2008-02-04 21:38:38 +01:00
parent 91eefc3f3a
commit 3290e87576
4 changed files with 6 additions and 20 deletions

View file

@ -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 */

View file

@ -34,8 +34,6 @@
#include <config.h>
#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];
}
}

View file

@ -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

View file

@ -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;