Complete.Org: Mailing Lists: Archives: freeciv-dev: January 2002:
[Freeciv-Dev] Re: Map loading error with old saved games (PR#1214)
Home

[Freeciv-Dev] Re: Map loading error with old saved games (PR#1214)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: freeciv-dev@xxxxxxxxxxx
Cc: bugs@xxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] Re: Map loading error with old saved games (PR#1214)
From: jdorje@xxxxxxxxxxxxxxxxxxxxx
Date: Wed, 9 Jan 2002 21:50:23 -0800 (PST)

Vasco Alexandre Da Silva Costa wrote:

On Tue, 8 Jan 2002 jdorje@xxxxxxxxxxxxxxxxxxxxx wrote:

Vasco Alexandre Da Silva Costa wrote:


I've tried loading a couple of old games on
<ftp://ftp.freeciv.org/pub/freeciv/contrib/development/saved_game>

Like 'capital.sav' and the savegame with 1000 cities 'now.sav' and i get
this:

This is the server for Freeciv version 1.12.1-devel
You can learn a lot about Freeciv at http://www.freeciv.org/
2: Loading saved game: ../capital.sav
2: Loading rulesets
0: Invalid map line for y=0.  This may be a bug in FreeCiv; see
http://www.freeciv.org/ if you think so.

The attached patch should fix this.

The comments in the code explain it all...


'now.sav' now outputs this:

This is the server for Freeciv version 1.12.1-devel
You can learn a lot about Freeciv at http://www.freeciv.org/
2: Loading saved game: ../now.sav
2: Loading rulesets
1: The save file contains incomplete map data.  This can happen with old
saved games, or it may indicate an invalid saved game file.  Proceed at
your own risk.
1: last message repeated 2 times
1: last message repeated 2 times (total 4 repeats)
1: last message repeated 4 times (total 8 repeats)
1: last message repeated 8 times (total 16 repeats)
1: last message repeated 16 times (total 32 repeats)
1: last message repeated 32 times (total 64 repeats)
1: last message repeated 64 times (total 128 repeats)
civserver: city.c:179: set_worker_city: Assertion `type ==
C_TILE_UNAVAILABLE' failed.
Aborted

It looks like the old savegame stores C_TILE_EMPTY as the worker status for invalid (unreal) city positions. This causes a failed assertion when set_worker_city is called, since that function expects C_TILE_UNAVAILABLE in such cases.

Applying this patch (as well as the previous one) and compiling without debugging should allow things to work.

Getting things to work with debugging is a bit trickier, and probably not worthwhile. You could just remove the assertion, but that's a bad idea IMO (though it could be replaced with a freelog(...) error message). The other alternative is to have the loading code check for the unreal+C_TILE_EMPTY case, and convert it to C_TILE_UNAVAILABLE - this would be a pain to do.

jason
Index: common/city.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/city.c,v
retrieving revision 1.130
diff -u -r1.130 city.c
--- common/city.c       2002/01/09 02:45:48     1.130
+++ common/city.c       2002/01/10 05:46:58
@@ -177,7 +177,7 @@
       ptile->worked = pcity;
   } else {
     assert(type == C_TILE_UNAVAILABLE);
-    pcity->city_map[city_x][city_y] = type;
+    pcity->city_map[city_x][city_y] = C_TILE_UNAVAILABLE;
   }
 }
 

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