]> git.pond.sub.org Git - empserver/commitdiff
Fix scuttle_it()'s "is a trade ship" sanity check
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 22 May 2011 10:40:07 +0000 (12:40 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sat, 25 Jun 2011 14:51:56 +0000 (16:51 +0200)
Only trade ships can be auto-scuttled.  orde() rejects scuttle orders
for other ships.  scuttle_it() double-checks, but gets the test wrong:
it rejects only when opt_TRADESHIPS is enabled.  Fix that.  While
there, make it oops on inadmissible ships.

src/lib/update/nav_ship.c

index 9c1a7d52056a11dfa94b3af9a052cebcc3f8909b..20b8ba0bfb2d9f22bedf1d99bcc9c7f5ad576f0a 100644 (file)
@@ -53,12 +53,9 @@ scuttle_it(struct shpstr *sp)
           sp->shp_x, sp->shp_y, sp->shp_uid);
        return;
     }
-    if (opt_TRADESHIPS) {
-       if (!(mchr[(int)sp->shp_type].m_flags & M_TRADE)) {
-           wu(0, sp->shp_own, "You can only autoscuttle trade ships!\n");
-           return;
-       }
-    }
+    if (CANT_HAPPEN(!opt_TRADESHIPS
+                   || !(mchr[sp->shp_type].m_flags & M_TRADE)))
+       return;
     if (!scuttle_tradeship(sp, 0)) {
        wu(0, sp->shp_own,
           "%s doesn't pay here!  Not scuttled.\n", prship(sp));