Complete.Org: Mailing Lists: Archives: freeciv-dev: December 2002:
[Freeciv-Dev] Re: (PR#2502) new savegames on 1.13.0
Home

[Freeciv-Dev] Re: (PR#2502) new savegames on 1.13.0

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: ChrisK@xxxxxxxx
Subject: [Freeciv-Dev] Re: (PR#2502) new savegames on 1.13.0
From: "Raimar Falke via RT" <rt@xxxxxxxxxxxxxx>
Date: Fri, 6 Dec 2002 15:24:27 -0800
Reply-to: rt@xxxxxxxxxxxxxx

On Fri, Dec 06, 2002 at 05:41:49AM -0800, Raimar Falke via RT wrote:
> On Fri, Dec 06, 2002 at 01:49:19AM -0800, ChrisK@xxxxxxxx via RT wrote:
> > 
> > Freeciv 1.13.0 GTK 1.2
> > 
> > It is not possible to load a 1.14 savegame with Freeciv 1.13.0
> > On start, the client crashes:
> > 
> > civclient: attribute.c:193: unserialize_hash: Assertion `preamble[1] ==
> > data_length' failed.
> > Abgebrochen (core dumped)
> 
> The attribute format has changed from 1.13.0 to 1.14.0. (it is now
> 64bit clean) However I can't patch all the 1.13 servers out
> there. Solutions welcome.

Davide provided one: we save the new attributes in the savegame under
a new name. The old server won't find it. So after loading the clients
have no attributes (CMA settings) but this isn't a big problem.

Patch is tested. Should be applied to both branches.

        Raimar

-- 
 email: rf13@xxxxxxxxxxxxxxxxx
 "I do feel kind of sorry for Microsoft. Their attornies and marketing
  force must have tons of ulcers trying to figure out how to beat (not
  just co-exist with) a product that has no clearly defined (read
  suable) human owner, and that changes on an hourly basis like the
  sea changes the layout of the sand on a beach. Severely tough to
  fight something like that."
    -- David D.W. Downey at linux-kernel

Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.99
diff -u -u -r1.99 savegame.c
--- server/savegame.c   2002/11/19 13:35:31     1.99
+++ server/savegame.c   2002/12/06 23:11:36
@@ -1055,13 +1055,13 @@
     unit_list_insert(&map_get_tile(punit->x, punit->y)->units, punit);
   }
 
-  if (section_file_lookup(file, "player%d.attribute_block_length", plrno)) {
+  if (section_file_lookup(file, "player%d.attribute_v2_block_length", plrno)) {
     int raw_length1, raw_length2, part_nr, parts;
     size_t quoted_length;
     char *quoted;
 
     raw_length1 =
-       secfile_lookup_int(file, "player%d.attribute_block_length", plrno);
+       secfile_lookup_int(file, "player%d.attribute_v2_block_length", plrno);
     if (plr->attribute_block.data) {
       free(plr->attribute_block.data);
       plr->attribute_block.data = NULL;
@@ -1070,16 +1070,16 @@
     plr->attribute_block.length = raw_length1;
 
     quoted_length = secfile_lookup_int
-       (file, "player%d.attribute_block_length_quoted", plrno);
+       (file, "player%d.attribute_v2_block_length_quoted", plrno);
     quoted = fc_malloc(quoted_length + 1);
     quoted[0] = 0;
 
     parts =
-       secfile_lookup_int(file, "player%d.attribute_block_parts", plrno);
+       secfile_lookup_int(file, "player%d.attribute_v2_block_parts", plrno);
 
     for (part_nr = 0; part_nr < parts; part_nr++) {
       char *current = secfile_lookup_str(file,
-                                        "player%d.attribute_block_data.part%d",
+                                        
"player%d.attribute_v2_block_data.part%d",
                                         plrno, part_nr);
       if (!current)
        break;
@@ -1586,15 +1586,15 @@
     size_t bytes_left;
 
     secfile_insert_int(file, plr->attribute_block.length,
-                      "player%d.attribute_block_length", plrno);
+                      "player%d.attribute_v2_block_length", plrno);
     secfile_insert_int(file, strlen(quoted),
-                      "player%d.attribute_block_length_quoted", plrno);
+                      "player%d.attribute_v2_block_length_quoted", plrno);
 
     parts = (strlen(quoted) - 1) / PART_SIZE + 1;
     bytes_left = strlen(quoted);
 
     secfile_insert_int(file, parts,
-                      "player%d.attribute_block_parts", plrno);
+                      "player%d.attribute_v2_block_parts", plrno);
 
     for (current_part_nr = 0; current_part_nr < parts; current_part_nr++) {
       size_t size_of_current_part = MIN(bytes_left, PART_SIZE);
@@ -1605,7 +1605,7 @@
             size_of_current_part);
       part[size_of_current_part] = 0;
       secfile_insert_str(file, part,
-                        "player%d.attribute_block_data.part%d", plrno,
+                        "player%d.attribute_v2_block_data.part%d", plrno,
                         current_part_nr);
       bytes_left -= size_of_current_part;
     }

[Prev in Thread] Current Thread [Next in Thread]