From 2dd2dfaca1632b0aa3f0ebb9d98d3198890eaebc Mon Sep 17 00:00:00 2001 From: Sveinung Kvilhaugsvik Date: Tue, 13 Jul 2021 10:33:15 +0200 Subject: [PATCH 01/11] Allow more than one kind of background request. The C clients currently use the action selection background request to refresh the action selection dialog on new information. Freeciv-web uses it to implement fast auto attack. Make it possible to have more than one background request kind by changing request kind to a number. The foreground request that should disturb the player gets the number 0. The others are client defined background request numbers. Give action selection dialog refresh the number 1 in the bundled C clients. See osdn #42620 --- client/control.c | 4 +- client/gui-gtk-3.0/action_dialog.c | 8 +- client/gui-gtk-3.22/action_dialog.c | 8 +- client/gui-gtk-4.0/action_dialog.c | 8 +- client/gui-qt/dialogs.cpp | 2 +- client/packhand.c | 169 +++++++++++++++------------- common/networking/packets.def | 10 +- common/networking/packets.h | 5 + fc_version | 2 +- server/diplomats.c | 4 +- server/diplomats.h | 2 +- server/unithand.c | 54 ++++----- 12 files changed, 146 insertions(+), 130 deletions(-) diff --git a/client/control.c b/client/control.c index 4743739be0..e6dad9becd 100644 --- a/client/control.c +++ b/client/control.c @@ -374,7 +374,7 @@ static void ask_server_for_actions(struct unit *punit) IDENTITY_NUMBER_ZERO, tile_index(punit->action_decision_tile), EXTRA_NONE, - TRUE); + REQEST_PLAYER_INITIATED); } /**********************************************************************//** @@ -1696,7 +1696,7 @@ void request_action_details(action_id action, int actor_id, /* Users that need the answer in the * background should send the packet them * self. At least for now. */ - TRUE); + REQEST_PLAYER_INITIATED); } /**********************************************************************//** diff --git a/client/gui-gtk-3.0/action_dialog.c b/client/gui-gtk-3.0/action_dialog.c index 9b0aa068fb..192393d2c7 100644 --- a/client/gui-gtk-3.0/action_dialog.c +++ b/client/gui-gtk-3.0/action_dialog.c @@ -1038,14 +1038,14 @@ static void tgt_unit_change_callback(GtkWidget *dlg, gint arg) IDENTITY_NUMBER_ZERO, tgt_tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } else { dsend_packet_unit_get_actions(&client.conn, actor->id, tgt_id, tgt_tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } } } else { @@ -1109,14 +1109,14 @@ static void tgt_extra_change_callback(GtkWidget *dlg, gint arg) /* Let the server choose the target * extra. */ action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } else { dsend_packet_unit_get_actions(&client.conn, actor->id, action_selection_target_unit(), tgt_tile->index, tgt_id, - TRUE); + REQEST_PLAYER_INITIATED); } } } else { diff --git a/client/gui-gtk-3.22/action_dialog.c b/client/gui-gtk-3.22/action_dialog.c index 24b9f37d6a..c1d71a10f2 100644 --- a/client/gui-gtk-3.22/action_dialog.c +++ b/client/gui-gtk-3.22/action_dialog.c @@ -1032,14 +1032,14 @@ static void tgt_unit_change_callback(GtkWidget *dlg, gint arg) IDENTITY_NUMBER_ZERO, tgt_tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } else { dsend_packet_unit_get_actions(&client.conn, actor->id, tgt_id, tgt_tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } } } else { @@ -1103,14 +1103,14 @@ static void tgt_extra_change_callback(GtkWidget *dlg, gint arg) /* Let the server choose the target * extra. */ action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } else { dsend_packet_unit_get_actions(&client.conn, actor->id, action_selection_target_unit(), tgt_tile->index, tgt_id, - TRUE); + REQEST_PLAYER_INITIATED); } } } else { diff --git a/client/gui-gtk-4.0/action_dialog.c b/client/gui-gtk-4.0/action_dialog.c index 3d1aa563bb..58b57013bd 100644 --- a/client/gui-gtk-4.0/action_dialog.c +++ b/client/gui-gtk-4.0/action_dialog.c @@ -1030,14 +1030,14 @@ static void tgt_unit_change_callback(GtkWidget *dlg, gint arg) IDENTITY_NUMBER_ZERO, tgt_tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } else { dsend_packet_unit_get_actions(&client.conn, actor->id, tgt_id, tgt_tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } } } else { @@ -1101,14 +1101,14 @@ static void tgt_extra_change_callback(GtkWidget *dlg, gint arg) /* Let the server choose the target * extra. */ action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); } else { dsend_packet_unit_get_actions(&client.conn, actor->id, action_selection_target_unit(), tgt_tile->index, tgt_id, - TRUE); + REQEST_PLAYER_INITIATED); } } } else { diff --git a/client/gui-qt/dialogs.cpp b/client/gui-qt/dialogs.cpp index 872802071c..fcd3ee471a 100644 --- a/client/gui-qt/dialogs.cpp +++ b/client/gui-qt/dialogs.cpp @@ -1640,7 +1640,7 @@ void choice_dialog::switch_target() targeted_unit->id, targeted_unit->tile->index, action_selection_target_extra(), - TRUE); + REQEST_PLAYER_INITIATED); layout->addLayout(unit_skip); } diff --git a/client/packhand.c b/client/packhand.c index 08f1ea2e2f..6d94ca3256 100644 --- a/client/packhand.c +++ b/client/packhand.c @@ -134,6 +134,9 @@ extern const char forced_tileset_name[]; static int last_turn = 0; +/* Refresh the action selection dialog */ +#define REQEST_BACKGROUND_REFRESH (1) + /************************************************************************//** Called below, and by client/client_main.c client_game_free() ****************************************************************************/ @@ -894,7 +897,7 @@ void handle_city_info(const struct packet_city_info *packet) action_selection_target_unit(), city_tile(pcity)->index, action_selection_target_extra(), - FALSE); + REQEST_BACKGROUND_REFRESH); } if (gui_options.draw_city_trade_routes @@ -2665,7 +2668,7 @@ void handle_player_diplstate(const struct packet_player_diplstate *packet) action_selection_target_unit(), tgt_tile->index, action_selection_target_extra(), - FALSE); + REQEST_BACKGROUND_REFRESH); } } } @@ -4633,7 +4636,7 @@ void handle_city_name_suggestion_info(int unit_id, const char *name) ****************************************************************************/ void handle_unit_action_answer(int actor_id, int target_id, int cost, action_id action_type, - bool disturb_player) + int request_kind) { struct city *pcity = game_city_by_number(target_id); struct unit *punit = game_unit_by_number(target_id); @@ -4646,7 +4649,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, log_error("handle_unit_action_answer() the action %d doesn't exist.", action_type); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); action_selection_next_in_focus(actor_id); @@ -4658,7 +4661,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, if (!pactor) { log_debug("Bad actor %d.", actor_id); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_selection_next_in_focus(actor_id); } @@ -4670,7 +4673,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, case ACTION_SPY_BRIBE_UNIT: if (punit && client.conn.playing && is_human(client.conn.playing)) { - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { /* Focus on the unit so the player knows where it is */ unit_focus_set(pactor); @@ -4681,7 +4684,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, } } else { log_debug("Bad target %d.", target_id); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); action_selection_next_in_focus(actor_id); @@ -4692,7 +4695,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, case ACTION_SPY_INCITE_CITY_ESC: if (pcity && client.conn.playing && is_human(client.conn.playing)) { - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { /* Focus on the unit so the player knows where it is */ unit_focus_set(pactor); @@ -4703,7 +4706,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, } } else { log_debug("Bad target %d.", target_id); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); action_selection_next_in_focus(actor_id); @@ -4725,7 +4728,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, break; case ACTION_NONE: log_debug("Server didn't respond to query."); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); action_selection_next_in_focus(actor_id); @@ -4734,7 +4737,7 @@ void handle_unit_action_answer(int actor_id, int target_id, int cost, default: log_error("handle_unit_action_answer() invalid action_type (%d).", action_type); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); action_selection_next_in_focus(actor_id); @@ -4891,8 +4894,8 @@ static action_id auto_attack_act(const struct act_prob *act_probs) /************************************************************************//** Handle reply to possible actions. - Note that a reply to a foreground request (a reply where disturb_player - is true) must result in its clean up. + Note that a reply to a foreground request (a reply where + request_kind is REQEST_PLAYER_INITIATED) must result in its clean up. ****************************************************************************/ void handle_unit_actions(const struct packet_unit_actions *packet) { @@ -4906,7 +4909,7 @@ void handle_unit_actions(const struct packet_unit_actions *packet) const struct act_prob *act_probs = packet->action_probabilities; - bool disturb_player = packet->disturb_player; + int request_kind = packet->request_kind; bool valid = FALSE; /* The dead can't act */ @@ -4920,74 +4923,78 @@ void handle_unit_actions(const struct packet_unit_actions *packet) } action_iterate_end; } - if (valid && disturb_player) { - /* The player can select an action and should be informed. */ + switch (request_kind) { + case REQEST_PLAYER_INITIATED: + if (valid) { + /* The player can select an action and should be informed. */ - action_id auto_action; + action_id auto_action; - if (gui_options.popup_attack_actions) { - /* Pop up the action selection dialog no matter what. */ - auto_action = ACTION_NONE; - } else { - /* Pop up the action selection dialog unless the only interesting - * action the unit may be able to do is an attack action. */ - auto_action = auto_attack_act(act_probs); - } - - if (auto_action != ACTION_NONE) { - /* No interesting actions except a single attack action has been - * found. The player wants it performed without questions. */ - - /* The order requests below doesn't send additional details. */ - fc_assert(!action_id_requires_details(auto_action)); - - /* Give the order. */ - switch (action_id_get_target_kind(auto_action)) { - case ATK_TILE: - case ATK_UNITS: - case ATK_EXTRAS: - request_do_action(auto_action, - packet->actor_unit_id, packet->target_tile_id, - 0, ""); - break; - case ATK_CITY: - request_do_action(auto_action, - packet->actor_unit_id, packet->target_city_id, - 0, ""); - break; - case ATK_UNIT: - request_do_action(auto_action, - packet->actor_unit_id, packet->target_unit_id, - 0, ""); - break; - case ATK_SELF: - request_do_action(auto_action, - packet->actor_unit_id, packet->actor_unit_id, - 0, ""); - break; - case ATK_COUNT: - fc_assert(action_id_get_target_kind(auto_action) != ATK_COUNT); - break; + if (gui_options.popup_attack_actions) { + /* Pop up the action selection dialog no matter what. */ + auto_action = ACTION_NONE; + } else { + /* Pop up the action selection dialog unless the only interesting + * action the unit may be able to do is an attack action. */ + auto_action = auto_attack_act(act_probs); } - /* Clean up. */ + if (auto_action != ACTION_NONE) { + /* No interesting actions except a single attack action has been + * found. The player wants it performed without questions. */ + + /* The order requests below doesn't send additional details. */ + fc_assert(!action_id_requires_details(auto_action)); + + /* Give the order. */ + switch (action_id_get_target_kind(auto_action)) { + case ATK_TILE: + case ATK_UNITS: + case ATK_EXTRAS: + request_do_action(auto_action, + packet->actor_unit_id, packet->target_tile_id, + 0, ""); + break; + case ATK_CITY: + request_do_action(auto_action, + packet->actor_unit_id, packet->target_city_id, + 0, ""); + break; + case ATK_UNIT: + request_do_action(auto_action, + packet->actor_unit_id, packet->target_unit_id, + 0, ""); + break; + case ATK_SELF: + request_do_action(auto_action, + packet->actor_unit_id, packet->actor_unit_id, + 0, ""); + break; + case ATK_COUNT: + fc_assert(action_id_get_target_kind(auto_action) != ATK_COUNT); + break; + } + + /* Clean up. */ + action_selection_no_longer_in_progress(packet->actor_unit_id); + action_decision_clear_want(packet->actor_unit_id); + action_selection_next_in_focus(packet->actor_unit_id); + } else { + /* Show the client specific action dialog */ + popup_action_selection(actor_unit, + target_city, target_unit, + target_tile, target_extra, + act_probs); + } + } else { + /* Nothing to do. */ action_selection_no_longer_in_progress(packet->actor_unit_id); action_decision_clear_want(packet->actor_unit_id); action_selection_next_in_focus(packet->actor_unit_id); - } else { - /* Show the client specific action dialog */ - popup_action_selection(actor_unit, - target_city, target_unit, - target_tile, target_extra, - act_probs); } - } else if (disturb_player) { - /* Nothing to do. */ - action_selection_no_longer_in_progress(packet->actor_unit_id); - action_decision_clear_want(packet->actor_unit_id); - action_selection_next_in_focus(packet->actor_unit_id); - } else { - /* This was a background request. */ + break; + case REQEST_BACKGROUND_REFRESH: + /* This was a background action selection dialog refresh. */ if (action_selection_actor_unit() == actor_unit->id) { /* The situation may have changed. */ @@ -4996,6 +5003,10 @@ void handle_unit_actions(const struct packet_unit_actions *packet) target_tile, target_extra, act_probs); } + break; + default: + log_warn("Unknown request_kind %d in reply", request_kind); + break; } } @@ -5005,7 +5016,7 @@ void handle_unit_actions(const struct packet_unit_actions *packet) void handle_city_sabotage_list(int actor_id, int city_id, bv_imprs improvements, action_id act_id, - bool disturb_player) + int request_kind) { struct city *pcity = game_city_by_number(city_id); struct unit *pactor = player_unit_by_number(client_player(), actor_id); @@ -5014,7 +5025,7 @@ void handle_city_sabotage_list(int actor_id, int city_id, if (!pactor) { log_debug("Bad diplomat %d.", actor_id); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_selection_next_in_focus(actor_id); } @@ -5025,7 +5036,7 @@ void handle_city_sabotage_list(int actor_id, int city_id, if (!pcity) { log_debug("Bad city %d.", city_id); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); action_selection_next_in_focus(actor_id); @@ -5041,7 +5052,7 @@ void handle_city_sabotage_list(int actor_id, int city_id, improvement_index(pimprove))); } improvement_iterate_end; - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { /* Focus on the unit so the player knows where it is */ unit_focus_set(pactor); @@ -5052,7 +5063,7 @@ void handle_city_sabotage_list(int actor_id, int city_id, } } else { log_debug("Can't issue orders"); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { action_selection_no_longer_in_progress(actor_id); action_decision_clear_want(actor_id); } diff --git a/common/networking/packets.def b/common/networking/packets.def index 5b48a69a2b..e8c7529051 100644 --- a/common/networking/packets.def +++ b/common/networking/packets.def @@ -857,7 +857,7 @@ PACKET_CITY_SABOTAGE_LIST = 45; sc, lsend BV_IMPRS improvements; ACTION_ID act_id; - BOOL disturb_player; + UINT8 request_kind; end PACKET_CITY_RALLY_POINT = 138; cs @@ -1111,7 +1111,7 @@ PACKET_UNIT_ACTION_QUERY = 82; cs, handle-per-conn, dsend ACTION_TGT target_id; # city_id or unit_id ACTION_ID action_type; - BOOL disturb_player; + UINT8 request_kind; end PACKET_UNIT_TYPE_UPGRADE = 83; cs, dsend @@ -1132,7 +1132,7 @@ PACKET_UNIT_ACTION_ANSWER = 85; sc, dsend GOLD cost; ACTION_ID action_type; - BOOL disturb_player; + UINT8 request_kind; end PACKET_UNIT_GET_ACTIONS = 87; cs, handle-per-conn, dsend @@ -1141,7 +1141,7 @@ PACKET_UNIT_GET_ACTIONS = 87; cs, handle-per-conn, dsend TILE target_tile_id; EXTRA target_extra_id; - BOOL disturb_player; + UINT8 request_kind; end PACKET_UNIT_ACTIONS = 90; sc, dsend @@ -1151,7 +1151,7 @@ PACKET_UNIT_ACTIONS = 90; sc, dsend TILE target_tile_id; EXTRA target_extra_id; - BOOL disturb_player; + UINT8 request_kind; /* How to interpret action probabilities is documented in fc_types.h */ ACT_PROB action_probabilities[MAX_NUM_ACTIONS]; diff --git a/common/networking/packets.h b/common/networking/packets.h index 646e0d15f4..bf3d249985 100644 --- a/common/networking/packets.h +++ b/common/networking/packets.h @@ -64,6 +64,11 @@ struct data_in; */ #define ATTRIBUTE_CHUNK_SIZE (1400) +/* Indicates that the player initiated a request. + * + * Used in network protocol. */ +#define REQEST_PLAYER_INITIATED (0) + /* Used in network protocol. */ enum report_type { REPORT_WONDERS_OF_THE_WORLD, diff --git a/fc_version b/fc_version index 3d8f03f03e..471c36b243 100755 --- a/fc_version +++ b/fc_version @@ -56,7 +56,7 @@ DEFAULT_FOLLOW_TAG=S3_1 # - No new mandatory capabilities can be added to the release branch; doing # so would break network capability of supposedly "compatible" releases. # -NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2021.Jun.25b" +NETWORK_CAPSTRING="+Freeciv.Devel-3.1-2021.Jul.14" FREECIV_DISTRIBUTOR="" diff --git a/server/diplomats.c b/server/diplomats.c index d07d4dcc39..9c9cde9734 100644 --- a/server/diplomats.c +++ b/server/diplomats.c @@ -410,7 +410,7 @@ bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat, void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat, struct city *pcity, const struct action *paction, - bool disturb_player) + int request_kind) { struct packet_city_sabotage_list packet; @@ -445,7 +445,7 @@ void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat, packet.actor_id = pdiplomat->id; packet.city_id = pcity->id; packet.act_id = paction->id; - packet.disturb_player = disturb_player; + packet.request_kind = request_kind; send_packet_city_sabotage_list(pc, &packet); } diff --git a/server/diplomats.h b/server/diplomats.h index d50dbd4ce8..a995c0cd10 100644 --- a/server/diplomats.h +++ b/server/diplomats.h @@ -23,7 +23,7 @@ bool diplomat_investigate(struct player *pplayer, struct unit *pdiplomat, void spy_send_sabotage_list(struct connection *pc, struct unit *pdiplomat, struct city *pcity, const struct action *paction, - bool disturb_player); + int request_kind); bool spy_poison(struct player *pplayer, struct unit *pdiplomat, struct city *pcity, const struct action *paction); bool spy_spread_plague(struct player *act_player, struct unit *act_unit, diff --git a/server/unithand.c b/server/unithand.c index fe49a0d324..5c7d77fa49 100644 --- a/server/unithand.c +++ b/server/unithand.c @@ -120,7 +120,7 @@ static void illegal_action(struct player *pplayer, struct tile *target_tile, const struct city *target_city, const struct unit *target_unit, - bool disturb_player, + int request_kind, const enum action_requester requester); static bool city_add_unit(struct player *pplayer, struct unit *punit, struct city *pcity, const struct action *paction); @@ -1969,7 +1969,7 @@ void handle_unit_get_actions(struct connection *pc, const int target_unit_id_client, const int target_tile_id, const int target_extra_id_client, - const bool disturb_player) + const int request_kind) { struct player *actor_player; struct unit *actor_unit; @@ -2005,7 +2005,7 @@ void handle_unit_get_actions(struct connection *pc, dsend_packet_unit_actions(pc, actor_unit_id, IDENTITY_NUMBER_ZERO, IDENTITY_NUMBER_ZERO, target_tile_id, target_extra_id, - disturb_player, + request_kind, probabilities); return; } @@ -2031,7 +2031,7 @@ void handle_unit_get_actions(struct connection *pc, dsend_packet_unit_actions(pc, actor_unit_id, IDENTITY_NUMBER_ZERO, IDENTITY_NUMBER_ZERO, target_tile_id, target_extra_id, - disturb_player, + request_kind, probabilities); return; } @@ -2210,10 +2210,10 @@ void handle_unit_get_actions(struct connection *pc, dsend_packet_unit_actions(pc, actor_unit_id, target_unit_id, target_city_id, target_tile_id, target_extra_id, - disturb_player, + request_kind, probabilities); - if (disturb_player && !at_least_one_action) { + if (request_kind == REQEST_PLAYER_INITIATED && !at_least_one_action) { /* The user should get an explanation why no action is possible. */ explain_why_no_action_enabled(actor_unit, target_tile, target_city, target_unit); @@ -2825,7 +2825,7 @@ static void illegal_action(struct player *pplayer, struct tile *target_tile, const struct city *target_city, const struct unit *target_unit, - bool disturb_player, + int request_kind, const enum action_requester requester) { bool information_revealed; @@ -2845,7 +2845,7 @@ static void illegal_action(struct player *pplayer, target_city, target_unit, target_tile, NULL)); - if (disturb_player) { + if (request_kind == REQEST_PLAYER_INITIATED) { /* This is a foreground request. */ illegal_action_msg(pplayer, (information_revealed ? E_UNIT_ILLEGAL_ACTION : E_BAD_COMMAND), @@ -2858,7 +2858,7 @@ static void illegal_action(struct player *pplayer, tgt_player, target_tile, requester); - if (!disturb_player && was_punished) { + if (request_kind != REQEST_PLAYER_INITIATED && was_punished) { /* FIXME: Temporary work around to prevent wrong information and/or * crashes. See hrm Bug #879880 */ /* TODO: Get the explanation before the punishment and show it here. @@ -2878,13 +2878,13 @@ static void illegal_action(struct player *pplayer, static void unit_query_impossible(struct connection *pc, const int actor_id, const int target_id, - bool disturb_player) + int request_kind) { dsend_packet_unit_action_answer(pc, actor_id, target_id, 0, ACTION_NONE, - disturb_player); + request_kind); } /**********************************************************************//** @@ -2898,7 +2898,7 @@ void handle_unit_action_query(struct connection *pc, const int actor_id, const int target_id, const action_id action_type, - bool disturb_player) + int request_kind) { struct player *pplayer = pc->playing; struct unit *pactor = player_unit_by_number(pplayer, actor_id); @@ -2911,7 +2911,7 @@ void handle_unit_action_query(struct connection *pc, log_error("handle_unit_action_query() the action %d doesn't exist.", action_type); - unit_query_impossible(pc, actor_id, target_id, disturb_player); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; } @@ -2919,7 +2919,7 @@ void handle_unit_action_query(struct connection *pc, /* Probably died or bribed. */ log_verbose("handle_unit_action_query() invalid actor %d", actor_id); - unit_query_impossible(pc, actor_id, target_id, disturb_player); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; } @@ -2931,12 +2931,12 @@ void handle_unit_action_query(struct connection *pc, dsend_packet_unit_action_answer(pc, actor_id, target_id, unit_bribe_cost(punit, pplayer), - action_type, disturb_player); + action_type, request_kind); } else { illegal_action(pplayer, pactor, action_type, punit ? unit_owner(punit) : NULL, - NULL, NULL, punit, disturb_player, ACT_REQ_PLAYER); - unit_query_impossible(pc, actor_id, target_id, disturb_player); + NULL, NULL, punit, request_kind, ACT_REQ_PLAYER); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; } break; @@ -2947,12 +2947,12 @@ void handle_unit_action_query(struct connection *pc, dsend_packet_unit_action_answer(pc, actor_id, target_id, city_incite_cost(pplayer, pcity), - action_type, disturb_player); + action_type, request_kind); } else { illegal_action(pplayer, pactor, action_type, pcity ? city_owner(pcity) : NULL, - NULL, pcity, NULL, disturb_player, ACT_REQ_PLAYER); - unit_query_impossible(pc, actor_id, target_id, disturb_player); + NULL, pcity, NULL, request_kind, ACT_REQ_PLAYER); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; } break; @@ -2972,12 +2972,12 @@ void handle_unit_action_query(struct connection *pc, dsend_packet_unit_action_answer(pc, actor_id, target_id, upgr_cost, action_type, - disturb_player); + request_kind); } else { illegal_action(pplayer, pactor, action_type, pcity ? city_owner(pcity) : NULL, - NULL, pcity, NULL, disturb_player, ACT_REQ_PLAYER); - unit_query_impossible(pc, actor_id, target_id, disturb_player); + NULL, pcity, NULL, request_kind, ACT_REQ_PLAYER); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; } break; @@ -2987,17 +2987,17 @@ void handle_unit_action_query(struct connection *pc, && is_action_enabled_unit_on_city(action_type, pactor, pcity)) { spy_send_sabotage_list(pc, pactor, pcity, - action_by_number(action_type), disturb_player); + action_by_number(action_type), request_kind); } else { illegal_action(pplayer, pactor, action_type, pcity ? city_owner(pcity) : NULL, - NULL, pcity, NULL, disturb_player, ACT_REQ_PLAYER); - unit_query_impossible(pc, actor_id, target_id, disturb_player); + NULL, pcity, NULL, request_kind, ACT_REQ_PLAYER); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; } break; default: - unit_query_impossible(pc, actor_id, target_id, disturb_player); + unit_query_impossible(pc, actor_id, target_id, request_kind); return; }; } -- 2.30.2