[Freeciv-Dev] Re: (PR#10518) hostname and ping times are not always show
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10518 >
ok, this is two unrelated bugs.
First conn_info is correctly sent, but the connection wasn't getting
associated with a player, because of the check for the player number
less than game.nplayers, But in pregame, the client thinks that this is
zero, so the player number is rejected.
Also, the conn_info wasn't being removed from the client when a connection
detached from a player: when changing away from the global observer for
instance.
Patch attached, I'll commit shortly.
-mike
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.408.2.2
diff -u -r1.408.2.2 packhand.c
--- client/packhand.c 19 Oct 2004 18:11:23 -0000 1.408.2.2
+++ client/packhand.c 20 Oct 2004 22:56:51 -0000
@@ -1612,7 +1612,8 @@
} else {
/* Add or update the connection */
struct player *pplayer =
- ((pinfo->player_num >= 0 && pinfo->player_num < game.nplayers)
+ ((pinfo->player_num >= 0
+ && pinfo->player_num < MAX_NUM_PLAYERS + MAX_NUM_BARBARIANS)
? get_player(pinfo->player_num) : NULL);
if (!pconn) {
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.354.2.4
diff -u -r1.354.2.4 stdinhand.c
--- server/stdinhand.c 9 Oct 2004 21:41:52 -0000 1.354.2.4
+++ server/stdinhand.c 20 Oct 2004 22:56:52 -0000
@@ -2622,6 +2622,11 @@
}
game.nplayers++;
+
+ /* tell everyone that game.nplayers has been updated */
+ send_game_info(NULL);
+ send_player_info(pplayer, NULL);
+
notify_player(NULL, _("Game: A global observer has been created"));
}
}
@@ -2952,6 +2957,7 @@
}
/* actually do the detaching */
+ send_conn_info_remove(&pconn->self, &game.est_connections);
unattach_connection_from_player(pconn);
cmd_reply(CMD_DETACH, caller, C_COMMENT,
_("%s detaching from %s"), pconn->username, pplayer->name);
@@ -2964,6 +2970,7 @@
/* detach any observers */
conn_list_iterate(pplayer->connections, aconn) {
if (aconn->observer) {
+ send_conn_info_remove(&aconn->self, &game.est_connections);
unattach_connection_from_player(aconn);
notify_conn(&aconn->self, _("detaching from %s."), pplayer->name);
}
|
|