Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2004:
[Freeciv-Dev] (PR#10889) xaw: no confirmation dialog for targeted revolu
Home

[Freeciv-Dev] (PR#10889) xaw: no confirmation dialog for targeted revolu

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: jdorje@xxxxxxxxxxxxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#10889) xaw: no confirmation dialog for targeted revolutions
From: "Egor Vyscrebentsov" <evyscr@xxxxxxxxx>
Date: Sun, 21 Nov 2004 08:53:15 -0800
Reply-to: rt@xxxxxxxxxxx

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

> [jdorje - Nov 05 15:40:59 2004]:
>
> If you choose "revolution" you get a confirmation dialog.
>
> But if you choose a particular government to change to there is
> no dialog.

Patch for HEAD.

Thanks, evyscr
? xaw_change_government_confirm.diff
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.107
diff -u -r1.107 dialogs.c
--- client/gui-xaw/dialogs.c    17 Nov 2004 19:31:14 -0000      1.107
+++ client/gui-xaw/dialogs.c    21 Nov 2004 16:46:40 -0000
@@ -1223,7 +1223,14 @@
 static void revolution_callback_yes(Widget w, XtPointer client_data, 
                                    XtPointer call_data)
 {
-  start_revolution();
+  int government = XTPOINTER_TO_INT(client_data);
+
+  if (government == -1) {
+    start_revolution();
+  } else {
+    /* Player have choosed government */
+    set_government_choice(government);
+  }
   destroy_message_dialog(w);
 }
 
@@ -1243,10 +1250,10 @@
 *****************************************************************/
 void popup_revolution_dialog(int government)
 {
-  assert(government == game.government_when_anarchy);
   popup_message_dialog(toplevel, "revolutiondialog", 
                       _("You say you wanna revolution?"),
-                      revolution_callback_yes, 0, 0,
+                      revolution_callback_yes,
+                      INT_TO_XTPOINTER(government), 0,
                       revolution_callback_no, 0, 0,
                       NULL);
 }
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.71
diff -u -r1.71 menu.c
--- client/gui-xaw/menu.c       17 Nov 2004 19:31:14 -0000      1.71
+++ client/gui-xaw/menu.c       21 Nov 2004 16:46:40 -0000
@@ -569,7 +569,12 @@
 static void revolution_menu_callback(Widget w, XtPointer client_data,
                                     XtPointer garbage)
 {
-  set_government_choice((int)client_data);
+  if (game.player_ptr->revolution_finishes == -1) {
+    popup_revolution_dialog(XTPOINTER_TO_INT(client_data));
+  } else {
+    /* Player already has a revolution and should just choose a government */
+    set_government_choice(XTPOINTER_TO_INT(client_data));
+  }
 }
 
 /****************************************************************

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