]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/lndsub.c
Fix test for capability engineer in lnd_hit_mine()
[empserver] / src / lib / subs / lndsub.c
index f1271a0646d3aba9c4897da2196f6d03e12e44c7..4b0cec14b330edc234044f3a8d421a298b393b06 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -178,10 +178,9 @@ lnd_take_casualty(int combat_mode, struct ulist *llp, int cas)
 
     taken = llp->unit.land.lnd_item[I_MILIT];
     /* Spies always die */
-    if (((struct lchrstr *)llp->chrp)->l_flags & L_SPY) {
-       eff_eq = 100;
+    if (((struct lchrstr *)llp->chrp)->l_flags & L_SPY)
        llp->unit.land.lnd_effic = 0;
-    else {
+    else {
        eff_eq = ldround(cas * 100.0 /
            ((struct lchrstr *)llp->chrp)->l_item[I_MILIT], 1);
        llp->unit.land.lnd_effic -= eff_eq;
@@ -681,7 +680,7 @@ lnd_damage(struct emp_qelem *list, int totdam)
     for (qp = list->q_back; qp != list; qp = next) {
        next = qp->q_back;
        llp = (struct ulist *)qp;
-       /* have to get it again because of collateral damage */
+       /* land unit might have changed (launched SAMs, collateral dmg) */
        getland(llp->unit.land.lnd_uid, &llp->unit.land);
        landdamage(&llp->unit.land, dam);
        putland(llp->unit.land.lnd_uid, &llp->unit.land);
@@ -863,7 +862,7 @@ lnd_hit_mine(struct lndstr *lp)
     nreport(lp->lnd_own, N_LHIT_MINE, 0, 1);
 
     m = MINE_LDAMAGE();
-    if (lchr[lp->lnd_uid].l_flags & L_ENGINEER)
+    if (lchr[lp->lnd_type].l_flags & L_ENGINEER)
        m /= 2;
 
     landdamage(lp, m);
@@ -1054,7 +1053,6 @@ lnd_mar_one_sector(struct emp_qelem *list, int dir, natid actor,
        /* move survivors to done */
        for (qp = cur.q_back; qp != &cur; qp = next) {
            next = qp->q_back;
-           llp = (struct ulist *)qp;
            emp_remque(qp);
            emp_insque(qp, &done);
        }