<URL: http://bugs.freeciv.org/Ticket/Display.html?id=40167 >

2008/3/29 Marko Lindqvist:
>
> On 24/03/2008, Marko Lindqvist wrote:
>>
>>   With #40166 fixing server crash, scenario load now ends to client
>>  crash.
>
>  Actually, this is not limited to scenario load. Same happens quite
> often for any savegame load. (scenario load crashes always, otherwise
> I don't know exact limitations to reproducibility) Loading savegame
> via commandline parameter "-f" - or otherwise before client connects -
> might be required for crash to happen.

 After long debugging sessions I found out reason for guaranteed scenario crash.

 Scenario games miss thawing of tile send, meaning that no tiles is
ever (not even for another game) sent from server after scenario load.


 Fix attached.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c	2008-06-11 00:33:46.000000000 +0300
+++ freeciv/server/savegame.c	2008-06-16 07:23:50.000000000 +0300
@@ -223,6 +223,8 @@
 static void set_savegame_special(bv_special *specials,
 		    char ch, const enum tile_special_type *index);
 
+static void game_load_internal(struct section_file *file);
+
 /***************************************************************
 This returns an ascii hex value of the given half-byte of the binary
 integer. See ascii_hex2bin().
@@ -3746,6 +3748,20 @@
 ***************************************************************/
 void game_load(struct section_file *file)
 {
+  bool was_send_city_suppressed = send_city_suppression(TRUE);
+  bool was_send_tile_suppressed = send_tile_suppression(TRUE);
+
+  game_load_internal(file);
+
+  send_tile_suppression(was_send_tile_suppressed);
+  send_city_suppression(was_send_city_suppressed);
+}
+
+/***************************************************************
+  Real game_load function.
+***************************************************************/
+static void game_load_internal(struct section_file *file)
+{
   int i, k;
   enum server_states tmp_server_state;
   RANDOM_STATE rstate;
@@ -3753,8 +3769,6 @@
   int improvement_order_size = 0;
   int technology_order_size = 0;
   int civstyle = 0;
-  bool was_send_city_suppressed = send_city_suppression(TRUE);
-  bool was_send_tile_suppressed = send_tile_suppression(TRUE);
   char **improvement_order = NULL;
   char **technology_order = NULL;
   enum tile_special_type *special_order = NULL;
@@ -4437,9 +4451,6 @@
   if (!game.info.is_new_game) {
     set_myrand_state(rstate);
   }
-
-  send_tile_suppression(was_send_tile_suppressed);
-  send_city_suppression(was_send_city_suppressed);
 }
 
 /***************************************************************
_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to