Author: sveinung Date: Wed May 17 12:45:22 2017 New Revision: 35620 URL: http://svn.gna.org/viewcvs/freeciv?rev=35620&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: trunk/client/gui-gtk-3.0/action_dialog.c trunk/client/gui-gtk-3.22/action_dialog.c trunk/client/gui-gtk-4.0/action_dialog.c trunk/client/gui-qt/dialogs.cpp trunk/client/gui-sdl2/action_dialog.c trunk/client/gui-stub/dialogs.c trunk/client/include/dialogs_g.h trunk/client/packhand.c Modified: trunk/client/gui-gtk-3.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/action_dialog.c?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/gui-gtk-3.0/action_dialog.c (original) +++ trunk/client/gui-gtk-3.0/action_dialog.c Wed May 17 12:45:22 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: trunk/client/gui-gtk-3.22/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/action_dialog.c?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/gui-gtk-3.22/action_dialog.c (original) +++ trunk/client/gui-gtk-3.22/action_dialog.c Wed May 17 12:45:22 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: trunk/client/gui-gtk-4.0/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-4.0/action_dialog.c?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/gui-gtk-4.0/action_dialog.c (original) +++ trunk/client/gui-gtk-4.0/action_dialog.c Wed May 17 12:45:22 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: trunk/client/gui-qt/dialogs.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/gui-qt/dialogs.cpp (original) +++ trunk/client/gui-qt/dialogs.cpp Wed May 17 12:45:22 2017 @@ -2502,7 +2502,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]; @@ -2540,7 +2541,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: trunk/client/gui-sdl2/action_dialog.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/action_dialog.c?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/gui-sdl2/action_dialog.c (original) +++ trunk/client/gui-sdl2/action_dialog.c Wed May 17 12:45:22 2017 @@ -1964,7 +1964,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; @@ -1979,7 +1980,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; } @@ -1989,7 +1990,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: trunk/client/gui-stub/dialogs.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-stub/dialogs.c?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/gui-stub/dialogs.c (original) +++ trunk/client/gui-stub/dialogs.c Wed May 17 12:45:22 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: trunk/client/include/dialogs_g.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/include/dialogs_g.h?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/include/dialogs_g.h (original) +++ trunk/client/include/dialogs_g.h Wed May 17 12:45:22 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: trunk/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=35620&r1=35619&r2=35620&view=diff ============================================================================== --- trunk/client/packhand.c (original) +++ trunk/client/packhand.c Wed May 17 12:45:22 2017 @@ -4413,6 +4413,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)) { @@ -4455,7 +4456,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