torpedo: Don't disclose uid, type, owner of torpedoed subs

torp() reports target uid and type to the player.  Hide for submarine
targets, just like we hide attacking submarine details in bulletins to
the target's owner.

torp() and fire_torp() leak submarine owners through the news.
Suppress news for submarine targets.  This is consistent with fire:
mfir() doesn't report depth-charging, and quiet_bigdef() doesn't
report return torpedoes.

Historical note: the code has always hidden submarine uid, type and
owner in places, and leaked them in others.  When capability sub-torp
was added in Chainsaw, no attention was paid to hiding.  When Empire 2
hid attacking submarines, it did nothing for submarine targets.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-01-11 17:50:09 +01:00
parent 2bfc574943
commit 7b8700fe00

View file

@ -178,17 +178,19 @@ torp(void)
wu(0, vshipown, "%s in %s torpedoed %s for %d damage.\n", wu(0, vshipown, "%s in %s torpedoed %s for %d damage.\n",
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", prship(&vship), dam); pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam);
shipdamage(&vship, dam); shipdamage(&vship, dam);
if (vship.shp_effic < SHIP_MINEFF) if (vship.shp_effic < SHIP_MINEFF)
pr("%s sunk!\n", prship(&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[(int)sub.shp_type].m_flags & M_SUB) if (!(mchr[vship.shp_type].m_flags & M_SUB)) {
nreport(vshipown, N_TORP_SHIP, 0, 1); if (mchr[(int)sub.shp_type].m_flags & M_SUB)
else nreport(vshipown, N_TORP_SHIP, 0, 1);
nreport(vshipown, N_SHIP_TORP, player->cnum, 1); else
nreport(vshipown, N_SHIP_TORP, player->cnum, 1);
}
} else { } else {
pr("Missed\n"); pr("Missed\n");
if (vshipown != 0) if (vshipown != 0)
@ -312,10 +314,12 @@ 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[(int)sp->shp_type].m_flags & M_SUB) if (!(mchr[targ->shp_type].m_flags & M_SUB)) {
nreport(targ->shp_own, N_TORP_SHIP, 0, 1); if (mchr[(int)sp->shp_type].m_flags & M_SUB)
else nreport(targ->shp_own, N_TORP_SHIP, 0, 1);
nreport(targ->shp_own, N_SHIP_TORP, sp->shp_own, 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)