Author: sveinung Date: Wed May 17 12:46:52 2017 New Revision: 35626 URL: http://svn.gna.org/viewcvs/freeciv?rev=35626&view=rev Log: Prepare popup_bribe_dialog() for gen actions.
Make popup_bribe_dialog() take the action it is a response to as a parameter. This allows more than one action to use it. See hrm Feature #660895 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=35626&r1=35625&r2=35626&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:52 2017 @@ -439,7 +439,8 @@ /************************************************************************* Popup unit bribe dialog **************************************************************************/ -void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost) +void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost, + const struct action *paction) { GtkWidget *shell; char buf[1024]; @@ -469,8 +470,7 @@ gtk_window_present(GTK_WINDOW(shell)); g_signal_connect(shell, "response", G_CALLBACK(bribe_response), - act_data(ACTION_SPY_BRIBE_UNIT, - actor->id, 0, punit->id, 0, cost)); + act_data(paction->id, actor->id, 0, punit->id, 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=35626&r1=35625&r2=35626&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:52 2017 @@ -449,7 +449,8 @@ /************************************************************************* Popup unit bribe dialog **************************************************************************/ -void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost) +void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost, + const struct action *paction) { GtkWidget *shell; char buf[1024]; @@ -479,8 +480,7 @@ gtk_window_present(GTK_WINDOW(shell)); g_signal_connect(shell, "response", G_CALLBACK(bribe_response), - act_data(ACTION_SPY_BRIBE_UNIT, - actor->id, 0, punit->id, 0, cost)); + act_data(paction->id, actor->id, 0, punit->id, 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=35626&r1=35625&r2=35626&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:52 2017 @@ -449,7 +449,8 @@ /************************************************************************* Popup unit bribe dialog **************************************************************************/ -void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost) +void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost, + const struct action *paction) { GtkWidget *shell; char buf[1024]; @@ -479,8 +480,7 @@ gtk_window_present(GTK_WINDOW(shell)); g_signal_connect(shell, "response", G_CALLBACK(bribe_response), - act_data(ACTION_SPY_BRIBE_UNIT, - actor->id, 0, punit->id, 0, cost)); + act_data(paction->id, actor->id, 0, punit->id, 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=35626&r1=35625&r2=35626&view=diff ============================================================================== --- branches/S3_0/client/gui-qt/dialogs.cpp (original) +++ branches/S3_0/client/gui-qt/dialogs.cpp Wed May 17 12:46:52 2017 @@ -2583,7 +2583,8 @@ Popup a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit. **************************************************************************/ -void popup_bribe_dialog(struct unit *actor, struct unit *tunit, int cost) +void popup_bribe_dialog(struct unit *actor, struct unit *tunit, int cost, + const struct action *paction) { hud_message_box ask(gui()->central_wdg); int ret; @@ -2612,7 +2613,7 @@ case QMessageBox::Cancel: break; case QMessageBox::Ok: - request_do_action(ACTION_SPY_BRIBE_UNIT, diplomat_id, + request_do_action(paction->id, diplomat_id, diplomat_target_id, 0, ""); break; default: 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=35626&r1=35625&r2=35626&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:52 2017 @@ -2249,7 +2249,8 @@ Popup a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit. **************************************************************************/ -void popup_bribe_dialog(struct unit *actor, struct unit *pUnit, int cost) +void popup_bribe_dialog(struct unit *actor, struct unit *pUnit, int cost, + const struct action *paction) { struct widget *pWindow = NULL, *pBuf = NULL; utf8_str *pstr; @@ -2264,7 +2265,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_BRIBE_UNIT)) { + if (!actor || !unit_can_do_action(actor, paction->id)) { act_sel_done_secondary(actor ? actor->id : IDENTITY_NUMBER_ZERO); return; } @@ -2272,7 +2273,7 @@ is_unit_move_blocked = TRUE; pBribe_Dlg = fc_calloc(1, sizeof(struct small_diplomat_dialog)); - pBribe_Dlg->action_id = ACTION_SPY_BRIBE_UNIT; + pBribe_Dlg->action_id = paction->id; pBribe_Dlg->actor_unit_id = actor->id; pBribe_Dlg->target_id = pUnit->id; pBribe_Dlg->pdialog = fc_calloc(1, sizeof(struct SMALL_DLG)); 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=35626&r1=35625&r2=35626&view=diff ============================================================================== --- branches/S3_0/client/gui-stub/dialogs.c (original) +++ branches/S3_0/client/gui-stub/dialogs.c Wed May 17 12:46:52 2017 @@ -138,7 +138,8 @@ Popup a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit. **************************************************************************/ -void popup_bribe_dialog(struct unit *actor, struct unit *punit, int cost) +void popup_bribe_dialog(struct unit *actor, struct unit *punit, 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=35626&r1=35625&r2=35626&view=diff ============================================================================== --- branches/S3_0/client/include/dialogs_g.h (original) +++ branches/S3_0/client/include/dialogs_g.h Wed May 17 12:46:52 2017 @@ -65,7 +65,7 @@ GUI_FUNC_PROTO(void, popup_incite_dialog, struct unit *actor, struct city *pcity, int cost, const struct action *paction) GUI_FUNC_PROTO(void, popup_bribe_dialog, struct unit *actor, - struct unit *punit, int cost) + struct unit *punit, int cost, const struct action *paction) GUI_FUNC_PROTO(void, popup_sabotage_dialog, struct unit *actor, struct city *pcity) GUI_FUNC_PROTO(void, popup_pillage_dialog, struct unit *punit, bv_extras extras) Modified: branches/S3_0/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/packhand.c?rev=35626&r1=35625&r2=35626&view=diff ============================================================================== --- branches/S3_0/client/packhand.c (original) +++ branches/S3_0/client/packhand.c Wed May 17 12:46:52 2017 @@ -4441,7 +4441,7 @@ /* Focus on the unit so the player knows where it is */ unit_focus_set(pdiplomat); - popup_bribe_dialog(pdiplomat, punit, cost); + popup_bribe_dialog(pdiplomat, punit, 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