[Freeciv-Dev] (PR#13788) more client stability fixes
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13788 >
This patch fixes some more problems with the client when it receives a
game packet while detached.
-jason
Index: client/civclient.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/civclient.c,v
retrieving revision 1.230
diff -p -u -r1.230 civclient.c
--- client/civclient.c 25 Aug 2005 20:36:12 -0000 1.230
+++ client/civclient.c 26 Aug 2005 19:22:34 -0000
@@ -475,11 +475,13 @@ void set_client_state(enum client_states
/*
* Extra kludge for end-game handling of the CMA.
*/
- city_list_iterate(game.player_ptr->cities, pcity) {
- if (cma_is_city_under_agent(pcity, NULL)) {
- cma_release_city(pcity);
- }
- } city_list_iterate_end;
+ if (game.player_ptr) {
+ city_list_iterate(game.player_ptr->cities, pcity) {
+ if (cma_is_city_under_agent(pcity, NULL)) {
+ cma_release_city(pcity);
+ }
+ } city_list_iterate_end;
+ }
popdown_all_city_dialogs();
popdown_all_game_dialogs();
set_unit_focus(NULL);
Index: client/mapview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/mapview_common.c,v
retrieving revision 1.243
diff -p -u -r1.243 mapview_common.c
--- client/mapview_common.c 25 Aug 2005 20:36:12 -0000 1.243
+++ client/mapview_common.c 26 Aug 2005 19:22:35 -0000
@@ -2028,6 +2028,12 @@ void unqueue_mapview_updates(bool write_
int i;
+ if (!can_client_change_view()) {
+ /* Double sanity check: make sure we don't unqueue an invalid update
+ * after we've already detached. */
+ return;
+ }
+
freelog(LOG_DEBUG, "unqueue_mapview_update: needed_updates=%d",
needed_updates);
Index: client/overview_common.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/overview_common.c,v
retrieving revision 1.16
diff -p -u -r1.16 overview_common.c
--- client/overview_common.c 2 Aug 2005 02:40:58 -0000 1.16
+++ client/overview_common.c 26 Aug 2005 19:22:35 -0000
@@ -334,6 +334,9 @@ void overview_to_map_pos(int *map_x, int
**************************************************************************/
void refresh_overview_canvas(void)
{
+ if (!can_client_change_view()) {
+ return;
+ }
whole_map_iterate(ptile) {
overview_update_tile(ptile);
} whole_map_iterate_end;
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.543
diff -p -u -r1.543 packhand.c
--- client/packhand.c 25 Aug 2005 20:36:12 -0000 1.543
+++ client/packhand.c 26 Aug 2005 19:22:37 -0000
@@ -893,8 +893,9 @@ void handle_page_msg(char *message, enum
lines = "";
}
- if (!game.player_ptr->ai.control||
- event != E_BROADCAST_REPORT) {
+ if (!game.player_ptr
+ || !game.player_ptr->ai.control
+ || event != E_BROADCAST_REPORT) {
popup_notify_dialog(caption, headline, lines);
play_sound_for_event(event);
}
Index: client/gui-gtk-2.0/gui_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/gui_main.c,v
retrieving revision 1.136
diff -p -u -r1.136 gui_main.c
--- client/gui-gtk-2.0/gui_main.c 22 Aug 2005 17:57:20 -0000 1.136
+++ client/gui-gtk-2.0/gui_main.c 26 Aug 2005 19:22:37 -0000
@@ -1224,30 +1224,33 @@ void ui_main(int argc, char **argv)
void update_conn_list_dialog(void)
{
GtkTreeIter it;
- char *text;
- if (game.player_ptr->is_ready) {
- text = _("Not _ready");
- } else {
- int num_unready = 0;
-
- players_iterate(pplayer) {
- if (!pplayer->ai.control && !pplayer->is_ready) {
- num_unready++;
- }
- } players_iterate_end;
+ if (game.player_ptr) {
+ char *text;
- if (num_unready > 1) {
- text = _("_Ready");
+ if (game.player_ptr->is_ready) {
+ text = _("Not _ready");
} else {
- /* We are the last unready player so clicking here will
- * immediately start the game. */
- text = _("_Start");
+ int num_unready = 0;
+
+ players_iterate(pplayer) {
+ if (!pplayer->ai.control && !pplayer->is_ready) {
+ num_unready++;
+ }
+ } players_iterate_end;
+
+ if (num_unready > 1) {
+ text = _("_Ready");
+ } else {
+ /* We are the last unready player so clicking here will
+ * immediately start the game. */
+ text = _("_Start");
+ }
}
+
+ gtk_stockbutton_set_label(ready_button, text);
}
- gtk_stockbutton_set_label(ready_button, text);
-
if (get_client_state() != CLIENT_GAME_RUNNING_STATE) {
bool is_ready;
const char *nation, *leader, *team;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13788) more client stability fixes,
Jason Short <=
|
|