]> git.pond.sub.org Git - empserver/commitdiff
(payo, scuttle_tradeship, sdump): Disclose construction site only to
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 31 Jan 2004 10:03:49 +0000 (10:03 +0000)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 31 Jan 2004 10:03:49 +0000 (10:03 +0000)
original owner and deities.  Closes #815197.

info/Commands/payoff.t
src/lib/commands/payo.c
src/lib/commands/scut.c
src/lib/commands/sdump.c

index 134371c8be57ce75b62b5e37ebfce3cc27578052..a20ecb43175e39158fba979e047253f52196031f 100644 (file)
@@ -2,8 +2,10 @@
 .NA payoff "Find out the current payoff of a trade ship"
 .LV Expert
 .SY "payoff [<SHIP/FLEET> | <SECTS>]"
-The payoff command gives a census of your trade ships, and lists
-the payoff they would give if scuttled at the current sector.
+The payoff command gives a census of your trade ships, and lists the
+payoff they would give if scuttled at the current sector.  Payoff can
+only be calculated for trade ships you built yourself, not for ships
+you `acquired' from somebody else.
 .s1
 The <SHIP/FLEET> and <SECTS> arguments are provided in case you only
 wish to look at one ship
index 9b1c8c532358dad229d9ffce029d5951ecdd47fa..357154d0cbf48ff870c9aaa82ea91840da5e2617 100644 (file)
@@ -92,11 +92,16 @@ payo(void)
            pr("%3d ", ship.shp_own);
        pr("%4d ", ni.cur);
        pr("%-16.16s ", mchr[(int)ship.shp_type].m_name);
+       if (ship.shp_own != ship.shp_orig_own && !player->god) {
+           /* Don't disclose construction site to pirates! */
+           pr("    ?     ");
+           prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
+           pr("   ? $  ?\n");
+           continue;
+       }
        prxy("%4d,%-4d ", ship.shp_orig_x, ship.shp_orig_y, player->cnum);
        prxy("%4d,%-4d ", ship.shp_x, ship.shp_y, player->cnum);
 
-       getsect(ship.shp_x, ship.shp_y, &sect);
-
        dist = mapdist(ship.shp_x, ship.shp_y,
                       ship.shp_orig_x, ship.shp_orig_y);
        pr("%4d ", dist);
index 870dce735a57d8df7a3c9d769182e1e9d2dfe3cb..24f799d1e06694f6efa1a007c39e687be603a637 100644 (file)
@@ -80,10 +80,14 @@ scuttle_tradeship(struct shpstr *sp, int interactive)
     if (sect.sct_own && sect.sct_type == SCT_HARBR) {
        dist = mapdist(sp->shp_x, sp->shp_y,
                       sp->shp_orig_x, sp->shp_orig_y);
-       if (interactive)
-           pr("%s has gone %d sects\n", prship(sp), dist);
-       else
-           wu(0, sp->shp_own, "%s has gone %d sects\n", prship(sp), dist);
+       /* Don't disclose distance to to pirates */
+       if (sp->shp_own == sp->shp_orig_own) {
+           if (interactive)
+               pr("%s has gone %d sects\n", prship(sp), dist);
+           else
+               wu(0, sp->shp_own, "%s has gone %d sects\n",
+                  prship(sp), dist);
+       }
        if (dist < trade_1_dist)
            cash = 0;
        else if (dist < trade_2_dist)
@@ -110,7 +114,7 @@ scuttle_tradeship(struct shpstr *sp, int interactive)
        wu(0, sp->shp_own, "Unfortunately, you make $0 on this trade.\n");
     } else if (cash && interactive) {
        player->dolcost -= cash;
-    } else if (interactive) {
+    } else if (interactive && sp->shp_own == sp->shp_orig_own) {
        pr("You won't get any money if you scuttle in %s!",
           xyas(sp->shp_x, sp->shp_y, player->cnum));
        sprintf(buf, "Are you sure you want to scuttle %s? ", prship(sp));
index 97ca3708d9c208929c2766ea633a4832261fe47e..d1145d4b70a0e009ef17ad6bbbb00f66fe895ae9 100644 (file)
@@ -384,10 +384,23 @@ sdump(void)
                pr(" %d", ship.shp_glim);
                break;
            case 32:
-               pr(" %d", xrel(np, ship.shp_orig_x));
+               /*
+                * Disclosing construction site allows pirates to find
+                * harbors.  Disclose it only to the original owner
+                * and to deities.  Else dump illegal coordinates
+                * 1,0
+                */
+               if (ship.shp_own == ship.shp_orig_own || player->god)
+                   pr(" %d", xrel(np, ship.shp_orig_x));
+               else
+                   pr(" 1");
                break;
            case 33:
-               pr(" %d", yrel(np, ship.shp_orig_y));
+               /* see case 32 */
+               if (ship.shp_own == ship.shp_orig_own || player->god)
+                   pr(" %d", yrel(np, ship.shp_orig_y));
+               else
+                   pr(" 0");
                break;
            case 34:
                pr(" %c%s%c", '"', ship.shp_name, '"');