Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #750605 ยป 0001-act-sel-dlg-keep-extra-target-information.patch

Sveinung Kvilhaugsvik, 2018-05-01 10:51 AM

View differences:

client/gui-gtk-3.0/action_dialog.c
static int actor_unit_id;
static int target_ids[ATK_COUNT];
static int target_extra_id;
static bool is_more_user_input_needed = FALSE;
static bool did_not_decide = FALSE;
static bool action_selection_restart = FALSE;
......
* unit. */
IDENTITY_NUMBER_ZERO,
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
} else {
dsend_packet_unit_get_actions(&client.conn,
actor->id,
tgt_id,
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
}
}
......
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
GtkWidget *shl;
......
target_ids[ATK_TILE] = target_tile ?
tile_index(target_tile) :
IDENTITY_NUMBER_ZERO;
target_extra_id = target_extra ?
extra_number(target_extra) :
EXTRA_NONE;
astr_set(&title,
/* TRANS: %s is a unit name, e.g., Spy */
......
}
/**********************************************************************//**
Returns id of the target extra of the actions currently handled in action
selection dialog when the action selection dialog is open and it has an
extra target. Returns EXTRA_NONE if no action selection dialog is open
or no extra target is present in the action selection dialog.
**************************************************************************/
int action_selection_target_extra(void)
{
if (act_sel_dialog == NULL) {
return EXTRA_NONE;
}
return target_extra_id;
}
/**********************************************************************//**
Updates the action selection dialog with new information.
**************************************************************************/
void action_selection_refresh(struct unit *actor_unit,
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
struct action_data *data;
client/gui-gtk-3.22/action_dialog.c
static int actor_unit_id;
static int target_ids[ATK_COUNT];
static int target_extra_id;
static bool is_more_user_input_needed = FALSE;
static bool did_not_decide = FALSE;
static bool action_selection_restart = FALSE;
......
* unit. */
IDENTITY_NUMBER_ZERO,
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
} else {
dsend_packet_unit_get_actions(&client.conn,
actor->id,
tgt_id,
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
}
}
......
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
GtkWidget *shl;
......
target_ids[ATK_TILE] = target_tile ?
tile_index(target_tile) :
IDENTITY_NUMBER_ZERO;
target_extra_id = target_extra ?
extra_number(target_extra) :
EXTRA_NONE;
astr_set(&title,
/* TRANS: %s is a unit name, e.g., Spy */
......
}
/**********************************************************************//**
Returns id of the target extra of the actions currently handled in action
selection dialog when the action selection dialog is open and it has an
extra target. Returns EXTRA_NONE if no action selection dialog is open
or no extra target is present in the action selection dialog.
**************************************************************************/
int action_selection_target_extra(void)
{
if (act_sel_dialog == NULL) {
return EXTRA_NONE;
}
return target_extra_id;
}
/**********************************************************************//**
Updates the action selection dialog with new information.
**************************************************************************/
void action_selection_refresh(struct unit *actor_unit,
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
struct action_data *data;
client/gui-gtk-4.0/action_dialog.c
static int actor_unit_id;
static int target_ids[ATK_COUNT];
static int target_extra_id;
static bool is_more_user_input_needed = FALSE;
static bool did_not_decide = FALSE;
static bool action_selection_restart = FALSE;
......
* unit. */
IDENTITY_NUMBER_ZERO,
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
} else {
dsend_packet_unit_get_actions(&client.conn,
actor->id,
tgt_id,
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
}
}
......
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
GtkWidget *shl;
......
target_ids[ATK_TILE] = target_tile ?
tile_index(target_tile) :
IDENTITY_NUMBER_ZERO;
target_extra_id = target_extra ?
extra_number(target_extra) :
EXTRA_NONE;
astr_set(&title,
/* TRANS: %s is a unit name, e.g., Spy */
......
}
/**********************************************************************//**
Returns id of the target extra of the actions currently handled in action
selection dialog when the action selection dialog is open and it has an
extra target. Returns EXTRA_NONE if no action selection dialog is open
or no extra target is present in the action selection dialog.
**************************************************************************/
int action_selection_target_extra(void)
{
if (act_sel_dialog == NULL) {
return EXTRA_NONE;
}
return target_extra_id;
}
/**********************************************************************//**
Updates the action selection dialog with new information.
**************************************************************************/
void action_selection_refresh(struct unit *actor_unit,
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
struct action_data *data;
client/gui-qt/dialogs.cpp
target_id[ATK_UNIT] = IDENTITY_NUMBER_ZERO;
target_id[ATK_UNITS] = IDENTITY_NUMBER_ZERO;
target_id[ATK_TILE] = IDENTITY_NUMBER_ZERO;
target_extra_id = EXTRA_NONE;
targeted_unit = nullptr;
/* No buttons are added yet. */
......
}
unit_skip->setParent(nullptr);
action_selection_refresh(game_unit_by_number(unit_id), nullptr,
targeted_unit, targeted_unit->tile, act_probs);
targeted_unit, targeted_unit->tile,
extra_by_number(target_extra_id), act_probs);
layout->addLayout(unit_skip);
}
......
unit_id,
targeted_unit->id,
targeted_unit->tile->index,
EXTRA_NONE,
action_selection_target_extra(),
TRUE);
layout->addLayout(unit_skip);
}
......
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
struct astring title = ASTRING_INIT, text = ASTRING_INIT;
......
cd->target_id[ATK_TILE] = IDENTITY_NUMBER_ZERO;
}
if (target_extra) {
cd->target_extra_id = extra_number(target_extra);
} else {
cd->target_extra_id = EXTRA_NONE;
}
/* Unit acting against a city */
/* Set the correct target for the following actions. */
......
}
}
/**********************************************************************//**
Returns id of the target extra of the actions currently handled in action
selection dialog when the action selection dialog is open and it has an
extra target. Returns EXTRA_NONE if no action selection dialog is open
or no extra target is present in the action selection dialog.
**************************************************************************/
int action_selection_target_extra(void)
{
choice_dialog *cd = gui()->get_diplo_dialog();
if (cd != NULL) {
return cd->target_extra_id;
} else {
return EXTRA_NONE;
}
}
/***********************************************************************//**
Returns id of the target unit of the actions currently handled in action
selection dialog when the action selection dialog is open and it has a
......
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
choice_dialog *asd;
client/gui-qt/dialogs.h
Choice_dialog_button *get_identified_button(const int id);
int unit_id;
int target_id[ATK_COUNT];
int target_extra_id;
struct unit* targeted_unit;
void update_dialog(const struct act_prob *act_probs);
public slots:
client/gui-sdl2/action_dialog.c
struct diplomat_dialog {
int actor_unit_id;
int target_ids[ATK_COUNT];
int target_extra_id;
int action_id;
struct ADVANCED_DLG *pdialog;
};
......
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
struct widget *pWindow = NULL, *pBuf = NULL;
......
pDiplomat_Dlg->target_ids[ATK_TILE] = tile_index(target_tile);
if (target_extra) {
pDiplomat_Dlg->target_extra_id = extra_number(target_extra);
} else {
pDiplomat_Dlg->target_extra_id = EXTRA_NONE;
}
pDiplomat_Dlg->target_ids[ATK_SELF] = actor_unit->id;
/* ---------- */
......
}
/**********************************************************************//**
Returns id of the target extra of the actions currently handled in action
selection dialog when the action selection dialog is open and it has an
extra target. Returns EXTRA_NONE if no action selection dialog is open
or no extra target is present in the action selection dialog.
**************************************************************************/
int action_selection_target_extra(void)
{
if (!pDiplomat_Dlg) {
return EXTRA_NONE;
}
return pDiplomat_Dlg->target_extra_id;
}
/**********************************************************************//**
Updates the action selection dialog with new information.
**************************************************************************/
void action_selection_refresh(struct unit *actor_unit,
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
/* TODO: port me. */
client/gui-stub/dialogs.c
should take.
**************************************************************************/
void popup_action_selection(struct unit *actor_unit,
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
const struct act_prob *act_probs)
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
/* PORTME */
}
......
}
/**********************************************************************//**
Returns id of the target extra of the actions currently handled in action
selection dialog when the action selection dialog is open and it has an
extra target. Returns EXTRA_NONE if no action selection dialog is open
or no extra target is present in the action selection dialog.
**************************************************************************/
int action_selection_target_extra(void)
{
/* PORTME */
return EXTRA_NONE;
}
/**********************************************************************//**
Updates the action selection dialog with new information.
**************************************************************************/
void action_selection_refresh(struct unit *actor_unit,
struct city *target_city,
struct unit *target_unit,
struct tile *target_tile,
struct extra_type *target_extra,
const struct act_prob *act_probs)
{
/* TODO: port me. */
client/include/dialogs_g.h
bool make_att_veteran, bool make_def_veteran)
GUI_FUNC_PROTO(void, popup_action_selection, struct unit *actor_unit,
struct city *target_city, struct unit *target_unit,
struct tile *target_tile,
struct tile *target_tile, struct extra_type *target_extra,
const struct act_prob *act_probs)
GUI_FUNC_PROTO(int, action_selection_actor_unit, void)
GUI_FUNC_PROTO(int, action_selection_target_city, void)
GUI_FUNC_PROTO(int, action_selection_target_unit, void)
GUI_FUNC_PROTO(int, action_selection_target_tile, void)
GUI_FUNC_PROTO(int, action_selection_target_extra, void)
GUI_FUNC_PROTO(void, action_selection_close, void)
GUI_FUNC_PROTO(void, action_selection_refresh, struct unit *actor_unit,
struct city *target_city, struct unit *target_unit,
struct tile *target_tile,
struct tile *target_tile, struct extra_type *target_extra,
const struct act_prob *act_probs)
GUI_FUNC_PROTO(void, action_selection_no_longer_in_progress_gui_specific,
int actor_unit_id)
client/packhand.c
action_selection_actor_unit(),
action_selection_target_unit(),
city_tile(pcity)->index,
EXTRA_NONE,
action_selection_target_extra(),
FALSE);
}
......
action_selection_actor_unit(),
action_selection_target_unit(),
tgt_tile->index,
EXTRA_NONE,
action_selection_target_extra(),
FALSE);
}
}
......
struct unit *actor_unit = game_unit_by_number(packet->actor_unit_id);
struct tile *target_tile = index_to_tile(&(wld.map), packet->target_tile_id);
struct extra_type *target_extra = packet->target_extra_id == EXTRA_NONE ?
NULL : extra_by_number(packet->target_extra_id);
struct city *target_city = game_city_by_number(packet->target_city_id);
struct unit *target_unit = game_unit_by_number(packet->target_unit_id);
......
} else {
/* Show the client specific action dialog */
popup_action_selection(actor_unit,
target_city, target_unit, target_tile,
target_city, target_unit,
target_tile, target_extra,
act_probs);
}
} else if (disturb_player) {
......
if (action_selection_actor_unit() == actor_unit->id) {
/* The situation may have changed. */
action_selection_refresh(actor_unit,
target_city, target_unit, target_tile,
target_city, target_unit,
target_tile, target_extra,
act_probs);
}
}
    (1-1/1)