Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13246) It is possible to change a nation in the game l
Home

[Freeciv-Dev] (PR#13246) It is possible to change a nation in the game l

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mstefek@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#13246) It is possible to change a nation in the game loading dialog
From: "Jason Short" <jdorje@xxxxxxxxxxxxxxxxxxxxx>
Date: Mon, 13 Jun 2005 18:38:20 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [jdorje - Mon Jun 13 23:12:11 2005]:

> There are a bunch of bugs here.
> 
> 1.  /team can be run even when !game.is_new_game.
> 
> 2.  Nations can be changed even when !game.is_new_game.
> 
> 3.  Both #1 and #2 also show up in the client pregame dialog.  This
> requires a separate game.is_new_game check.  However game.is_new_game
> isn't known at the client.

4.  aifill runs on a loaded game also, but triggers an assertion when we
try to remove a player for a non-new game.

This patch fixes all four problems.  However it does NOT send
game.is_new_game to the client.  Doing that will take a rather larger
and less dense patch which will be provided separately.

-jason


Index: client/gui-gtk-2.0/pages.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/pages.c,v
retrieving revision 1.33
diff -u -r1.33 pages.c
--- client/gui-gtk-2.0/pages.c  4 Jun 2005 16:28:18 -0000       1.33
+++ client/gui-gtk-2.0/pages.c  14 Jun 2005 01:35:27 -0000
@@ -1051,7 +1051,7 @@
     dsend_packet_player_ready(&aconnection, pplayer->player_no, !is_ready);
     return TRUE;
   } else if (column == team_col) {
-    if (pplayer) {
+    if (pplayer && game.is_new_game) {
       GtkWidget *menu = create_team_menu(pplayer);
 
       gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL,
Index: common/nation.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/nation.c,v
retrieving revision 1.50
diff -u -r1.50 nation.c
--- common/nation.c     3 Jun 2005 16:46:18 -0000       1.50
+++ common/nation.c     14 Jun 2005 01:35:28 -0000
@@ -366,6 +366,7 @@
 bool can_conn_edit_players_nation(const struct connection *pconn,
                                  const struct player *pplayer)
 {
-  return ((!pconn->observer && pconn->player == pplayer)
-         || pconn->access_level >= ALLOW_CTRL);
+  return (game.is_new_game
+         && ((!pconn->observer && pconn->player == pplayer)
+             || pconn->access_level >= ALLOW_CTRL));
 }
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.269
diff -u -r1.269 srv_main.c
--- server/srv_main.c   9 Jun 2005 18:30:13 -0000       1.269
+++ server/srv_main.c   14 Jun 2005 01:35:28 -0000
@@ -1417,6 +1417,10 @@
   int observers = 0, remove;
   int filled = 0;
 
+  if (!game.is_new_game) {
+    return;
+  }
+
   if (amount == 0) {
     /* Special case for value 0: do nothing. */
     return;
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.419
diff -u -r1.419 stdinhand.c
--- server/stdinhand.c  9 Jun 2005 18:24:48 -0000       1.419
+++ server/stdinhand.c  14 Jun 2005 01:35:29 -0000
@@ -2061,7 +2061,7 @@
   bool res = FALSE;
   struct team *pteam;
 
-  if (server_state != PRE_GAME_STATE) {
+  if (server_state != PRE_GAME_STATE || !game.is_new_game) {
     cmd_reply(CMD_TEAM, caller, C_SYNTAX,
               _("Cannot change teams once game has begun."));
     return FALSE;

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