Author: cazfi
Date: Sat Jan  7 22:11:28 2017
New Revision: 34797

URL: http://svn.gna.org/viewcvs/freeciv?rev=34797&view=rev
Log:
Added parameter telling if savegame is savegame2 or savegame3 to
compat conversion functions.

See patch #8065

Modified:
    trunk/server/savecompat.c
    trunk/server/savecompat.h
    trunk/server/savegame2.c
    trunk/server/savegame3.c

Modified: trunk/server/savecompat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.c?rev=34797&r1=34796&r2=34797&view=diff
==============================================================================
--- trunk/server/savecompat.c   (original)
+++ trunk/server/savecompat.c   Sat Jan  7 22:11:28 2017
@@ -68,17 +68,17 @@
           |                                                |            |
 */
 
-static void compat_load_020400(struct loaddata *loading);
-static void compat_load_020500(struct loaddata *loading);
-static void compat_load_020600(struct loaddata *loading);
-static void compat_load_030000(struct loaddata *loading);
-static void compat_load_030100(struct loaddata *loading);
+static void compat_load_020400(struct loaddata *loading, enum sgf_version 
format_class);
+static void compat_load_020500(struct loaddata *loading, enum sgf_version 
format_class);
+static void compat_load_020600(struct loaddata *loading, enum sgf_version 
format_class);
+static void compat_load_030000(struct loaddata *loading, enum sgf_version 
format_class);
+static void compat_load_030100(struct loaddata *loading, enum sgf_version 
format_class);
 
 #ifdef FREECIV_DEV_SAVE_COMPAT
 static void compat_load_dev(struct loaddata *loading);
 #endif /* FREECIV_DEV_SAVE_COMPAT */
 
-typedef void (*load_version_func_t) (struct loaddata *loading);
+typedef void (*load_version_func_t) (struct loaddata *loading, enum 
sgf_version format_class);
 
 struct compatibility {
   int version;
@@ -128,7 +128,7 @@
   loading->file should be change such, that the current loading functions can
   be executed without errors.
 ****************************************************************************/
-void sg_load_compat(struct loaddata *loading)
+void sg_load_compat(struct loaddata *loading, enum sgf_version format_class)
 {
   int i;
 
@@ -158,7 +158,7 @@
       log_normal(_("Run compatibility function for version: <%d "
                    "(save file: %d; server: %d)."), compat[i].version,
                  loading->version, compat[compat_current].version);
-      compat[i].load(loading);
+      compat[i].load(loading, format_class);
     }
   }
 
@@ -273,7 +273,8 @@
 /****************************************************************************
   Translate savegame secfile data from 2.3.x to 2.4.0 format.
 ****************************************************************************/
-static void compat_load_020400(struct loaddata *loading)
+static void compat_load_020400(struct loaddata *loading,
+                               enum sgf_version format_class)
 {
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();
@@ -502,7 +503,8 @@
 /****************************************************************************
   Translate savegame secfile data from 2.4.x to 2.5.0 format.
 ****************************************************************************/
-static void compat_load_020500(struct loaddata *loading)
+static void compat_load_020500(struct loaddata *loading,
+                               enum sgf_version format_class)
 {
   const char *modname[] = { "Road", "Railroad" };
   const char *old_activities_names[] = {
@@ -627,7 +629,8 @@
 /****************************************************************************
   Translate savegame secfile data from 2.5.x to 2.6.0 format.
 ****************************************************************************/
-static void compat_load_020600(struct loaddata *loading)
+static void compat_load_020600(struct loaddata *loading,
+                               enum sgf_version format_class)
 {
   bool team_pooled_research = GAME_DEFAULT_TEAM_POOLED_RESEARCH;
   int tsize;
@@ -1214,7 +1217,8 @@
   function, it's still 2.6 savegame in the sense that savegame2.c, and not
   savegame3.c, handles it.
 ****************************************************************************/
-static void compat_load_030000(struct loaddata *loading)
+static void compat_load_030000(struct loaddata *loading,
+                               enum sgf_version format_class)
 {
   bool randsaved;
   int num_settings;
@@ -1318,7 +1322,8 @@
   functions, it's still 2.6 savegame in the sense that savegame2.c, and not
   savegame3.c, handles it.
 ****************************************************************************/
-static void compat_load_030100(struct loaddata *loading)
+static void compat_load_030100(struct loaddata *loading,
+                               enum sgf_version format_class)
 {
   /* Check status and return if not OK (sg_success != TRUE). */
   sg_check_ret();

Modified: trunk/server/savecompat.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savecompat.h?rev=34797&r1=34796&r2=34797&view=diff
==============================================================================
--- trunk/server/savecompat.h   (original)
+++ trunk/server/savecompat.h   Sat Jan  7 22:11:28 2017
@@ -23,6 +23,8 @@
 struct extra_type;
 struct base_type;
 struct road_type;
+
+enum sgf_version { SAVEGAME_2, SAVEGAME_3 };
 
 enum tile_special_type {
   S_IRRIGATION,
@@ -155,7 +157,7 @@
     sg_check_ret_val(_val);                                                 \
   }
 
-void sg_load_compat(struct loaddata *loading);
+void sg_load_compat(struct loaddata *loading, enum sgf_version format_class);
 int current_compat_ver(void);
 
 #define hex_chars "0123456789abcdef"

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=34797&r1=34796&r2=34797&view=diff
==============================================================================
--- trunk/server/savegame2.c    (original)
+++ trunk/server/savegame2.c    Sat Jan  7 22:11:28 2017
@@ -396,7 +396,7 @@
   /* Set up correct ruleset */
   sg_load_ruleset(loading);
   /* [compat] */
-  sg_load_compat(loading);
+  sg_load_compat(loading, SAVEGAME_2);
   /* [savefile] */
   sg_load_savefile(loading);
   /* [game] */

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=34797&r1=34796&r2=34797&view=diff
==============================================================================
--- trunk/server/savegame3.c    (original)
+++ trunk/server/savegame3.c    Sat Jan  7 22:11:28 2017
@@ -457,7 +457,7 @@
 
   /* Load the savegame data. */
   /* [compat] */
-  sg_load_compat(loading);
+  sg_load_compat(loading, SAVEGAME_3);
   /* [scenario] */
   sg_load_scenario(loading);
   /* [savefile] */


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

Reply via email to