Author: cazfi
Date: Sun Feb 28 12:49:46 2016
New Revision: 32110

URL: http://svn.gna.org/viewcvs/freeciv?rev=32110&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:
    branches/S2_6/doc/README.rulesets
    branches/S2_6/server/rssanity.c

Modified: branches/S2_6/doc/README.rulesets
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/README.rulesets?rev=32110&r1=32109&r2=32110&view=diff
==============================================================================
--- branches/S2_6/doc/README.rulesets   (original)
+++ branches/S2_6/doc/README.rulesets   Sun Feb 28 12:49:46 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: branches/S2_6/server/rssanity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/rssanity.c?rev=32110&r1=32109&r2=32110&view=diff
==============================================================================
--- branches/S2_6/server/rssanity.c     (original)
+++ branches/S2_6/server/rssanity.c     Sun Feb 28 12:49:46 2016
@@ -543,6 +543,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;
@@ -597,6 +598,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;
@@ -656,6 +666,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