From 5663713be92e52302f4b2954b611aa5f5645b422 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Tue, 28 Mar 2006 05:51:49 +0000 Subject: [PATCH] (retreat_ship1): Fix test for seamines. Before, retreating ships could sweep and hit landmines. The bug fixed in rev. 1.35 is believed to have masked this bug. Charge mobility for sweeping. Closes #1346756. --- src/lib/subs/retreat.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/lib/subs/retreat.c b/src/lib/subs/retreat.c index a13038a2f..e5f12995b 100644 --- a/src/lib/subs/retreat.c +++ b/src/lib/subs/retreat.c @@ -268,7 +268,8 @@ retreat_ship1(struct shpstr *sp, char code, int orig) mines = sect.sct_mines; changed = 0; - if ((mcp->m_flags & M_SWEEP) && mines > 0 && !player->owner) { + if ((mcp->m_flags & M_SWEEP) && sect.sct_type == SCT_WATER) { + sp->shp_mobil -= mobcost; max = mcp->m_item[I_SHELL]; shells = sp->shp_item[I_SHELL]; for (m = 0; mines > 0 && m < 5; m++) { @@ -276,7 +277,7 @@ retreat_ship1(struct shpstr *sp, char code, int orig) mines--; shells = MIN(max, shells + 1); changed |= map_set(sp->shp_own, sp->shp_x, sp->shp_y, - 'X', 0); + 'X', 0); } } if (sect.sct_mines != mines) { @@ -284,14 +285,15 @@ retreat_ship1(struct shpstr *sp, char code, int orig) "%s cleared %d mine%s in %s while retreating\n", prship(sp), sect.sct_mines-mines, splur(sect.sct_mines-mines), xyas(newx, newy, sp->shp_own)); + sect.sct_mines = mines; + sp->shp_item[I_SHELL] = shells; + putsect(§); } - sect.sct_mines = mines; - sect.sct_item[I_SHELL] = shells; - putsect(§); if (changed) writemap(sp->shp_own); } - if (mines > 0 && !player->owner && chance(DMINE_HITCHANCE(mines))) { + if (sect.sct_type == SCT_WATER && mines > 0 + && chance(DMINE_HITCHANCE(mines))) { wu(0, sp->shp_own, "%s %s,\nand hit a mine in %s while retreating!\n", prship(sp), conditions[findcondition(code)].desc[orig], -- 2.43.0