bomb fire launch torpedo: Don't disclose ship sinking in retreat
These commands report "sunk!" even when the ship survives the attack but sinks during retreat. bomb even reports where on the retreat the ship sinks. Has been that way since retreat was added in Chainsaw. Report "sunk!" only when the attack sinks the ship directly. Similar code exists for land units, but it doesn't report killings. Change it anyway, to keep it consistent with the ship code. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
f9316f71c4
commit
2294785412
6 changed files with 28 additions and 59 deletions
|
@ -50,7 +50,5 @@
|
|||
|
||||
extern void retreat_ship(struct shpstr *, char);
|
||||
extern void retreat_land(struct lndstr *, char);
|
||||
extern int check_retreat_and_do_shipdamage(struct shpstr *, int);
|
||||
extern int check_retreat_and_do_landdamage(struct lndstr *, int);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* Dave Pare, 1986
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998-2000
|
||||
* Markus Armbruster, 2004-2012
|
||||
* Markus Armbruster, 2004-2015
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -476,17 +476,16 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
xyas(target->sct_x, target->sct_y, ship.shp_own));
|
||||
}
|
||||
pr("\n");
|
||||
check_retreat_and_do_shipdamage(&ship, dam);
|
||||
if (ship.shp_rflags & RET_BOMBED)
|
||||
if (((ship.shp_rflags & RET_INJURED) == 0) || !dam)
|
||||
retreat_ship(&ship, 'b');
|
||||
putship(ship.shp_uid, &ship);
|
||||
getship(ship.shp_uid, &ship);
|
||||
if (!ship.shp_own) {
|
||||
shipdamage(&ship, dam);
|
||||
if (ship.shp_effic < SHIP_MINEFF)
|
||||
pr("%s at %s sunk!\n",
|
||||
prship(&ship),
|
||||
xyas(target->sct_x, target->sct_y, player->cnum));
|
||||
}
|
||||
if (dam && (ship.shp_rflags & RET_INJURED))
|
||||
retreat_ship(&ship, 'i');
|
||||
else if (ship.shp_rflags & RET_BOMBED)
|
||||
retreat_ship(&ship, 'b');
|
||||
putship(ship.shp_uid, &ship);
|
||||
collateral_damage(target->sct_x, target->sct_y, dam / 2);
|
||||
}
|
||||
out:
|
||||
|
@ -678,10 +677,10 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
|
|||
own = land.lnd_own;
|
||||
mpr(own, "%s pinpoint bombing raid did %d damage to %s\n",
|
||||
cname(player->cnum), dam, prland(&land));
|
||||
check_retreat_and_do_landdamage(&land, dam);
|
||||
|
||||
if (land.lnd_rflags & RET_BOMBED)
|
||||
if (((land.lnd_rflags & RET_INJURED) == 0) || !dam)
|
||||
landdamage(&land, dam);
|
||||
if (dam && (land.lnd_rflags & RET_INJURED))
|
||||
retreat_land(&land, 'i');
|
||||
else if (land.lnd_rflags & RET_BOMBED)
|
||||
retreat_land(&land, 'b');
|
||||
nreport(player->cnum, N_UNIT_BOMB, own, 1);
|
||||
putland(land.lnd_uid, &land);
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
* Dave Pare, 1986
|
||||
* Ken Stevens, 1995
|
||||
* Steve McClure, 1998-2000
|
||||
* Markus Armbruster, 2005-2012
|
||||
* Markus Armbruster, 2005-2015
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -273,11 +273,12 @@ launch_missile(struct plnstr *pp)
|
|||
return RET_OK;
|
||||
}
|
||||
dam = pln_damage(pp, 'p', 1);
|
||||
check_retreat_and_do_shipdamage(&target_ship, dam);
|
||||
putship(target_ship.shp_uid, &target_ship);
|
||||
getship(target_ship.shp_uid, &target_ship);
|
||||
if (!target_ship.shp_own)
|
||||
shipdamage(&target_ship, dam);
|
||||
if (target_ship.shp_effic < SHIP_MINEFF)
|
||||
pr("%s sunk!\n", prship(&target_ship));
|
||||
if (dam && (target_ship.shp_rflags & RET_INJURED))
|
||||
retreat_ship(&target_ship, 'i');
|
||||
putship(target_ship.shp_uid, &target_ship);
|
||||
}
|
||||
return RET_OK;
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* Known contributors to this file:
|
||||
* Steve McClure, 2000
|
||||
* Markus Armbruster, 2004-2014
|
||||
* Markus Armbruster, 2004-2015
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
|
@ -423,16 +423,14 @@ multifire(void)
|
|||
break;
|
||||
default:
|
||||
getship(vshipno, &vship);
|
||||
check_retreat_and_do_shipdamage(&vship, dam);
|
||||
shipdamage(&vship, dam);
|
||||
if (vship.shp_effic < SHIP_MINEFF)
|
||||
pr("%s sunk!\n", prsub(&vship));
|
||||
else if (target == targ_sub
|
||||
&& (vship.shp_rflags & RET_DCHRGED)
|
||||
&& !(vship.shp_rflags & RET_INJURED))
|
||||
if (dam && (vship.shp_rflags & RET_INJURED))
|
||||
retreat_ship(&vship, 'i');
|
||||
else if (target == targ_sub && (vship.shp_rflags & RET_DCHRGED))
|
||||
retreat_ship(&vship, 'd');
|
||||
else if (totaldefdam == 0
|
||||
&& (vship.shp_rflags & RET_HELPLESS)
|
||||
&& !(vship.shp_rflags & RET_INJURED))
|
||||
else if (totaldefdam == 0 && (vship.shp_rflags & RET_HELPLESS))
|
||||
retreat_ship(&vship, 'h');
|
||||
putship(vship.shp_uid, &vship);
|
||||
break;
|
||||
|
|
|
@ -178,13 +178,12 @@ torp(void)
|
|||
wu(0, vshipown, "%s in %s torpedoed %s for %d damage.\n",
|
||||
prsub(&sub), xyas(sub.shp_x, sub.shp_y, vshipown),
|
||||
prship(&vship), dam);
|
||||
shipdamage(&vship, dam);
|
||||
if (vship.shp_rflags & RET_TORPED)
|
||||
retreat_ship(&vship, 't');
|
||||
pr("Torpedo hit %s for %d damage.\n", prship(&vship), dam);
|
||||
|
||||
shipdamage(&vship, dam);
|
||||
if (vship.shp_effic < SHIP_MINEFF)
|
||||
pr("%s sunk!\n", prship(&vship));
|
||||
if (vship.shp_rflags & RET_TORPED)
|
||||
retreat_ship(&vship, 't');
|
||||
putship(vship.shp_uid, &vship);
|
||||
if (mchr[(int)sub.shp_type].m_flags & M_SUB)
|
||||
nreport(vshipown, N_TORP_SHIP, 0, 1);
|
||||
|
|
|
@ -78,19 +78,6 @@ static struct ccode conditions[] = {
|
|||
{ 0, { "panicked", "panicked"} }
|
||||
};
|
||||
|
||||
int
|
||||
check_retreat_and_do_shipdamage(struct shpstr *sp, int dam)
|
||||
{
|
||||
if (dam <= 0)
|
||||
return 0;
|
||||
|
||||
shipdamage(sp, dam);
|
||||
if (sp->shp_rflags & RET_INJURED)
|
||||
retreat_ship(sp, 'i');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
retreat_ship(struct shpstr *sp, char code)
|
||||
{
|
||||
|
@ -281,19 +268,6 @@ findcondition(char code)
|
|||
return i;
|
||||
}
|
||||
|
||||
int
|
||||
check_retreat_and_do_landdamage(struct lndstr *lp, int dam)
|
||||
{
|
||||
if (dam <= 0)
|
||||
return 0;
|
||||
|
||||
landdamage(lp, dam);
|
||||
if (lp->lnd_rflags & RET_INJURED)
|
||||
retreat_land(lp, 'i');
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
void
|
||||
retreat_land(struct lndstr *lp, char code)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue