Hello. I noticed that failure to connect to metaserver wasn't reported to client's window, only on the console. This patch uses draw_info to report failure to player. I also changed the color of failure to connect to metaserver or server message to black (instead of red). Even if it should probably be in red, in split window mode this means the 'trying to connect to' and 'can't connect to server' messages appear in different windows, making it confusing (imo). Finally, the information windows weren't correctly updated: frozen in draw_info, but released only in do_timeout, which is not called in metaserver mode. So I moved the relevant code to a function, to use it in metaserver mode too. Nicolas -------------- next part -------------- Index: common/metaserver.c =================================================================== RCS file: /cvsroot/crossfire/client/common/metaserver.c,v retrieving revision 1.8 diff -u -r1.8 metaserver.c --- common/metaserver.c 30 Jan 2004 18:43:34 -0000 1.8 +++ common/metaserver.c 6 Mar 2004 16:39:45 -0000 @@ -167,7 +167,7 @@ fd = socket(PF_INET, SOCK_STREAM, protox->p_proto); if (fd==-1) { perror("get_metaserver_info: Error on socket command.\n"); - return 1; + return 1; } insock.sin_family = AF_INET; insock.sin_port = htons((unsigned short)meta_port); @@ -178,14 +178,15 @@ if (hostbn == (struct hostent *) NULL) { LOG(LOG_WARNING,"common::metaserver_get_info","Unknown metaserver hostname: %s",metaserver); - return 1; - } + return 1; + } memcpy(&insock.sin_addr, hostbn->h_addr, hostbn->h_length); } if (connect(fd,(struct sockaddr *)&insock,sizeof(insock)) == (-1)) { - perror("Can't connect to server"); - return 1; + perror("Can't connect to metaserver"); + draw_info("\nCan't connect to metaserver.",NDI_BLACK); + return 1; } #ifndef WIN32 /* Windows doesn't support this */ @@ -370,7 +371,7 @@ draw_info(buf,NDI_BLACK); csocket.fd=init_connection(server_ip, use_config[CONFIG_PORT]); if (csocket.fd==-1) { - draw_info("Unable to connect to server.", NDI_RED); + draw_info("Unable to connect to server.", NDI_BLACK); return 1; } return 0; Index: gtk/gx11.c =================================================================== RCS file: /cvsroot/crossfire/client/gtk/gx11.c,v retrieving revision 1.46 diff -u -r1.46 gx11.c --- gtk/gx11.c 30 Jan 2004 18:43:34 -0000 1.46 +++ gtk/gx11.c 6 Mar 2004 16:39:59 -0000 @@ -4844,21 +4844,26 @@ } } +void draw_info_windows() + { + if (draw_info_freeze1) { + gtk_text_thaw (GTK_TEXT (gtkwin_info_text)); + gtk_adjustment_set_value(GTK_ADJUSTMENT(text_vadj), GTK_ADJUSTMENT(text_vadj)->upper-GTK_ADJUSTMENT(text_vadj)->page_size); + gtk_text_set_adjustments(GTK_TEXT (gtkwin_info_text),GTK_ADJUSTMENT(text_hadj),GTK_ADJUSTMENT(text_vadj)); + draw_info_freeze1=FALSE; + } + if (draw_info_freeze2) { + gtk_text_thaw (GTK_TEXT (gtkwin_info_text2)); + gtk_adjustment_set_value(GTK_ADJUSTMENT(text_vadj2), GTK_ADJUSTMENT(text_vadj2)->upper-GTK_ADJUSTMENT(text_vadj2)->page_size); + gtk_text_set_adjustments(GTK_TEXT (gtkwin_info_text2),GTK_ADJUSTMENT(text_hadj2),GTK_ADJUSTMENT(text_vadj2)); + draw_info_freeze2=FALSE; + } + } + int do_timeout() { updatelock=0; - if (draw_info_freeze1) { - gtk_text_thaw (GTK_TEXT (gtkwin_info_text)); - gtk_adjustment_set_value(GTK_ADJUSTMENT(text_vadj), GTK_ADJUSTMENT(text_vadj)->upper-GTK_ADJUSTMENT(text_vadj)->page_size); - gtk_text_set_adjustments(GTK_TEXT (gtkwin_info_text),GTK_ADJUSTMENT(text_hadj),GTK_ADJUSTMENT(text_vadj)); - draw_info_freeze1=FALSE; - } - if (draw_info_freeze2) { - gtk_text_thaw (GTK_TEXT (gtkwin_info_text2)); - gtk_adjustment_set_value(GTK_ADJUSTMENT(text_vadj2), GTK_ADJUSTMENT(text_vadj2)->upper-GTK_ADJUSTMENT(text_vadj2)->page_size); - gtk_text_set_adjustments(GTK_TEXT (gtkwin_info_text2),GTK_ADJUSTMENT(text_hadj2),GTK_ADJUSTMENT(text_vadj2)); - draw_info_freeze2=FALSE; - } + draw_info_windows(); if (redraw_needed) { display_map_doneupdate(TRUE); draw_all_list(&inv_list); @@ -5951,7 +5956,8 @@ metaserver_get_info(meta_server, meta_port); metaserver_show(TRUE); do { - ms=get_metaserver(); + draw_info_windows(); + ms=get_metaserver(); } while (metaserver_select(ms)); negotiate_connection(use_config[CONFIG_SOUND]); } else { -------------- next part -------------- _______________________________________________ crossfire-devel mailing list crossfire-devel at lists.real-time.com https://mailman.real-time.com/mailman/listinfo/crossfire-devel