]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/lndsub.c
Update copyright notice.
[empserver] / src / lib / subs / lndsub.c
index 221286f2070ba4685a1d1af54f2940093645eab9..ad120be637b285cc2cbe704bc87ffd60af654a11 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -705,8 +705,7 @@ lnd_sweep(struct emp_qelem *land_list, int verbose, int takemob,
        putland(llp->land.lnd_uid, &llp->land);
        if (!(mines = sect.sct_mines))
            continue;
-       max = vl_find(V_SHELL, llp->lcp->l_vtype,
-                     llp->lcp->l_vamt, (int)llp->lcp->l_nv);
+       max = llp->lcp->l_item[I_SHELL];
        lshells = llp->land.lnd_item[I_SHELL];
        sshells = sect.sct_item[I_SHELL];
        for (m = 0; mines > 0 && m < max * 2; m++) {
@@ -785,7 +784,6 @@ lnd_list(struct emp_qelem *land_list)
     struct emp_qelem *next;
     struct llist *llp;
     struct lndstr *lnd;
-    int vec[I_MAX + 1];
 
     pr("lnd#     land type       x,y    a  eff  sh gun xl  mu tech retr fuel\n");
 
@@ -798,9 +796,8 @@ lnd_list(struct emp_qelem *land_list)
        prxy("%4d,%-4d ", lnd->lnd_x, lnd->lnd_y, llp->land.lnd_own);
        pr("%1c", lnd->lnd_army);
        pr("%4d%%", lnd->lnd_effic);
-       getvec(VT_ITEM, vec, (s_char *)lnd, EF_LAND);
-       pr("%4d", vec[I_SHELL]);
-       pr("%4d", vec[I_GUN]);
+       pr("%4d", lnd->lnd_item[I_SHELL]);
+       pr("%4d", lnd->lnd_item[I_GUN]);
        count_land_planes(lnd);
        pr("%3d", lnd->lnd_nxlight);
        pr("%4d", lnd->lnd_mobil);
@@ -1137,9 +1134,9 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
        }
        /* Note we check would_abandon first because we don't want
           to always have to do these checks */
-       if (would_abandon(&osect, V_CIVIL, 0, &(llp->land))) {
+       if (would_abandon(&osect, I_CIVIL, 0, &(llp->land))) {
            stop = 0;
-           if (!want_to_abandon(&osect, V_CIVIL, 0, &(llp->land))) {
+           if (!want_to_abandon(&osect, I_CIVIL, 0, &(llp->land))) {
                stop = 1;
            }
            /* now check stuff */
@@ -1385,3 +1382,36 @@ lnd_fortify (struct lndstr *lp, int hard_amt)
 
     return hard_amt;
 }
+
+/*
+ * Set LP's tech to TLEV along with everything else that depends on it.
+ */
+void
+lnd_set_tech(struct lndstr *lp, int tlev)
+{
+    struct lchrstr *lcp = lchr + lp->lnd_type;
+    int tech_diff = tlev - lcp->l_tech;
+
+    if (CANT_HAPPEN(tech_diff < 0)) {
+      tlev -= tech_diff;
+      tech_diff = 0;
+    }
+
+    lp->lnd_tech = tlev;
+    lp->lnd_att = (float)LND_ATTDEF(lcp->l_att, tech_diff);
+    lp->lnd_def = (float)LND_ATTDEF(lcp->l_def, tech_diff);
+    lp->lnd_vul = (int)LND_VUL(lcp->l_vul, tech_diff);
+    lp->lnd_spd = (int)LND_SPD(lcp->l_spd, tech_diff);
+    lp->lnd_vis = (int)LND_VIS(lcp->l_vis, tech_diff);
+    lp->lnd_spy = (int)LND_SPY(lcp->l_spy, tech_diff);
+    lp->lnd_rad = (int)LND_RAD(lcp->l_rad, tech_diff);
+    lp->lnd_frg = (int)LND_FRG(lcp->l_frg, tech_diff);
+    lp->lnd_acc = (int)LND_ACC(lcp->l_acc, tech_diff);
+    lp->lnd_dam = (int)LND_DAM(lcp->l_dam, tech_diff);
+    lp->lnd_ammo = (int)LND_AMM(lcp->l_ammo, lcp->l_dam, tech_diff);
+    lp->lnd_aaf = (int)LND_AAF(lcp->l_aaf, tech_diff);
+    lp->lnd_fuelc = (int)LND_FC(lcp->l_fuelc, tech_diff);
+    lp->lnd_fuelu = (int)LND_FU(lcp->l_fuelu, tech_diff);
+    lp->lnd_maxlight = (int)LND_XPL(lcp->l_nxlight, tech_diff);
+    lp->lnd_maxland = (int)LND_MXL(lcp->l_mxland, tech_diff);
+}