assault attack board lboard paradrop: Fix defending land unit supply
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 2 Jan 2021 07:06:57 +0000 (08:06 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 17 Jan 2021 20:24:29 +0000 (21:24 +0100)
get_dlist() collects defending land units in a list, and resupplies
them.  Bug: it uses a local copy instead of the one in the list.  When
att_fight() writes back the list, the commodities supplied get wiped
out, triggering a seqno oops.  Broken in commit 62b9399cd "subs:
Factor lnd_insque() out of lnd_sel(), ask_olist(), ...", v4.3.33.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/subs/attsub.c

index b9242f962fc4ac69f2ac37edc594e7210972d87f..e40f1b81f9cc69a8ac7bef520eb27a10ec6a17b2 100644 (file)
@@ -29,7 +29,7 @@
  *  Known contributors to this file:
  *     Ken Stevens, 1995
  *     Steve McClure, 1996-2000
- *     Markus Armbruster, 2006-2016
+ *     Markus Armbruster, 2006-2021
  */
 
 #include <config.h>
@@ -1206,13 +1206,13 @@ get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
        intelligence_report(player->cnum, &land, a_spy,
                            "Scouts report defending unit:");
        llp = lnd_insque(&land, list);
-       llp->supplied = lnd_supply_all(&land);
+       llp->supplied = lnd_supply_all(&llp->unit.land);
        llp->mobil = 0.0;
        llp->x = llp->unit.land.lnd_x;
        llp->y = llp->unit.land.lnd_y;
        llp->eff = llp->unit.land.lnd_effic;
-       if (lnd_spyval(&land) > *d_spyp)
-           *d_spyp = lnd_spyval(&land);
+       if (lnd_spyval(&llp->unit.land) > *d_spyp)
+           *d_spyp = lnd_spyval(&llp->unit.land);
     }
 }