]> git.pond.sub.org Git - empserver/commitdiff
Get rid of the need to fix up lchr[].
authorMarkus Armbruster <armbru@pond.sub.org>
Mon, 4 Feb 2008 20:38:38 +0000 (21:38 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Thu, 7 Feb 2008 07:01:54 +0000 (08:01 +0100)
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
src/lib/global/init.c
src/lib/subs/lndsub.c
src/lib/update/revolt.c

index 0469533e129a67336c0d293e4051a826ae911a63..339cf410c8edf9916f0d5ea1b6053ee89aee60af 100644 (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 */
     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 */
     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 */
index 5cfe3427c8485e4cee37c2254a3c07304299b9d6..dc344e009595f2feb5f9a6f6c3aeda5a2c542173 100644 (file)
@@ -34,8 +34,6 @@
 
 #include <config.h>
 
 
 #include <config.h>
 
-#include "land.h"
-#include "misc.h"
 #include "optlist.h"
 #include "plane.h"
 #include "product.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_mchr(void);
 static void init_pchr(void);
 static void init_plchr(void);
-static void init_lchr(void);
 
 void
 global_init(void)
 
 void
 global_init(void)
@@ -53,7 +50,6 @@ global_init(void)
     init_pchr();
     init_mchr();
     init_plchr();
     init_pchr();
     init_mchr();
     init_plchr();
-    init_lchr();
 }
 
 static void
 }
 
 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];
-    }
-}
index 259aefcae41ecf9c9a7674b3e790baa084d136e4..df3c98409d54bdf6df393a6cec860b614cfbe3c3 100644 (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 /
        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);
     }
        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;
     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
        if (llp->unit.land.lnd_effic < LAND_MINEFF)
            lnd_delete(llp, "has nowhere to retreat, and dies!");
        else
index 836d260589a63ddae73d8dd9ce685980598f28aa..8684eaa2a00d8d07823056adfb5270ef461fa0d1 100644 (file)
@@ -478,7 +478,7 @@ take_casualties(struct sctstr *sp, int mc)
 
        lp->lnd_effic -= deq;
        lp->lnd_mobil -= deq / 2;
 
        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;
        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;
 
        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;
        lnd_submil(lp, deq);
        if (mc <= 0)
            return;