]> git.pond.sub.org Git - empserver/commitdiff
init ef_verify: Don't monkey-patch capability VTOL, require it
authorMarkus Armbruster <armbru@pond.sub.org>
Sat, 21 Feb 2015 17:56:32 +0000 (18:56 +0100)
committerMarkus Armbruster <armbru@pond.sub.org>
Mon, 2 Mar 2015 07:20:52 +0000 (08:20 +0100)
A plane with capability missile must have capability VTOL.  When it's
missing, global_init() silently adds it.

Drop that.  Check for it in ef_verify_config() instead.

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

index ad62de5b2f8e9d6f33f6a887cd1d67889d4ac185..dfcacd4a88a4b55518eb79ab45def0c13e1d039c 100644 (file)
@@ -340,6 +340,26 @@ verify_ship_chr(void)
     return retval;
 }
 
+static int
+verify_plane_chr(void)
+{
+    int retval = 0;
+    int i;
+
+    for (i = 0; plchr[i].pl_name; i++) {
+       if (!plchr[i].pl_name[0])
+           continue;
+       if ((plchr[i].pl_flags & (P_M | P_V)) == P_M) {
+           verify_fail(EF_PLANE_CHR, i, NULL, 0,
+                       "flag %s requires flag %s",
+                       symbol_by_value(P_M, plane_chr_flags),
+                       symbol_by_value(P_V, plane_chr_flags));
+           retval = -1;
+       }
+    }
+    return retval;
+}
+
 static int
 verify_products(void)
 {
@@ -377,6 +397,7 @@ ef_verify_config(void)
 
     /* Special checks */
     retval |= verify_ship_chr();
+    retval |= verify_plane_chr();
     retval |= verify_products();
     return retval;
 }
index 736942483205a7517c57888e9d931c1bd4330d06..fb17a10be4416b8119afd82417c0dd37a22616ba 100644 (file)
@@ -41,7 +41,6 @@
 #include "ship.h"
 
 static void init_pchr(void);
-static void init_plchr(void);
 
 void
 global_init(void)
@@ -49,20 +48,6 @@ global_init(void)
     if (opt_RAILWAYS)
        intrchr[INT_RAIL].in_enable = 0;
     init_pchr();
-    init_plchr();
-}
-
-static void
-init_plchr(void)
-{
-    struct plchrstr *pp;
-
-    for (pp = plchr; pp->pl_name; pp++) {
-       if (!pp->pl_name[0])
-           continue;
-       if (pp->pl_flags & P_M)
-           pp->pl_flags |= P_V;
-    }
 }
 
 static void