Author: cazfi
Date: Sun Feb 28 12:49:41 2016
New Revision: 32109

URL: http://svn.gna.org/viewcvs/freeciv?rev=32109&view=rev
Log:
Sanity check ruleset against using revolution-time government form as initial 
government
for any nation.

Reported by Frank <dunnoob>

See bug #24459

Modified:
    trunk/doc/README.rulesets
    trunk/server/rssanity.c

Modified: trunk/doc/README.rulesets
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.rulesets?rev=32109&r1=32108&r2=32109&view=diff
==============================================================================
--- trunk/doc/README.rulesets   (original)
+++ trunk/doc/README.rulesets   Sun Feb 28 12:49:41 2016
@@ -97,6 +97,13 @@
       - "BarbarianBoat"    (Must be able to move at sea)
       - "BarbarianSea"
 
+nations.ruleset
+
+  Restrictions:
+
+    - Government used during revolution can't be used as default_government
+      or init_government for any nation
+
 ----------------------------------------------------------------------
 Implementation details:
 -----------------------

Modified: trunk/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/rssanity.c?rev=32109&r1=32108&r2=32109&view=diff
==============================================================================
--- trunk/server/rssanity.c     (original)
+++ trunk/server/rssanity.c     Sun Feb 28 12:49:41 2016
@@ -563,6 +563,7 @@
   bool ok = TRUE; /* Store failures to variable instead of returning
                    * immediately so all errors get printed, not just first
                    * one. */
+  bool default_gov_failed = FALSE;
 
   if (!sanity_check_metadata()) {
     ok = FALSE;
@@ -643,6 +644,15 @@
     }
   } advance_iterate_end;
 
+  if (game.server.default_government == game.government_during_revolution) {
+    ruleset_error(LOG_ERROR,
+                  "The government form %s reserved for revolution handling has 
been set as "
+                  "default_government.",
+                  government_rule_name(game.government_during_revolution));
+    ok = FALSE;
+    default_gov_failed = TRUE;
+  }
+
   /* Check that all players can have their initial techs */
   nations_iterate(pnation) {
     int techi;
@@ -702,6 +712,15 @@
       ruleset_error(LOG_ERROR,
                     "Barbarian nation %s has init_buildings set but will "
                     "never see them", nation_rule_name(pnation));
+    }
+
+    if (!default_gov_failed && pnation->init_government == 
game.government_during_revolution) {
+      ruleset_error(LOG_ERROR,
+                    "The government form %s reserved for revolution handling 
has been set as "
+                    "initial government for %s.",
+                    government_rule_name(game.government_during_revolution),
+                    nation_rule_name(pnation));
+      ok = FALSE;
     }
   } nations_iterate_end;
 


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

Reply via email to