[Freeciv-Dev] (PR#10882) choose nation screen corrupted
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=10882 >
> [chrisk - Fri Nov 05 10:16:00 2004]:
>
>
> When I load the game into today's version, the 'choose a nation to play'
> screen shows an additional line, containing (only) the following (at the
> appropriate columns):
>
> Dead Human
>
> The Czech player is *not* listed.
>
> When I login for that player entry, I get my (german, player0) normal
game.
Nice catch. The bug was in the server. This game had barbarians as
players #5 and #6, while the Czech were #7 which made a bug in that
code surface. Here is a patch.
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.368
diff -u -r1.368 stdinhand.c
--- server/stdinhand.c 8 Nov 2004 14:46:14 -0000 1.368
+++ server/stdinhand.c 9 Nov 2004 03:51:23 -0000
@@ -3034,7 +3034,6 @@
**************************************************************************/
static void send_load_game_info(bool load_successful)
{
- int i;
struct packet_game_load packet;
/* Clear everything to be safe. */
@@ -3044,29 +3043,29 @@
packet.load_successful = load_successful;
if (load_successful) {
- packet.nplayers = game.nplayers;
-
- for (i = 0; i < game.nplayers; i++) {
- struct player *pplayer = &game.players[i];
+ int i = 0;
- if (game.nation_count && is_barbarian(pplayer)){
- packet.nplayers--;
- continue;
+ players_iterate(pplayer) {
+ if (game.nation_count && is_barbarian(pplayer)) {
+ continue;
}
sz_strlcpy(packet.name[i], pplayer->name);
sz_strlcpy(packet.username[i], pplayer->username);
if (game.nation_count) {
- sz_strlcpy(packet.nation_name[i], get_nation_name(pplayer->nation));
- sz_strlcpy(packet.nation_flag[i],
- get_nation_by_plr(pplayer)->flag_graphic_str);
+ sz_strlcpy(packet.nation_name[i], get_nation_name(pplayer->nation));
+ sz_strlcpy(packet.nation_flag[i],
+ get_nation_by_plr(pplayer)->flag_graphic_str);
} else { /* No nations picked */
- sz_strlcpy(packet.nation_name[i], "");
- sz_strlcpy(packet.nation_flag[i], "");
+ sz_strlcpy(packet.nation_name[i], "");
+ sz_strlcpy(packet.nation_flag[i], "");
}
packet.is_alive[i] = pplayer->is_alive;
packet.is_ai[i] = pplayer->ai.control;
- }
+ i++;
+ } players_iterate_end;
+
+ packet.nplayers = i;
} else {
packet.nplayers = 0;
}
|
|