[Freeciv-Dev] (PR#9657) Small bug in conndlg
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://rt.freeciv.org/Ticket/Display.html?id=9657 >
version 2. Stupid bug fixed
? civgame-3950.sav.gz
Index: connectdlg_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.c,v
retrieving revision 1.15
diff -u -r1.15 connectdlg_common.c
--- connectdlg_common.c 26 Jul 2004 03:38:29 -0000 1.15
+++ connectdlg_common.c 12 Aug 2004 08:14:21 -0000
@@ -64,6 +64,8 @@
bool client_has_hack = FALSE;
+int internal_server_port;
+
const char *skill_level_names[NUM_SKILL_LEVELS] = {
N_("novice"),
N_("easy"),
@@ -145,7 +147,7 @@
append_output_window(_("Starting server..."));
/* find a free port */
- server_port = find_next_free_port(DEFAULT_SOCK_PORT);
+ internal_server_port = find_next_free_port(DEFAULT_SOCK_PORT);
server_pid = fork();
@@ -157,7 +159,7 @@
/* inside the child */
/* Set up the command-line parameters. */
- my_snprintf(port_buf, sizeof(port_buf), "%d", server_port);
+ my_snprintf(port_buf, sizeof(port_buf), "%d", internal_server_port);
argv[argc++] = "civserver";
argv[argc++] = "-p";
argv[argc++] = port_buf;
@@ -214,7 +216,7 @@
}
/* a reasonable number of tries */
- while (connect_to_server(user_name, "localhost", server_port,
+ while (connect_to_server(user_name, "localhost", internal_server_port,
buf, sizeof(buf)) == -1) {
myusleep(WAIT_BETWEEN_TRIES);
@@ -339,3 +341,17 @@
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: connectdlg_common.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/connectdlg_common.h,v
retrieving revision 1.3
diff -u -r1.3 connectdlg_common.h
--- connectdlg_common.h 8 May 2004 19:21:01 -0000 1.3
+++ connectdlg_common.h 12 Aug 2004 08:14:21 -0000
@@ -27,6 +27,8 @@
void send_start_saved_game(void);
void send_save_game(char *filename);
+void disconnected_from_local_server(void);
+
extern char player_name[MAX_LEN_NAME];
extern char *current_filename;
Index: gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.32
diff -u -r1.32 menu.c
--- gui-gtk-2.0/menu.c 21 May 2004 19:03:43 -0000 1.32
+++ gui-gtk-2.0/menu.c 12 Aug 2004 08:14:25 -0000
@@ -207,8 +207,7 @@
case MENU_GAME_DISCONNECT:
disconnect_from_server();
if (is_server_running()) {
- append_output_window(_("A local server is still running. Use "
- "\"Connect to Network Game\" to connect to it."));
+ disconnected_from_local_server();
}
break;
case MENU_GAME_END:
|
|