[Freeciv-Dev] (PR#8909) crash when loading savegames
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=8909 >
When you load a game the server crashes. If the server is fixed, the
client still crashes. This is because the city map indices aren't
generated at the right time.
I'm a bit confused by this. I saw the server crash a while ago and sent
a fixed patch last night (however Greg committed an older version of the
patch today). However I didn't see the client crash last night. Maybe
I'm doing something wrong in testing, or maybe it only crashes sometimes
(like when compiling with DEBUG).
The solution is simple but isn't extensible. We just need to make sure
the indices are generated earlier. Putting the generate call into
map_allocate() is simple and works with things as they are. But in
future the indices may also depend on ruleset values, so we have to make
sure the right parts of the ruleset are loaded before generating them.
Figuring out all the dependencies may be quite tricky. Fortunately we
can probably just short-circuit this logic and simply generate the
indices multiple times (once after each dependency is met).
jason
? orig
? test.gz
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.188
diff -u -r1.188 civclient.c
--- client/civclient.c 4 Jun 2004 15:49:59 -0000 1.188
+++ client/civclient.c 4 Jun 2004 23:46:57 -0000
@@ -405,7 +405,6 @@
client_state=newstate;
if (client_state == CLIENT_GAME_RUNNING_STATE) {
- generate_city_map_indices();
load_ruleset_specific_options();
create_event(-1, -1, E_GAME_START, _("Game started."));
update_research(game.player_ptr);
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.167
diff -u -r1.167 map.c
--- common/map.c 27 May 2004 02:06:52 -0000 1.167
+++ common/map.c 4 Jun 2004 23:46:57 -0000
@@ -262,6 +262,8 @@
whole_map_iterate(x, y) {
tile_init(map_get_tile(x, y));
} whole_map_iterate_end;
+
+ generate_city_map_indices();
}
/***************************************************************
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.166
diff -u -r1.166 srv_main.c
--- server/srv_main.c 4 Jun 2004 15:49:59 -0000 1.166
+++ server/srv_main.c 4 Jun 2004 23:46:58 -0000
@@ -1566,7 +1566,6 @@
load_rulesets();
/* otherwise rulesets were loaded when savegame was loaded */
}
- generate_city_map_indices();
nations_avail = fc_calloc(game.playable_nation_count, sizeof(int));
nations_used = fc_calloc(game.playable_nation_count, sizeof(int));
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#8909) crash when loading savegames,
Jason Short <=
|
|