]> git.pond.sub.org Git - empserver/commitdiff
ef_verify: Require land unit milit == 0 with capability spy
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 23 Jul 2016 07:26:44 +0000 (09:26 +0200)
committerMarkus Armbruster <armbru@pond.sub.org>
Sun, 6 Aug 2017 18:09:18 +0000 (20:09 +0200)
The rules for spy units make little sense unless spies carry no
military.  For instance, spies die when they take casualties in ground
combat.  There seems to be a tacit assumption that spies have no
military.  I don't trust the code to behave unless this assumption is
met.  Require it before an overly adventurous deity finds out the
painful way that spies with military don't work.

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

index 7ab03183950e362010749aaa64bcf95822133d15..9b878cbc58eb97f894c0c84bf8362e6db6e90dfb 100644 (file)
@@ -358,6 +358,24 @@ verify_plane_chr(void)
     return retval;
 }
 
+static int
+verify_land_chr(void)
+{
+    int retval = 0;
+    int i;
+
+    for (i = 0; lchr[i].l_name; i++) {
+       if (!lchr[i].l_name[0])
+           continue;
+       if ((lchr[i].l_flags & L_SPY) && lchr[i].l_item[I_MILIT]) {
+           verify_fail(EF_PLANE_CHR, i, NULL, 0,
+                       "flag %s requires zero milit",
+                       symbol_by_value(L_SPY, land_chr_flags));
+           retval = -1;
+       }
+    }
+    return retval;
+}
 static int
 verify_products(void)
 {
@@ -395,6 +413,7 @@ ef_verify_config(void)
     /* Special checks */
     retval |= verify_ship_chr();
     retval |= verify_plane_chr();
+    retval |= verify_land_chr();
     retval |= verify_products();
     return retval;
 }