Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10247) Forward compatibility of player%d.race
Home

[Freeciv-Dev] (PR#10247) Forward compatibility of player%d.race

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10247) Forward compatibility of player%d.race
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Tue, 21 Sep 2004 15:42:27 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10247 >

This code from savegame.c is not forward compatible:
  /* 1.15 and later won't use the race field, they key on the nation
string */
  secfile_insert_int(file, plr->nation, "player%d.race", plrno);

While CVS version has more nations than 1.14.2 the "race" field may be
to big for 1.14.2.

The simplest solution is to change it into:
  secfile_insert_int(file, plrno, "player%d.race", plrno);
--
mateusz
Index: savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.191
diff -u -r1.191 savegame.c
--- savegame.c  21 Sep 2004 18:35:23 -0000      1.191
+++ savegame.c  21 Sep 2004 22:41:40 -0000
@@ -2237,8 +2237,10 @@
   secfile_insert_str(file, plr->username, "player%d.username", plrno);
   secfile_insert_str(file, get_nation_name_orig(plr->nation),
                     "player%d.nation", plrno);
-  /* 1.15 and later won't use the race field, they key on the nation string */
-  secfile_insert_int(file, plr->nation, "player%d.race", plrno);
+  /* 1.15 and later won't use the race field, they key on the nation string 
+   * This field is kept only for forward compatibility
+   * Nations can't be saved correctly because race must be < 62 */
+  secfile_insert_int(file, plrno, "player%d.race", plrno);
   if (plr->team != TEAM_NONE) {
     secfile_insert_str(file, (char *) team_get_by_id(plr->team)->name, 
                        "player%d.team", plrno);

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#10247) Forward compatibility of player%d.race, Mateusz Stefek <=