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

Indeed, the same bug was present before but the symptoms were not as
harsh.  After the "fix" game.players[-1] gets entirely overwritten;
before only some of it did, when game.nplayers dropped to negative in
the client.

The error seems to be that game.nplayers was never being sent to the
client in the first place.  No matter how many players connect in
pregame the number of players in the client always remains 0.  This does
not appear to be an issue in 2.1 or later.

This "quick fix" should avoid the error.  It might be desirable to track
down the root problem and have the nplayers be sent but I'm not going to
spend the time on it.


Index: common/game.c
--- common/game.c	(revision 14869)
+++ common/game.c	(working copy)
@@ -481,6 +481,12 @@
   int i;
+  if (game.nplayers == 0) {
+    /* This happens in pregame, it's a bug that the nplayers is not being
+     * sent to the client and so is always zero. */
+    return;
+  }
   for (i = plrno; i < game.nplayers - 1; i++) {
@@ -495,6 +501,7 @@
+  assert(game.nplayers >= 0);
   /* Reset player structure. */
Freeciv-dev mailing list

Reply via email to