Revert "Permit ships that can drop depth charges, but not fire"
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 8 Feb 2015 11:38:55 +0000 (12:38 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 2 Mar 2015 07:20:52 +0000 (08:20 +0100)
This reverts commit 9b0b0dc7729b7fadc09d5769cc1128341b3c3d33.

The fire command drops depth charges when the target is a submarine in
range and firing ship has the capability.  Else, it blindly fires
guns.  It used to reject ships that can't use guns, even when they
could use depth charges, but commit 9b0b0dc (v4.3.31) lifted that
restruction.  No such ships exist in the stock game.

If the firing ship can't fire guns, shp_fire() returns -1, triggering
an oops.  Broken in commit 0757042.

Avoiding dependence of depth charge on gun fire capability is
pleasing, but nevertheless a bad idea without test coverage.  Creating
the necessary tests isn't worth it, so put back the traditional
restriction instead.

Signed-off-by: Markus Armbruster <armbru@pond.sub.org>
src/lib/commands/mfir.c

index 527dba16b15ccdb9349bfe62229f423568ffb2d5..e679074efa7c3b0d9fcd79c1717acda762f9368f 100644 (file)
@@ -170,8 +170,7 @@ multifire(void)
                pr("Not enough mil on ship #%d\n", item.ship.shp_uid);
                continue;
            }
-           if (mchr[item.ship.shp_type].m_glim == 0
-               && !(mchr[fship.shp_type].m_flags & M_DCH)) {
+           if (mchr[item.ship.shp_type].m_glim == 0) {
                pr("Ships %d cannot fire guns!\n", item.ship.shp_uid);
                continue;
            }