Complete.Org: Mailing Lists: Archives: freeciv-dev: September 2004:
[Freeciv-Dev] (PR#10283) "Disconnect" menu item
Home

[Freeciv-Dev] (PR#10283) "Disconnect" menu item

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#10283) "Disconnect" menu item
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Fri, 24 Sep 2004 00:45:09 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=10283 >

> [mstefek - Fri Sep 24 07:42:53 2004]:
 
> OK. Here's a patch.
And the missing patch
--
mateusz
? civgame-2500.sav.gz
? civgame-3000.sav.gz
? civgame-3500.sav.gz
? civgame-3950.sav.gz
? core.16019
? core.2862
? gdb_script
Index: clinet.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/clinet.c,v
retrieving revision 1.100
diff -u -r1.100 clinet.c
--- clinet.c    20 Jul 2004 17:13:52 -0000      1.100
+++ clinet.c    24 Sep 2004 07:43:28 -0000
@@ -74,6 +74,7 @@
 #include "chatline_g.h"
 #include "civclient.h"
 #include "climisc.h"
+#include "connectdlg_common.h"
 #include "connectdlg_g.h"
 #include "dialogs_g.h"         /* popdown_races_dialog() */
 #include "gui_main_g.h"                /* add_net_input(), remove_net_input() 
*/
@@ -119,6 +120,8 @@
   append_output_window(_("Lost connection to server!"));
   freelog(LOG_NORMAL, "lost connection to server");
   close_socket_nomessage(pc);
+  /* If we lost connection to the internal server - kill him */
+  client_kill_server();
 }
 
 /**************************************************************************
@@ -233,6 +236,9 @@
 {
   append_output_window(_("Disconnecting from server."));
   close_socket_nomessage(&aconnection);
+  /* If it's internal server - kill him 
+   * We assume that we are always connected to the internal server  */
+  client_kill_server();
 }  
 
 /**************************************************************************
Index: connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.23
diff -u -r1.23 connectdlg_common.c
--- connectdlg_common.c 18 Sep 2004 17:47:28 -0000      1.23
+++ connectdlg_common.c 24 Sep 2004 07:43:30 -0000
@@ -443,17 +443,3 @@
 
   send_chat(message);
 }
-
-/**************************************************************** 
- Should be called by gui after disconnecting from local server
-*****************************************************************/ 
-void disconnected_from_local_server() 
-{
-  char buf[1024];
-  assert(is_server_running());
-  my_snprintf(buf, sizeof(buf), 
-              _("A local server is still running on port %d. Use "
-                "\"Connect to Network Game\" to connect to it."),
-             internal_server_port);
-  append_output_window(buf);
-}
Index: gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.40
diff -u -r1.40 menu.c
--- gui-gtk-2.0/menu.c  18 Sep 2004 17:47:28 -0000      1.40
+++ gui-gtk-2.0/menu.c  24 Sep 2004 07:43:33 -0000
@@ -79,7 +79,6 @@
   MENU_GAME_OUTPUT_LOG,
   MENU_GAME_CLEAR_OUTPUT,
   MENU_GAME_DISCONNECT,
-  MENU_GAME_END,
   MENU_GAME_QUIT,
   
   MENU_GOVERNMENT_TAX_RATE,
@@ -206,13 +205,6 @@
     break;
   case MENU_GAME_DISCONNECT:
     disconnect_from_server();
-    if (is_server_running()) {
-      disconnected_from_local_server();
-    }
-    break;
-  case MENU_GAME_END:
-    disconnect_from_server();
-    client_kill_server();
     break;
   case MENU_GAME_QUIT:
     exit(EXIT_SUCCESS);
@@ -626,10 +618,6 @@
        GTK_STOCK_SAVE_AS                                                       
        },
   { "/" N_("Game") "/sep4",                            NULL,
        NULL,                   0,                                      
"<Separator>"   },
-  { "/" N_("Game") "/" N_("_End Game"),                NULL,
-       game_menu_callback,     MENU_GAME_END                                   
        },
-  { "/" N_("Game") "/sep5",                            NULL,
-       NULL,                   0,                                      
"<Separator>"   },
   { "/" N_("Game") "/" N_("E_xport Log"),              NULL,
        game_menu_callback,     MENU_GAME_OUTPUT_LOG                            
        },
   { "/" N_("Game") "/" N_("Clear _Log"),               NULL,
@@ -1082,8 +1070,6 @@
                      && get_client_state() >= CLIENT_GAME_RUNNING_STATE);
   menus_set_sensitive("<main>/_Game/_Save Game", can_client_access_hack()
                      && get_client_state() >= CLIENT_GAME_RUNNING_STATE);
-  menus_set_sensitive("<main>/_Game/_End Game", can_client_access_hack()
-                     && get_client_state() >= CLIENT_GAME_RUNNING_STATE);
   menus_set_sensitive("<main>/_Game/Server O_ptions", 
                      aconnection.established);
   menus_set_sensitive("<main>/_Game/_Initial Server Options", 

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