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.
This commit is contained in:
parent
bf2fd6cb82
commit
66165f34cb
1 changed files with 6 additions and 0 deletions
|
@ -253,6 +253,8 @@ multifire(void)
|
||||||
y = vsect.sct_y;
|
y = vsect.sct_y;
|
||||||
}
|
}
|
||||||
if (type == EF_SHIP) {
|
if (type == EF_SHIP) {
|
||||||
|
if (!check_ship_ok(&fship))
|
||||||
|
return RET_FAIL;
|
||||||
if (fship.shp_own != player->cnum) {
|
if (fship.shp_own != player->cnum) {
|
||||||
pr("Not your ship!\n");
|
pr("Not your ship!\n");
|
||||||
continue;
|
continue;
|
||||||
|
@ -305,6 +307,8 @@ multifire(void)
|
||||||
putship(fship.shp_uid, &fship);
|
putship(fship.shp_uid, &fship);
|
||||||
}
|
}
|
||||||
} else if (type == EF_LAND) {
|
} else if (type == EF_LAND) {
|
||||||
|
if (!check_land_ok(&fland))
|
||||||
|
return RET_FAIL;
|
||||||
if (fland.lnd_own != player->cnum) {
|
if (fland.lnd_own != player->cnum) {
|
||||||
pr("Not your unit!\n");
|
pr("Not your unit!\n");
|
||||||
continue;
|
continue;
|
||||||
|
@ -349,6 +353,8 @@ multifire(void)
|
||||||
dam = ldround(dam / 2.0, 1);
|
dam = ldround(dam / 2.0, 1);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
if (!check_sect_ok(&fsect))
|
||||||
|
return RET_FAIL;
|
||||||
fx = fsect.sct_x;
|
fx = fsect.sct_x;
|
||||||
fy = fsect.sct_y;
|
fy = fsect.sct_y;
|
||||||
if (fsect.sct_own != player->cnum ||
|
if (fsect.sct_own != player->cnum ||
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue