Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2005:
[Freeciv-Dev] (PR#13443) diplomat bug
Home

[Freeciv-Dev] (PR#13443) diplomat bug

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: djtansey@xxxxxxxxx
Subject: [Freeciv-Dev] (PR#13443) diplomat bug
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Sun, 10 Jul 2005 08:56:32 -0700
Reply-to: bugs@xxxxxxxxxxx

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

> [djtansey@xxxxxxxxx - Sun Jul 10 12:05:38 2005]:
> > > If you select a diplomat and tell him to goto a city and he is
killed en
> > > route, then from that point on you will not be able to use your
> > > diplomats to incite a revolt, etc. the dialog will no longer
popup. the
> > > messages tab will say it's an illegal order. 
> > > 
> > > if you exit the game then the dialog will pop up. then you can click
> > > cancel and start your game again and your diplomats will work again.
> > 

Diplomat dialog is destroyed only if you close the "price dialog".
When you click the "incite" button the dialog is only hidden.
If you click on the "Incite" button, the request for a price is sent to
the server. If the unit is dead already, the server of course ignores
that request and doesn't send back the answer. The result is that no
"price" dialog is displayed and the diplomat dialog is hidden.

Client won't open a new dialog if the old one isn't destroyed.

The solution is simple: destroy the diplomat dialog earlier, just after
sending a question for a price to the server.
Same problem with stealing techs, bribing units, destroying building.

This patch should fix that.
This was very hard to test - I had to check all diplomats and spy
actions with two clients open.
So I attach a savegame for testing if someone doesn't trust that the
patch is sane and wants to check it himself.
--
mateusz

Attachment: diplo.sav.gz
Description: GNU Zip compressed data

Index: client/gui-gtk-2.0/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.c,v
retrieving revision 1.109
diff -u -p -r1.109 dialogs.c
--- client/gui-gtk-2.0/dialogs.c        4 Jul 2005 17:48:36 -0000       1.109
+++ client/gui-gtk-2.0/dialogs.c        10 Jul 2005 15:42:48 -0000
@@ -257,7 +257,6 @@ static void bribe_response(GtkWidget *w,
                            diplomat_target_id, 0);
   }
   gtk_widget_destroy(w);
-  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -268,6 +267,7 @@ static void diplomat_bribe_callback(GtkW
   if (find_unit_by_id(diplomat_id) && find_unit_by_id(diplomat_target_id)) {
     dsend_packet_unit_bribe_inq(&aconnection, diplomat_target_id);
   }
+  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -337,8 +337,6 @@ static void spy_sabotage_unit_callback(G
 {
   request_diplomat_action(SPY_SABOTAGE_UNIT, diplomat_id,
                          diplomat_target_id, 0);
-
-  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -393,8 +391,6 @@ static void spy_advances_response(GtkWid
   }
   gtk_widget_destroy(spy_tech_shell);
   spy_tech_shell = NULL;
-
-  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -539,8 +535,6 @@ static void spy_improvements_response(Gt
   }
   gtk_widget_destroy(spy_sabotage_shell);
   spy_sabotage_shell = NULL;
-
-  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -675,6 +669,7 @@ pvictim to NULL and account for !pvictim
     create_advances_list(game.player_ptr, pvictim);
     gtk_window_present(GTK_WINDOW(spy_tech_shell));
   }
+  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -688,6 +683,7 @@ static void spy_request_sabotage_list(Gt
     request_diplomat_action(SPY_GET_SABOTAGE_LIST, diplomat_id,
                            diplomat_target_id, 0);
   }
+  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -710,6 +706,7 @@ static void diplomat_incite_callback(Gtk
   if (find_unit_by_id(diplomat_id) && find_city_by_id(diplomat_target_id)) {
     dsend_packet_city_incite_inq(&aconnection, diplomat_target_id);
   }
+  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************
@@ -722,7 +719,6 @@ static void incite_response(GtkWidget *w
                            diplomat_target_id, 0);
   }
   gtk_widget_destroy(w);
-  gtk_widget_destroy(diplomat_dialog);
 }
 
 /****************************************************************

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