Author: cazfi
Date: Sat Aug 15 19:56:46 2015
New Revision: 29523

URL: http://svn.gna.org/viewcvs/freeciv?rev=29523&view=rev
Log:
Sanity check improvement genus against its other properties.

See patch #6206

Modified:
    trunk/server/rssanity.c

Modified: trunk/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rssanity.c?rev=29523&r1=29522&r2=29523&view=diff
==============================================================================
--- trunk/server/rssanity.c     (original)
+++ trunk/server/rssanity.c     Sat Aug 15 19:56:46 2015
@@ -443,6 +443,31 @@
   return TRUE;
 }
 
+/**************************************************************************
+  Sanity check buildings
+**************************************************************************/
+static bool rs_buildings(void)
+{
+  /* Special Genus */
+  improvement_iterate(pimprove) {
+    if (improvement_has_flag(pimprove, IF_GOLD)
+        && pimprove->genus != IG_SPECIAL) {
+      ruleset_error(LOG_ERROR,
+                    "Gold producing improvement with genus other than 
\"Special\"");
+
+      return FALSE;
+    }
+    if (improvement_has_flag(pimprove, IF_DISASTER_PROOF)
+        && pimprove->genus != IG_IMPROVEMENT) {
+      ruleset_error(LOG_ERROR,
+                    "Disasterproof improvement with genus other than 
\"Improvement\"");
+
+      return FALSE;
+    }
+  } improvement_iterate_end;
+
+  return TRUE;
+}
 
 /**************************************************************************
   Check that boolean effect types have sensible effects.
@@ -886,6 +911,9 @@
   if (ok) {
     ok = rs_barbarian_units();
   }
+  if (ok) {
+    ok = rs_buildings();
+  }
 
   return ok;
 }


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to