From 75e35f932f017cf24d41e434ca44e0ba34732197 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sat, 13 May 2006 07:24:10 +0000 Subject: [PATCH] (knockdown): Destroy nukes on collapsing bridges. Before, you could rescue them by building a new bridge or arming them on naval planes. --- src/lib/common/bridgefall.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/lib/common/bridgefall.c b/src/lib/common/bridgefall.c index be9a7bce..8dcce785 100644 --- a/src/lib/common/bridgefall.c +++ b/src/lib/common/bridgefall.c @@ -98,6 +98,7 @@ knockdown(struct sctstr *sp, struct emp_qelem *list) { struct lndstr land; struct plnstr plane; + struct nukstr nuke; struct nstr_item ni; struct natstr *np; @@ -118,8 +119,6 @@ knockdown(struct sctstr *sp, struct emp_qelem *list) while (nxtitem(&ni, &land)) { if (land.lnd_own == 0) continue; - if (land.lnd_x != sp->sct_x || land.lnd_y != sp->sct_y) - continue; if (land.lnd_ship >= 0) continue; np = getnatp(land.lnd_own); @@ -138,8 +137,6 @@ knockdown(struct sctstr *sp, struct emp_qelem *list) while (nxtitem(&ni, &plane)) { if (plane.pln_own == 0) continue; - if (plane.pln_x != sp->sct_x || plane.pln_y != sp->sct_y) - continue; if (plane.pln_flags & PLN_LAUNCHED) continue; if (plane.pln_ship >= 0) @@ -158,6 +155,24 @@ knockdown(struct sctstr *sp, struct emp_qelem *list) plane.pln_effic = 0; putplane(plane.pln_uid, &plane); } + /* Sink all the nukes */ + snxtitem_xy(&ni, EF_NUKE, sp->sct_x, sp->sct_y); + while (nxtitem(&ni, &nuke)) { + if (nuke.nuk_own == 0) + continue; + if (nuke.nuk_plane >= 0) + continue; + np = getnatp(nuke.nuk_own); + if (np->nat_flags & NF_BEEP) + mpr(nuke.nuk_own, "\07"); + mpr(nuke.nuk_own, " %s sinks to the bottom of the sea!\n", + prnuke(&nuke)); + makelost(EF_NUKE, nuke.nuk_own, nuke.nuk_uid, nuke.nuk_x, + nuke.nuk_y); + nuke.nuk_own = 0; + nuke.nuk_effic = 0; + putnuke(nuke.nuk_uid, &nuke); + } memset(sp->sct_item, 0, sizeof(sp->sct_item)); memset(sp->sct_del, 0, sizeof(sp->sct_del)); memset(sp->sct_dist, 0, sizeof(sp->sct_dist));