From 9b97d68bb36dbbc52fcb90eff76caeedc14bd440 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Sun, 24 Jul 2016 08:03:35 +0200 Subject: [PATCH] assault: Handle the "only spies" special case earlier 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 --- src/lib/commands/assa.c | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/src/lib/commands/assa.c b/src/lib/commands/assa.c index e2d0a23b..d1e60d97 100644 --- a/src/lib/commands/assa.c +++ b/src/lib/commands/assa.c @@ -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);