torpedo fire: Reveal sub hit by return fire or depth charge

This partly reverts a change made in Empire 2.3 to tell a submarine's
opponent only that he's dealing with a "sub" instead of the
submarine's UID and type.  Hiding submarines is done by prsub().
Uses:

* Command torpedo: defender depth charges or torpedoes an attacking
  submarine

  If you can attack a submarine reactively, you should be able to
  attack it actively, too.  But that requires its UID.  Reveal it
  again, but keep the type hidden.

* Command fire: defender fires back at a submarine using its deck gun

  Submarines need to surface to fire deck guns, so they shouldn't be
  treated any different than surface ships.  Revert Empire 2.3's
  change entirely there, i.e. defender learns type as well as UID.

* Command torpedo: attacking submarine hits its target

  Keep the submarine hidden.

* Commands torpedo and fire: attacking ship hits a submarine

  The attacker passed the UID as command argument, so it doesn't
  matter whether we print it or not.  Printing it is simpler to code,
  so do that.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
This commit is contained in:
Markus Armbruster 2015-02-15 08:58:20 +01:00
parent 76214dbfbd
commit 17abdbc5e0
5 changed files with 27 additions and 26 deletions

View file

@ -178,7 +178,8 @@ torp(void)
pr("BOOM!...\n");
if (vshipown != 0)
wu(0, vshipown, "%s in %s torpedoed %s for %d damage.\n",
prsub(&sub), xyas(sub.shp_x, sub.shp_y, vshipown),
sub_mcp->m_flags & M_SUB ? "sub" : prship(&sub),
xyas(sub.shp_x, sub.shp_y, vshipown),
prship(&vship), dam);
pr("Torpedo hit %s for %d damage.\n", prsub(&vship), dam);
if (!(mchr[vship.shp_type].m_flags & M_SUB)) {
@ -338,7 +339,7 @@ char *
prsub(struct shpstr *sp)
{
if (mchr[(int)sp->shp_type].m_flags & M_SUB)
return "sub";
return prbuf("sub #%d", sp->shp_uid);
else
return prship(sp);
}