Author: sveinung
Date: Wed May 17 12:46:33 2017
New Revision: 35624

URL: http://svn.gna.org/viewcvs/freeciv?rev=35624&view=rev
Log:
Prepare popup_incite_dialog() for gen actions.

Make popup_incite_dialog() take the action it is a response to as a
parameter. This allows more than one action to use it.

See hrm Feature #660843

Modified:
    branches/S3_0/client/gui-gtk-2.0/action_dialog.c
    branches/S3_0/client/gui-gtk-3.0/action_dialog.c
    branches/S3_0/client/gui-gtk-3.22/action_dialog.c
    branches/S3_0/client/gui-qt/dialogs.cpp
    branches/S3_0/client/gui-sdl2/action_dialog.c
    branches/S3_0/client/gui-stub/dialogs.c
    branches/S3_0/client/include/dialogs_g.h
    branches/S3_0/client/packhand.c

Modified: branches/S3_0/client/gui-gtk-2.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-gtk-2.0/action_dialog.c?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/gui-gtk-2.0/action_dialog.c    (original)
+++ branches/S3_0/client/gui-gtk-2.0/action_dialog.c    Wed May 17 12:46:33 2017
@@ -1205,7 +1205,8 @@
 /*************************************************************************
 Popup the yes/no dialog for inciting, since we know the cost now
 **************************************************************************/
-void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost)
+void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost,
+                         const struct action *paction)
 {
   GtkWidget *shell;
   char buf[1024];
@@ -1243,8 +1244,7 @@
   gtk_window_present(GTK_WINDOW(shell));
   
   g_signal_connect(shell, "response", G_CALLBACK(incite_response),
-                   act_data(ACTION_SPY_INCITE_CITY,
-                            actor->id, pcity->id, 0, 0, cost));
+                   act_data(paction->id, actor->id, pcity->id, 0, 0, cost));
 }
 
 

Modified: branches/S3_0/client/gui-gtk-3.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-gtk-3.0/action_dialog.c?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/gui-gtk-3.0/action_dialog.c    (original)
+++ branches/S3_0/client/gui-gtk-3.0/action_dialog.c    Wed May 17 12:46:33 2017
@@ -1225,7 +1225,8 @@
 /*************************************************************************
 Popup the yes/no dialog for inciting, since we know the cost now
 **************************************************************************/
-void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost)
+void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost,
+                         const struct action *paction)
 {
   GtkWidget *shell;
   char buf[1024];
@@ -1263,8 +1264,7 @@
   gtk_window_present(GTK_WINDOW(shell));
   
   g_signal_connect(shell, "response", G_CALLBACK(incite_response),
-                   act_data(ACTION_SPY_INCITE_CITY,
-                            actor->id, pcity->id, 0, 0, cost));
+                   act_data(paction->id, actor->id, pcity->id, 0, 0, cost));
 }
 
 /**************************************************************************

Modified: branches/S3_0/client/gui-gtk-3.22/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-gtk-3.22/action_dialog.c?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/gui-gtk-3.22/action_dialog.c   (original)
+++ branches/S3_0/client/gui-gtk-3.22/action_dialog.c   Wed May 17 12:46:33 2017
@@ -1219,7 +1219,8 @@
 /*************************************************************************
 Popup the yes/no dialog for inciting, since we know the cost now
 **************************************************************************/
-void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost)
+void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost,
+                         const struct action *paction)
 {
   GtkWidget *shell;
   char buf[1024];
@@ -1257,8 +1258,7 @@
   gtk_window_present(GTK_WINDOW(shell));
   
   g_signal_connect(shell, "response", G_CALLBACK(incite_response),
-                   act_data(ACTION_SPY_INCITE_CITY,
-                            actor->id, pcity->id, 0, 0, cost));
+                   act_data(paction->id, actor->id, pcity->id, 0, 0, cost));
 }
 
 /**************************************************************************

Modified: branches/S3_0/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-qt/dialogs.cpp?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/gui-qt/dialogs.cpp     (original)
+++ branches/S3_0/client/gui-qt/dialogs.cpp     Wed May 17 12:46:33 2017
@@ -2501,7 +2501,8 @@
   Popup a window asking a diplomatic unit if it wishes to incite the
   given enemy city.
 **************************************************************************/
-void popup_incite_dialog(struct unit *actor, struct city *tcity, int cost)
+void popup_incite_dialog(struct unit *actor, struct city *tcity, int cost,
+                         const struct action *paction)
 {
   char buf[1024];
   char buf2[1024];
@@ -2539,7 +2540,7 @@
     case QMessageBox::Cancel:
       break;
     case QMessageBox::Ok:
-      request_do_action(ACTION_SPY_INCITE_CITY, diplomat_id,
+      request_do_action(paction->id, diplomat_id,
                         diplomat_target_id, 0, "");
       break;
     }

Modified: branches/S3_0/client/gui-sdl2/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-sdl2/action_dialog.c?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/gui-sdl2/action_dialog.c       (original)
+++ branches/S3_0/client/gui-sdl2/action_dialog.c       Wed May 17 12:46:33 2017
@@ -1963,7 +1963,8 @@
   Popup a window asking a diplomatic unit if it wishes to incite the
   given enemy city.
 **************************************************************************/
-void popup_incite_dialog(struct unit *actor, struct city *pCity, int cost)
+void popup_incite_dialog(struct unit *actor, struct city *pCity, int cost,
+                         const struct action *paction)
 {
   struct widget *pWindow = NULL, *pBuf = NULL;
   utf8_str *pstr;
@@ -1978,7 +1979,7 @@
   /* Should be set before sending request to the server. */
   fc_assert(is_more_user_input_needed);
 
-  if (!actor || !unit_can_do_action(actor, ACTION_SPY_INCITE_CITY)) {
+  if (!actor || !unit_can_do_action(actor, paction->id)) {
     act_sel_done_secondary(actor ? actor->id : IDENTITY_NUMBER_ZERO);
     return;
   }
@@ -1988,7 +1989,7 @@
   pIncite_Dlg = fc_calloc(1, sizeof(struct small_diplomat_dialog));
   pIncite_Dlg->actor_unit_id = actor->id;
   pIncite_Dlg->target_id = pCity->id;
-  pIncite_Dlg->action_id = ACTION_SPY_INCITE_CITY;
+  pIncite_Dlg->action_id = paction->id;
   pIncite_Dlg->pdialog = fc_calloc(1, sizeof(struct SMALL_DLG));
 
   fc_snprintf(tBuf, ARRAY_SIZE(tBuf), PL_("Treasury contains %d gold.",

Modified: branches/S3_0/client/gui-stub/dialogs.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/gui-stub/dialogs.c?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/gui-stub/dialogs.c     (original)
+++ branches/S3_0/client/gui-stub/dialogs.c     Wed May 17 12:46:33 2017
@@ -128,7 +128,8 @@
   Popup a window asking a diplomatic unit if it wishes to incite the
   given enemy city.
 **************************************************************************/
-void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost)
+void popup_incite_dialog(struct unit *actor, struct city *pcity, int cost,
+                         const struct action *paction)
 {
   /* PORTME */
 }

Modified: branches/S3_0/client/include/dialogs_g.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/include/dialogs_g.h?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/include/dialogs_g.h    (original)
+++ branches/S3_0/client/include/dialogs_g.h    Wed May 17 12:46:33 2017
@@ -63,7 +63,7 @@
                struct tile *target_tile,
                const struct act_prob *act_probs)
 GUI_FUNC_PROTO(void, popup_incite_dialog, struct unit *actor,
-               struct city *pcity, int cost)
+               struct city *pcity, int cost, const struct action *paction)
 GUI_FUNC_PROTO(void, popup_bribe_dialog, struct unit *actor,
                struct unit *punit, int cost)
 GUI_FUNC_PROTO(void, popup_sabotage_dialog, struct unit *actor,

Modified: branches/S3_0/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/packhand.c?rev=35624&r1=35623&r2=35624&view=diff
==============================================================================
--- branches/S3_0/client/packhand.c     (original)
+++ branches/S3_0/client/packhand.c     Wed May 17 12:46:33 2017
@@ -4412,6 +4412,7 @@
   struct unit *punit = game_unit_by_number(target_id);
   struct unit *pdiplomat = player_unit_by_number(client_player(),
                                                  diplomat_id);
+  struct action *paction = action_by_number(action_type);
 
   if (ACTION_NONE != action_type
       && !action_id_exists(action_type)) {
@@ -4454,7 +4455,7 @@
       /* Focus on the unit so the player knows where it is */
       unit_focus_set(pdiplomat);
 
-      popup_incite_dialog(pdiplomat, pcity, cost);
+      popup_incite_dialog(pdiplomat, pcity, cost, paction);
     } else {
       log_debug("Bad target %d.", target_id);
       action_selection_no_longer_in_progress(diplomat_id);


_______________________________________________
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits

Reply via email to