From 7b8700fe009d8ddc1574467baff1e271acf69c5d Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 11 Jan 2015 17:50:09 +0100 Subject: [PATCH] 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 --- src/lib/commands/torp.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/src/lib/commands/torp.c b/src/lib/commands/torp.c index 6b01b7195..f6a7355b4 100644 --- a/src/lib/commands/torp.c +++ b/src/lib/commands/torp.c @@ -178,17 +178,19 @@ 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); - 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); if (vship.shp_effic < SHIP_MINEFF) - pr("%s sunk!\n", prship(&vship)); + pr("%s sunk!\n", prsub(&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); - else - nreport(vshipown, N_SHIP_TORP, player->cnum, 1); + 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 { pr("Missed\n"); if (vshipown != 0) @@ -312,10 +314,12 @@ fire_torp(struct shpstr *sp, struct shpstr *targ, int ntargets) shipdamage(targ, dam); putship(targ->shp_uid, targ); - 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); + 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 { pr("Missed!\n"); if (sp->shp_own != 0) -- 2.43.0