]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/scut.c
Require friendly relations for trade ship to pay off
[empserver] / src / lib / commands / scut.c
index 0446ed7f526e02d4160a36908cf4c67f080f85a6..f5adb17aa1f914323ba60bda87b974f4fde2f090 100644 (file)
@@ -165,17 +165,13 @@ scuttle_tradeship(struct shpstr *sp, int interactive)
 
     mp = &mchr[(int)sp->shp_type];
     getsect(sp->shp_x, sp->shp_y, &sect);
-    if (sect.sct_own && sect.sct_type == SCT_HARBR && sect.sct_effic >= 2) {
+    if (sect.sct_own && sect.sct_type == SCT_HARBR && sect.sct_effic >= 2
+       && getrel(getnatp(sect.sct_own), sp->shp_own) >= FRIENDLY) {
        dist = mapdist(sp->shp_x, sp->shp_y,
                       sp->shp_orig_x, sp->shp_orig_y);
        /* 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 (sp->shp_own == sp->shp_orig_own)
+           mpr(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)
@@ -193,20 +189,23 @@ scuttle_tradeship(struct shpstr *sp, int interactive)
        }
     }
 
-    if (!interactive && cash) {
+    if (!cash && (dist < 0 || sp->shp_own == sp->shp_orig_own)) {
+       if (interactive) {
+           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));
+           return confirm(buf);
+       } else
+           return 0;
+    }
+
+    if (interactive) {
+       player->dolcost -= cash;
+    } else {
        natp = getnatp(sp->shp_own);
        natp->nat_money += cash;
        putnat(natp);
        wu(0, sp->shp_own, "You just made $%d.\n", (int)cash);
-    } else if (!cash && !interactive) {
-       wu(0, sp->shp_own, "Unfortunately, you make $0 on this trade.\n");
-    } else if (cash && interactive) {
-       player->dolcost -= cash;
-    } else if (interactive && (dist < 0 || 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));
-       return confirm(buf);
     }
 
     if (ally_cash) {