[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]
<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.
Attached patch shows confirmation dialog when player has no
revolution.
One problem - next turn after revolution finished it does not
show this dialog. Two (or more) turns ater finish it does.
Civserver debug log shows that revolution_finishes is -1, however...
vasc used `if (game.player_ptr->revolution_finishes < game.turn)'
instead of `if (game.player_ptr->revolution_finishes != -1)'
It fixes this problem but shows the dialog when player should
just choose a government after revolution finished.
Thanks, evyscr.
Index: client/gui-xaw/actions.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/actions.c,v
retrieving revision 1.22
diff -u -r1.22 actions.c
--- client/gui-xaw/actions.c 23 Aug 2004 23:24:45 -0000 1.22
+++ client/gui-xaw/actions.c 20 Nov 2004 17:52:31 -0000
@@ -274,7 +274,7 @@
{
if (can_client_change_view()
&& is_menu_item_active(MENU_GOVERNMENT, MENU_GOVERNMENT_REVOLUTION)) {
- popup_revolution_dialog();
+ popup_revolution_dialog(-1);
}
}
Index: client/gui-xaw/dialogs.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.c,v
retrieving revision 1.104.2.1
diff -u -r1.104.2.1 dialogs.c
--- client/gui-xaw/dialogs.c 10 Nov 2004 17:02:03 -0000 1.104.2.1
+++ client/gui-xaw/dialogs.c 20 Nov 2004 17:52:31 -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);
}
@@ -1241,11 +1248,12 @@
/****************************************************************
...
*****************************************************************/
-void popup_revolution_dialog(void)
+void popup_revolution_dialog(int government)
{
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/dialogs.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/dialogs.h,v
retrieving revision 1.8.6.1
diff -u -r1.8.6.1 dialogs.h
--- client/gui-xaw/dialogs.h 15 Nov 2004 18:51:30 -0000 1.8.6.1
+++ client/gui-xaw/dialogs.h 20 Nov 2004 17:52:31 -0000
@@ -19,7 +19,7 @@
struct tile;
-void popup_revolution_dialog(void);
+void popup_revolution_dialog(int government);
Widget popup_message_dialog(Widget parent, const char *shellname,
const char *text, ...);
void destroy_message_dialog(Widget button);
Index: client/gui-xaw/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-xaw/menu.c,v
retrieving revision 1.69.2.1
diff -u -r1.69.2.1 menu.c
--- client/gui-xaw/menu.c 10 Nov 2004 17:02:03 -0000 1.69.2.1
+++ client/gui-xaw/menu.c 20 Nov 2004 17:52:33 -0000
@@ -558,7 +558,7 @@
popup_worklists_dialog(game.player_ptr);
break;
case MENU_GOVERNMENT_REVOLUTION:
- popup_revolution_dialog();
+ popup_revolution_dialog(-1);
break;
}
}
@@ -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));
+ }
}
/****************************************************************
|
|