[Freeciv-Dev] (PR#13275) client option to dissolve the government
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13275 >
This patch adds a client menu choice to dissolve the government. The
civ is dropped into anarchy and the target government is set to the
original government.
See PR#13222. This is needed so that a player may easily dissolve the
senate to declare war in republic.
-jason
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.523
diff -u -r1.523 packhand.c
--- client/packhand.c 8 Jun 2005 18:26:03 -0000 1.523
+++ client/packhand.c 16 Jun 2005 17:39:45 -0000
@@ -1407,6 +1407,19 @@
}
/**************************************************************************
+ Dissolve the government, dropping us into anarchy and setting the target
+ to reform the current government.
+**************************************************************************/
+void dissolve_government(void)
+{
+ int government = game.player_ptr->government;
+
+ dsend_packet_player_change_government(&aconnection,
+ game.info.government_when_anarchy);
+ dsend_packet_player_change_government(&aconnection, government);
+}
+
+/**************************************************************************
...
**************************************************************************/
void handle_player_info(struct packet_player_info *pinfo)
Index: client/packhand.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.h,v
retrieving revision 1.38
diff -u -r1.38 packhand.h
--- client/packhand.h 29 Sep 2004 02:24:19 -0000 1.38
+++ client/packhand.h 16 Jun 2005 17:39:45 -0000
@@ -28,5 +28,6 @@
void target_government_init(void);
void set_government_choice(int government);
void start_revolution(void);
+void dissolve_government(void);
#endif /* FC__PACKHAND_H */
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.106
diff -u -r1.106 dialogs.c
--- client/gui-gtk-2.0/dialogs.c 7 Jun 2005 06:17:10 -0000 1.106
+++ client/gui-gtk-2.0/dialogs.c 16 Jun 2005 17:39:46 -0000
@@ -1062,6 +1062,43 @@
}
}
+/****************************************************************************
+ Called when a response is clicked to the dissolve dialog.
+****************************************************************************/
+static void dissolve_response(GtkWidget *w, gint response, gpointer data)
+{
+ if (response == GTK_RESPONSE_YES) {
+ dissolve_government();
+ }
+ if (w) {
+ gtk_widget_destroy(w);
+ }
+}
+
+/****************************************************************************
+ Pops up the dissolve dialog when the player chooses to dissolve the
+ government.
+****************************************************************************/
+void popup_dissolve_dialog(void)
+{
+ static GtkWidget *shell = NULL;
+
+ if (!shell) {
+ shell = gtk_message_dialog_new(NULL, 0,
+ GTK_MESSAGE_WARNING, GTK_BUTTONS_YES_NO,
+ _("Are you sure you want to dissolve "
+ "your government?"));
+ gtk_window_set_title(GTK_WINDOW(shell), _("Dissolve Government?"));
+ setup_dialog(shell, toplevel);
+
+ g_signal_connect(shell, "destroy",
+ G_CALLBACK(gtk_widget_destroyed), &shell);
+ }
+ g_signal_connect(shell, "response",
+ G_CALLBACK(dissolve_response), NULL);
+
+ gtk_window_present(GTK_WINDOW(shell));
+}
/****************************************************************
...
Index: client/gui-gtk-2.0/dialogs.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/dialogs.h,v
retrieving revision 1.8
diff -u -r1.8 dialogs.h
--- client/gui-gtk-2.0/dialogs.h 3 Apr 2005 11:34:58 -0000 1.8
+++ client/gui-gtk-2.0/dialogs.h 16 Jun 2005 17:39:46 -0000
@@ -20,6 +20,7 @@
#include "dialogs_g.h"
void popup_revolution_dialog(int government);
+void popup_dissolve_dialog(void);
void message_dialog_button_set_sensitive(GtkWidget *shl, int button,
gboolean state);
GtkWidget *popup_message_dialog(GtkWindow *parent, const gchar *dialogname,
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.78
diff -u -r1.78 menu.c
--- client/gui-gtk-2.0/menu.c 7 Jun 2005 06:17:10 -0000 1.78
+++ client/gui-gtk-2.0/menu.c 16 Jun 2005 17:39:46 -0000
@@ -93,6 +93,7 @@
MENU_GOVERNMENT_FIND_CITY,
MENU_GOVERNMENT_WORKLISTS,
MENU_GOVERNMENT_REVOLUTION,
+ MENU_GOVERNMENT_DISSOLVE,
MENU_VIEW_SHOW_CITY_OUTLINES,
MENU_VIEW_SHOW_MAP_GRID,
@@ -282,6 +283,9 @@
case MENU_GOVERNMENT_REVOLUTION:
popup_revolution_dialog(-1);
break;
+ case MENU_GOVERNMENT_DISSOLVE:
+ popup_dissolve_dialog();
+ break;
}
}
@@ -729,6 +733,8 @@
government_menu_callback, MENU_GOVERNMENT_REVOLUTION
},
{ "/" N_("_Government") "/" N_("_Change Government") "/sep1", NULL,
NULL, 0,
"<Separator>" },
+ { "/" N_("_Government") "/" N_("_Dissolve Government"), NULL,
+ government_menu_callback, MENU_GOVERNMENT_DISSOLVE},
/* View menu ... */
{ "/" N_("_View"), NULL,
NULL, 0,
"<Branch>" },
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#13275) client option to dissolve the government,
Jason Short <=
|
|