Complete.Org: Mailing Lists: Archives: freeciv-dev: March 2005:
[Freeciv-Dev] (PR#11612) 0: tech "None": requires itself
Home

[Freeciv-Dev] (PR#11612) 0: tech "None": requires itself

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: marko.lindqvist@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#11612) 0: tech "None": requires itself
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Tue, 29 Mar 2005 21:57:51 -0800
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Wed Mar 30 05:20:35 2005]:

> The problem is the player info for the controlled player (only) is sent
> before the ruleset control packet.  So although the client is told what
> techs are known by the player it isn't loaded properly.  This is
> probably a serious bug in its own right (since it means tech data isn't
> known by the client until the next player packet) and should be fixed. 
> The second patch demonstrates the problem.

Second bug: this one was introduced (I have no idea why) by the gamelog
patch.  On establishing a connection, the player is aitoggled,
triggering a player packet.  However after the gamelog patch this is
done before the ruleset info is sent.  Hence, bug.  This patch fixes it.

Both of these bugs are present in 2.0.  Fixing either of them fixes the
symptom (the client crash).  They should both be fixed in both branches.
 However the symptom isn't present in 2.0 because many many player
packets are sent out and received by the client before update_research
is called, so the client gets the corrected information in time.  Stay
tuned for more on this (hopefully).

-jason

? server/foo.c
Index: server/connecthand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/connecthand.c,v
retrieving revision 1.41
diff -u -r1.41 connecthand.c
--- server/connecthand.c        23 Feb 2005 03:34:06 -0000      1.41
+++ server/connecthand.c        30 Mar 2005 05:51:15 -0000
@@ -116,10 +116,6 @@
   if ((pplayer = find_player_by_user(pconn->username))) {
     attach_connection_to_player(pconn, pplayer);
 
-    if (game.auto_ai_toggle && pplayer->ai.control) {
-      toggle_ai_player_direct(NULL, pplayer);
-    }
-
     if (server_state == RUN_GAME_STATE) {
       /* Player and other info is only updated when the game is running.
        * See the comment in lost_connection_to_client(). */
@@ -133,6 +129,13 @@
       dsend_packet_start_phase(pconn, game.phase);
     }
 
+    /* This must be done after the above info is sent, because it will
+     * generate a player-packet which can't be sent until (at least)
+     * rulesets are sent. */
+    if (game.auto_ai_toggle && pplayer->ai.control) {
+      toggle_ai_player_direct(NULL, pplayer);
+    }
+
     gamelog(GAMELOG_PLAYER, pplayer);
 
   } else if (server_state == PRE_GAME_STATE && game.is_new_game) {

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