From 66165f34cb4df93ec9d4d87ef7ee4cc12dcb21f2 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 4 May 2008 16:44:26 +0200 Subject: [PATCH] Fix fire command to detect when the firing object changes multifire() failed to take into account that the firing firing sector, ship or land unit can change while it is getting the target argument. It thus clobbered any updates made to the firing object while it was sleeping for the target argument. Abusable. Broken when Chainsaw introduced MULTIFIRE. --- src/lib/commands/mfir.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index 4d3fd893..58542b49 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -253,6 +253,8 @@ multifire(void) y = vsect.sct_y; } if (type == EF_SHIP) { + if (!check_ship_ok(&fship)) + return RET_FAIL; if (fship.shp_own != player->cnum) { pr("Not your ship!\n"); continue; @@ -305,6 +307,8 @@ multifire(void) putship(fship.shp_uid, &fship); } } else if (type == EF_LAND) { + if (!check_land_ok(&fland)) + return RET_FAIL; if (fland.lnd_own != player->cnum) { pr("Not your unit!\n"); continue; @@ -349,6 +353,8 @@ multifire(void) dam = ldround(dam / 2.0, 1); } } else { + if (!check_sect_ok(&fsect)) + return RET_FAIL; fx = fsect.sct_x; fy = fsect.sct_y; if (fsect.sct_own != player->cnum ||