Author: cazfi
Date: Sun Feb 14 09:27:16 2016
New Revision: 31908

URL: http://svn.gna.org/viewcvs/freeciv?rev=31908&view=rev
Log:
Load Goods names in the ruleset names loading round.

See patch #6909

Modified:
    trunk/server/ruleset.c

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=31908&r1=31907&r2=31908&view=diff
==============================================================================
--- trunk/server/ruleset.c      (original)
+++ trunk/server/ruleset.c      Sun Feb 14 09:27:16 2016
@@ -1040,6 +1040,40 @@
   }
 
   section_list_destroy(sec);
+
+  if (ok) {
+    sec = secfile_sections_by_name_prefix(file, GOODS_SECTION_PREFIX);
+
+    nval = (NULL != sec ? section_list_size(sec) : 0);
+    if (nval > MAX_GOODS_TYPES) {
+      int num = nval; /* No "size_t" to printf */
+
+      ruleset_error(LOG_ERROR, "\"%s\": Too many goods types (%d, max %d)",
+                    filename, num, MAX_GOODS_TYPES);
+      section_list_destroy(sec);
+      ok = FALSE;
+    } else if (nval < 1) {
+      ruleset_error(LOG_ERROR, "\"%s\": At least one goods type needed",
+                    filename);
+      section_list_destroy(sec);
+      ok = FALSE;
+    } else {
+      game.control.num_goods_types = nval;
+    }
+
+    if (ok) {
+      goods_type_iterate(pgood) {
+        const char *sec_name = section_name(section_list_get(sec, 
goods_index(pgood)));
+
+        if (!ruleset_load_names(&pgood->name, NULL, file, sec_name)) {
+          ruleset_error(LOG_ERROR, "\"%s\": Cannot load goods names",
+                        filename);
+          ok = FALSE;
+          break;
+        }
+      } goods_type_iterate_end;
+    }
+  }
 
   return ok;
 }
@@ -6183,36 +6217,11 @@
   } else {
     if (ok) {
       sec = secfile_sections_by_name_prefix(file, GOODS_SECTION_PREFIX);
-      nval = (NULL != sec ? section_list_size(sec) : 0);
-      if (nval > MAX_GOODS_TYPES) {
-        int num = nval; /* No "size_t" to printf */
-
-        ruleset_error(LOG_ERROR, "\"%s\": Too many goods types (%d, max %d)",
-                      filename, num, MAX_GOODS_TYPES);
-        section_list_destroy(sec);
-        ok = FALSE;
-      } else if (nval < 1) {
-        ruleset_error(LOG_ERROR, "\"%s\": At least one goods type needed",
-                      filename);
-        section_list_destroy(sec);
-        ok = FALSE;
-      } else {
-        game.control.num_goods_types = nval;
-      }
-    }
-
-    if (ok) {
+
       goods_type_iterate(pgood) {
         int id = goods_index(pgood);
         const char *sec_name = section_name(section_list_get(sec, id));
         struct requirement_vector *reqs;
-
-        if (!ruleset_load_names(&pgood->name, NULL, file, sec_name)) {
-          ruleset_error(LOG_ERROR, "\"%s\": Cannot load goods names",
-                        filename);
-          ok = FALSE;
-          break;
-        }
 
         reqs = lookup_req_list(file, compat, sec_name, "reqs", 
goods_rule_name(pgood));
         if (reqs == NULL) {


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

Reply via email to