Author: sveinung
Date: Sun Jul 24 05:22:48 2016
New Revision: 33307

URL: http://svn.gna.org/viewcvs/freeciv?rev=33307&view=rev
Log:
savegame2: tolerate a base becoming a pure extra.

Some extras doesn't naturally fit in as bases. Before 2.6 they still had to
be implemented as bases. It should therefore be expected that some rulesets
will drop the base part of an extra. 3.0 has already done this for Ruins.

Relax the restriction that the number of bases in a save file must be lesser
than or equal to the number of bases in the ruleset by giving an exception
to the rule if all bases in the save file are defined as extras.

See patch #7493

Modified:
    trunk/server/savegame2.c

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=33307&r1=33306&r2=33307&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Sun Jul 24 05:22:48 2016
@@ -1272,15 +1272,16 @@
     sg_failure_ret(loading->base.size != 0,
                    "Failed to load bases order: %s",
                    secfile_error());
-    sg_failure_ret(!(game.control.num_base_types < loading->base.size),
-                   "Number of bases defined by the ruleset (= %d) are "
-                   "lower than the number in the savefile (= %d).",
-                   game.control.num_base_types, (int)loading->base.size);
     /* make sure that the size of the array is divisible by 4 */
     nmod = 4 * ((loading->base.size + 3) / 4);
     loading->base.order = fc_calloc(nmod, sizeof(*loading->base.order));
     for (j = 0; j < loading->base.size; j++) {
       struct extra_type *pextra = extra_type_by_rule_name(modname[j]);
+
+      sg_failure_ret(pextra != NULL
+                     || game.control.num_base_types >= loading->base.size,
+                     "Unknown base type %s in savefile.",
+                     modname[j]);
 
       if (pextra != NULL) {
         loading->base.order[j] = extra_base_get(pextra);


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

Reply via email to