Bug #2448 ยป 0057-Rename-REQEST_-as-REQUEST_.patch
| client/control.c | ||
|---|---|---|
|
IDENTITY_NUMBER_ZERO,
|
||
|
tile_index(punit->action_decision_tile),
|
||
|
EXTRA_NONE,
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| ... | ... | |
|
/* Users that need the answer in the
|
||
|
* background should send the packet them
|
||
|
* self. At least for now. */
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
/**********************************************************************//**
|
||
| client/gui-gtk-3.22/action_dialog.c | ||
|---|---|---|
|
IDENTITY_NUMBER_ZERO,
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
} else {
|
||
|
dsend_packet_unit_get_actions(&client.conn,
|
||
|
actor->id,
|
||
|
tgt_id,
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
| ... | ... | |
|
/* Let the server choose the target
|
||
|
* extra. */
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
} else {
|
||
|
dsend_packet_unit_get_actions(&client.conn,
|
||
|
actor->id,
|
||
|
action_selection_target_unit(),
|
||
|
tgt_tile->index,
|
||
|
tgt_id,
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
| client/gui-gtk-4.0/action_dialog.c | ||
|---|---|---|
|
IDENTITY_NUMBER_ZERO,
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
} else {
|
||
|
dsend_packet_unit_get_actions(&client.conn,
|
||
|
actor->id,
|
||
|
tgt_id,
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
| ... | ... | |
|
/* Let the server choose the target
|
||
|
* extra. */
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
} else {
|
||
|
dsend_packet_unit_get_actions(&client.conn,
|
||
|
actor->id,
|
||
|
action_selection_target_unit(),
|
||
|
tgt_tile->index,
|
||
|
tgt_id,
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
| client/gui-gtk-5.0/action_dialog.c | ||
|---|---|---|
|
IDENTITY_NUMBER_ZERO,
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
} else {
|
||
|
dsend_packet_unit_get_actions(&client.conn,
|
||
|
actor->id,
|
||
|
tgt_id,
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
| ... | ... | |
|
/* Let the server choose the target
|
||
|
* extra. */
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
} else {
|
||
|
dsend_packet_unit_get_actions(&client.conn,
|
||
|
actor->id,
|
||
|
action_selection_target_unit(),
|
||
|
tgt_tile->index,
|
||
|
tgt_id,
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
}
|
||
|
}
|
||
|
} else {
|
||
| client/gui-qt/dialogs.cpp | ||
|---|---|---|
|
targeted_unit->id,
|
||
|
targeted_unit->tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_PLAYER_INITIATED);
|
||
|
REQUEST_PLAYER_INITIATED);
|
||
|
layout->addLayout(unit_skip);
|
||
|
}
|
||
| client/packhand.c | ||
|---|---|---|
|
static int last_turn = 0;
|
||
|
/* Refresh the action selection dialog */
|
||
|
#define REQEST_BACKGROUND_REFRESH (1)
|
||
|
#define REQUEST_BACKGROUND_REFRESH (1)
|
||
|
/* Get possible actions for fast auto attack. */
|
||
|
#define REQEST_BACKGROUND_FAST_AUTO_ATTACK (2)
|
||
|
#define REQUEST_BACKGROUND_FAST_AUTO_ATTACK (2)
|
||
|
/* A unit will auto attack with the following actions. */
|
||
|
const action_id auto_attack_actions[] = {
|
||
| ... | ... | |
|
action_selection_target_unit(),
|
||
|
city_tile(pcity)->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_BACKGROUND_REFRESH);
|
||
|
REQUEST_BACKGROUND_REFRESH);
|
||
|
}
|
||
|
if (gui_options.draw_city_trade_routes
|
||
| ... | ... | |
|
IDENTITY_NUMBER_ZERO,
|
||
|
tile_index(punit->action_decision_tile),
|
||
|
EXTRA_NONE,
|
||
|
REQEST_BACKGROUND_FAST_AUTO_ATTACK);
|
||
|
REQUEST_BACKGROUND_FAST_AUTO_ATTACK);
|
||
|
return;
|
||
|
}
|
||
|
} action_array_iterate_end;
|
||
| ... | ... | |
|
tile_index(
|
||
|
packet_unit->action_decision_tile),
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_BACKGROUND_REFRESH);
|
||
|
REQUEST_BACKGROUND_REFRESH);
|
||
|
}
|
||
|
}
|
||
|
punit->action_decision_want = packet_unit->action_decision_want;
|
||
| ... | ... | |
|
action_selection_target_unit(),
|
||
|
tgt_tile->index,
|
||
|
action_selection_target_extra(),
|
||
|
REQEST_BACKGROUND_REFRESH);
|
||
|
REQUEST_BACKGROUND_REFRESH);
|
||
|
}
|
||
|
}
|
||
|
}
|
||
| ... | ... | |
|
log_error("handle_unit_action_answer() the action %d doesn't exist.",
|
||
|
action_type);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
if (!pactor) {
|
||
|
log_debug("Bad actor %d.", actor_id);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
|
}
|
||
| ... | ... | |
|
case ACTION_SPY_BRIBE_UNIT:
|
||
|
if (punit != nullptr && client.conn.playing
|
||
|
&& is_human(client.conn.playing)) {
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
/* Focus on the unit so the player knows where it is */
|
||
|
unit_focus_set(pactor);
|
||
| ... | ... | |
|
}
|
||
|
} else {
|
||
|
log_debug("Bad target %d.", target_id);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
case ACTION_SPY_BRIBE_STACK:
|
||
|
if (ptile != nullptr && client.conn.playing
|
||
|
&& is_human(client.conn.playing)) {
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
/* Focus on the unit so the player knows where it is */
|
||
|
unit_focus_set(pactor);
|
||
| ... | ... | |
|
}
|
||
|
} else {
|
||
|
log_debug("Bad target %d.", target_id);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
case ACTION_SPY_INCITE_CITY_ESC:
|
||
|
if (pcity && client.conn.playing
|
||
|
&& is_human(client.conn.playing)) {
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
/* Focus on the unit so the player knows where it is */
|
||
|
unit_focus_set(pactor);
|
||
| ... | ... | |
|
}
|
||
|
} else {
|
||
|
log_debug("Bad target %d.", target_id);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
break;
|
||
|
case ACTION_NONE:
|
||
|
log_debug("Server didn't respond to query.");
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
default:
|
||
|
log_error("handle_unit_action_answer() invalid action_type (%d).",
|
||
|
action_type);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
Handle reply to possible actions.
|
||
|
Note that a reply to a foreground request (a reply where
|
||
|
request_kind is REQEST_PLAYER_INITIATED) must result in its clean up.
|
||
|
request_kind is REQUEST_PLAYER_INITIATED) must result in its clean up.
|
||
|
****************************************************************************/
|
||
|
void handle_unit_actions(const struct packet_unit_actions *packet)
|
||
|
{
|
||
| ... | ... | |
|
}
|
||
|
switch (request_kind) {
|
||
|
case REQEST_PLAYER_INITIATED:
|
||
|
case REQUEST_PLAYER_INITIATED:
|
||
|
if (valid) {
|
||
|
/* The player can select an action and should be informed. */
|
||
| ... | ... | |
|
action_selection_next_in_focus(packet->actor_unit_id);
|
||
|
}
|
||
|
break;
|
||
|
case REQEST_BACKGROUND_REFRESH:
|
||
|
case REQUEST_BACKGROUND_REFRESH:
|
||
|
/* This was a background action selection dialog refresh. */
|
||
|
if (actor_unit != nullptr
|
||
| ... | ... | |
|
act_probs);
|
||
|
}
|
||
|
break;
|
||
|
case REQEST_BACKGROUND_FAST_AUTO_ATTACK:
|
||
|
case REQUEST_BACKGROUND_FAST_AUTO_ATTACK:
|
||
|
if (actor_unit != nullptr) {
|
||
|
action_decision_maybe_auto(actor_unit, act_probs,
|
||
|
target_unit, target_city, target_tile);
|
||
| ... | ... | |
|
if (!pactor) {
|
||
|
log_debug("Bad diplomat %d.", actor_id);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
|
}
|
||
| ... | ... | |
|
if (!pcity) {
|
||
|
log_debug("Bad city %d.", city_id);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
action_selection_next_in_focus(actor_id);
|
||
| ... | ... | |
|
improvement_index(pimprove)));
|
||
|
} improvement_iterate_end;
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
/* Focus on the unit so the player knows where it is */
|
||
|
unit_focus_set(pactor);
|
||
| ... | ... | |
|
}
|
||
|
} else {
|
||
|
log_debug("Can't issue orders");
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
action_selection_no_longer_in_progress(actor_id);
|
||
|
action_decision_clear_want(actor_id);
|
||
|
}
|
||
| common/networking/packets.h | ||
|---|---|---|
|
/* Indicates that the player initiated a request.
|
||
|
*
|
||
|
* Used in network protocol. */
|
||
|
#define REQEST_PLAYER_INITIATED (0)
|
||
|
#define REQUEST_PLAYER_INITIATED (0)
|
||
|
/* Used in network protocol. */
|
||
|
enum unit_info_use {
|
||
| server/unithand.c | ||
|---|---|---|
|
request_kind,
|
||
|
probabilities);
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED && !at_least_one_action) {
|
||
|
if (request_kind == REQUEST_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);
|
||
| ... | ... | |
|
target_city, target_unit,
|
||
|
target_tile, nullptr));
|
||
|
if (request_kind == REQEST_PLAYER_INITIATED) {
|
||
|
if (request_kind == REQUEST_PLAYER_INITIATED) {
|
||
|
/* This is a foreground request. */
|
||
|
illegal_action_msg(pplayer, (information_revealed
|
||
|
? E_UNIT_ILLEGAL_ACTION : E_BAD_COMMAND),
|
||
| ... | ... | |
|
tgt_player, target_tile,
|
||
|
requester);
|
||
|
if (request_kind != REQEST_PLAYER_INITIATED && was_punished) {
|
||
|
if (request_kind != REQUEST_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.
|
||
| ... | ... | |
|
} else { \
|
||
|
illegal_action(pplayer, actor_unit, action_type, \
|
||
|
pcity ? city_owner(pcity) : nullptr, nullptr, pcity, \
|
||
|
nullptr, REQEST_PLAYER_INITIATED, requester); \
|
||
|
nullptr, REQUEST_PLAYER_INITIATED, requester); \
|
||
|
}
|
||
|
#define ACTION_PERFORM_UNIT_SELF(action, actor, action_performer) \
|
||
| ... | ... | |
|
} else { \
|
||
|
illegal_action(pplayer, actor_unit, action_type, \
|
||
|
unit_owner(actor_unit), nullptr, nullptr, actor_unit, \
|
||
|
REQEST_PLAYER_INITIATED, requester); \
|
||
|
REQUEST_PLAYER_INITIATED, requester); \
|
||
|
}
|
||
|
#define ACTION_PERFORM_UNIT_UNIT(action, actor, target, action_performer) \
|
||
| ... | ... | |
|
} else { \
|
||
|
illegal_action(pplayer, actor_unit, action_type, \
|
||
|
punit ? unit_owner(punit) : nullptr, nullptr, nullptr, \
|
||
|
punit, REQEST_PLAYER_INITIATED, requester); \
|
||
|
punit, REQUEST_PLAYER_INITIATED, requester); \
|
||
|
}
|
||
|
#define ACTION_PERFORM_UNIT_STACK(action, actor, target, action_performer)\
|
||
| ... | ... | |
|
} else { \
|
||
|
illegal_action(pplayer, actor_unit, action_type, \
|
||
|
nullptr, target_tile, nullptr, nullptr, \
|
||
|
REQEST_PLAYER_INITIATED, requester); \
|
||
|
REQUEST_PLAYER_INITIATED, requester); \
|
||
|
}
|
||
|
#define ACTION_PERFORM_UNIT_TILE(action, actor, target, action_performer) \
|
||
| ... | ... | |
|
illegal_action(pplayer, actor_unit, action_type, \
|
||
|
target_tile ? tile_owner(target_tile) : nullptr, \
|
||
|
target_tile, nullptr, nullptr, \
|
||
|
REQEST_PLAYER_INITIATED, requester); \
|
||
|
REQUEST_PLAYER_INITIATED, requester); \
|
||
|
}
|
||
|
#define ACTION_PERFORM_UNIT_EXTRAS(action, actor, target, action_performer)\
|
||
| ... | ... | |
|
illegal_action(pplayer, actor_unit, action_type, \
|
||
|
target_tile ? target_tile->extras_owner : nullptr, \
|
||
|
target_tile, nullptr, nullptr, \
|
||
|
REQEST_PLAYER_INITIATED, requester); \
|
||
|
REQUEST_PLAYER_INITIATED, requester); \
|
||
|
}
|
||
|
#define ACTION_PERFORM_UNIT_ANY(paction, actor, \
|
||