]> git.pond.sub.org Git - empserver/commitdiff
assault: Handle the "only spies" special case earlier
authorMarkus Armbruster <armbru@pond.sub.org>
Sun, 24 Jul 2016 06:03:35 +0000 (08:03 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:18 +0000 (20:09 +0200)
Since the previous commit, sneak_ashore() doesn't depend on a previous
get_oland() anymore, so the att_get_offense() is unnecessarily.  Move
it across att_get_offense() next to the other special case "assault
own sector".

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

index e2d0a23bd5d07c79cbccb4f704316576f31af7b3..d1e60d979aa8ce623388935f7a84c238d3a31439 100644 (file)
@@ -119,6 +119,12 @@ assa(void)
        return RET_OK;
     }
 
+    /* If only spies assault, try to sneak them ashore */
+    if (only_spies(off, &olist)) {
+       sneak_ashore(off, &olist, def);
+       return RET_OK;
+    }
+
     ototal = att_get_offense(A_ASSAULT, off, &olist, def);
     if (att_abort(A_ASSAULT, off, def)) {
        pr("Assault aborted\n");
@@ -132,18 +138,6 @@ assa(void)
      * happening in the game.
      */
 
-    /* First, we check to see if the only thing we have are spies
-     * assaulting.  If so, we try to sneak them on land.  If they
-     * make it, the defenders don't see a thing.  If they fail, well,
-     * the spies die, and the defenders see them. */
-
-    /* If no attacking forces (i.e. we got here with only spies)
-     * then try to sneak on-land. */
-    if (only_spies(off, &olist)) {
-       sneak_ashore(off, &olist, def);
-       return RET_OK;
-    }
-
     /* Get the real defense */
 
     att_get_defense(&olist, def, &dlist, a_spy, ototal);