Re: [Freeciv-Dev] (PR#39618) 1: handle_ruleset_nation() bad nation.

2007-08-28 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39618 

On 26/08/07, Pepeto _ [EMAIL PROTECTED] wrote:

 When you reload a ruleset with more nations than the previous (for
 example civ1 - civ2), you get a lot of 1: handle_ruleset_nation() bad
 nation %d.. It seems that the nations rulesets are sent both. A first
 time before the ruleset control packet (this one is not good), a second
 time after.

 Sometimes I got a client crash about nations too, but i didn't find yet
 how reproduce this crash yet.

 In server/srv_main.c, init_available_nations(), line 1329:
   if (game.est_connections) {
 send_ruleset_nations(game.est_connections);
   }
 Are this lines really useful? I tried to remove them, i didn't get any
 strange effect yet.


 Patch


 - ML

diff -Nurd -X.diff_ignore freeciv/server/savegame.c freeciv/server/savegame.c
--- freeciv/server/savegame.c	2007-08-17 23:34:39.0 +0300
+++ freeciv/server/savegame.c	2007-08-28 22:55:58.0 +0300
@@ -3961,6 +3961,12 @@
 /* Initialize nations we loaded from rulesets. This has to be after
  * map loading and before we seek nations for players */
 init_available_nations();
+if (game.est_connections) {
+  /* Update client knowledge about available nations after
+   * init_available_nations() may have marked some of them unavailable
+   * in this scenario */
+  send_ruleset_nations(game.est_connections);
+}
 
 players_iterate(pplayer) {
   player_load(pplayer, pplayer-player_no, file, improvement_order,
diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c
--- freeciv/server/srv_main.c	2007-08-22 03:26:25.0 +0300
+++ freeciv/server/srv_main.c	2007-08-28 22:43:24.0 +0300
@@ -1326,9 +1326,6 @@
   }
 }
   } nations_iterate_end;
-  if (game.est_connections) {
-send_ruleset_nations(game.est_connections);
-  }
 }
 
 /**
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39618) 1: handle_ruleset_nation() bad nation.

2007-08-26 Thread Pepeto _

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39618 

 [EMAIL PROTECTED] - Dim. AoĆ». 26 15:52:11 2007]:
 
 On 26/08/07, Pepeto _ [EMAIL PROTECTED] wrote:
 
  Sometimes I got a client crash about nations too, but i didn't find yet
  how reproduce this crash yet.
 
  There is known problem that disconnecting from server does not
 initialize nation-player (or player-nation?) correctly, leading
 problems when reconnecting.
 
Then, maybe the client should make:
  client_game_free();
  client_game_init();
when he quits a pregame?

___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev