torpedo: Fix news on owner of ships sunk by return torpedoes
fire_torp() reads targ->shp_own after putship(). If targ sank, its owner is POGO by then. Screwed up when return torpedoes were added in Chainsaw. Fix by reporting news before putship(). torp() is correct, because it gets the owner from a local variable. Change it like fire_torp() anyway. Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
parent
7b8700fe00
commit
8348ce421c
1 changed files with 12 additions and 12 deletions
|
@ -179,18 +179,18 @@ torp(void)
|
||||||
prsub(&sub), xyas(sub.shp_x, sub.shp_y, vshipown),
|
prsub(&sub), xyas(sub.shp_x, sub.shp_y, vshipown),
|
||||||
prship(&vship), dam);
|
prship(&vship), dam);
|
||||||
pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam);
|
pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam);
|
||||||
|
if (!(mchr[vship.shp_type].m_flags & M_SUB)) {
|
||||||
|
if (mchr[sub.shp_type].m_flags & M_SUB)
|
||||||
|
nreport(vshipown, N_TORP_SHIP, 0, 1);
|
||||||
|
else
|
||||||
|
nreport(vshipown, N_SHIP_TORP, player->cnum, 1);
|
||||||
|
}
|
||||||
shipdamage(&vship, dam);
|
shipdamage(&vship, dam);
|
||||||
if (vship.shp_effic < SHIP_MINEFF)
|
if (vship.shp_effic < SHIP_MINEFF)
|
||||||
pr("%s sunk!\n", prsub(&vship));
|
pr("%s sunk!\n", prsub(&vship));
|
||||||
if (vship.shp_rflags & RET_TORPED)
|
if (vship.shp_rflags & RET_TORPED)
|
||||||
retreat_ship(&vship, 't');
|
retreat_ship(&vship, 't');
|
||||||
putship(vship.shp_uid, &vship);
|
putship(vship.shp_uid, &vship);
|
||||||
if (!(mchr[vship.shp_type].m_flags & M_SUB)) {
|
|
||||||
if (mchr[(int)sub.shp_type].m_flags & M_SUB)
|
|
||||||
nreport(vshipown, N_TORP_SHIP, 0, 1);
|
|
||||||
else
|
|
||||||
nreport(vshipown, N_SHIP_TORP, player->cnum, 1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
pr("Missed\n");
|
pr("Missed\n");
|
||||||
if (vshipown != 0)
|
if (vshipown != 0)
|
||||||
|
@ -304,6 +304,12 @@ fire_torp(struct shpstr *sp, struct shpstr *targ, int ntargets)
|
||||||
|
|
||||||
if (chance(shp_torp_hitchance(sp, range))) {
|
if (chance(shp_torp_hitchance(sp, range))) {
|
||||||
pr("BOOM!...\n");
|
pr("BOOM!...\n");
|
||||||
|
if (!(mchr[targ->shp_type].m_flags & M_SUB)) {
|
||||||
|
if (mchr[sp->shp_type].m_flags & M_SUB)
|
||||||
|
nreport(targ->shp_own, N_TORP_SHIP, 0, 1);
|
||||||
|
else
|
||||||
|
nreport(targ->shp_own, N_SHIP_TORP, sp->shp_own, 1);
|
||||||
|
}
|
||||||
if (sp->shp_own != 0)
|
if (sp->shp_own != 0)
|
||||||
wu(0, sp->shp_own, "%s @ %s torpedoed %s\n",
|
wu(0, sp->shp_own, "%s @ %s torpedoed %s\n",
|
||||||
prship(sp),
|
prship(sp),
|
||||||
|
@ -314,12 +320,6 @@ fire_torp(struct shpstr *sp, struct shpstr *targ, int ntargets)
|
||||||
shipdamage(targ, dam);
|
shipdamage(targ, dam);
|
||||||
putship(targ->shp_uid, targ);
|
putship(targ->shp_uid, targ);
|
||||||
|
|
||||||
if (!(mchr[targ->shp_type].m_flags & M_SUB)) {
|
|
||||||
if (mchr[(int)sp->shp_type].m_flags & M_SUB)
|
|
||||||
nreport(targ->shp_own, N_TORP_SHIP, 0, 1);
|
|
||||||
else
|
|
||||||
nreport(targ->shp_own, N_SHIP_TORP, sp->shp_own, 1);
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
pr("Missed!\n");
|
pr("Missed!\n");
|
||||||
if (sp->shp_own != 0)
|
if (sp->shp_own != 0)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue