Project

General

Profile

Bug #1662 ยป 0014-control.-ch-Replace-tabs-with-spaces.patch

Marko Lindqvist, 10/11/2025 09:56 PM

View differences:

client/control.c
* battlegroup twice in a row will store the focus erroneously. The only
* solution would be a set_units_focus() */
if (!(get_num_units_in_focus() == 1
&& punit == head_of_units_in_focus())) {
&& punit == head_of_units_in_focus())) {
store_previous_focus();
focus_changed = TRUE;
}
......
* otherwise quit for any of the conditions. */
unit_list_iterate(get_units_in_focus(), punit) {
if ((punit->activity == ACTIVITY_IDLE
|| punit->activity == ACTIVITY_GOTO
|| unit_has_orders(punit))
&& punit->moves_left > 0
&& !punit->done_moving
|| punit->activity == ACTIVITY_GOTO
|| unit_has_orders(punit))
&& punit->moves_left > 0
&& !punit->done_moving
&& punit->ssa_controller == SSA_NONE) {
return;
}
......
if (unit_owner(punit) == client.conn.playing) {
if (!unit_transported(punit)) {
if (get_transporter_capacity(punit) > 0) {
return punit;
return punit;
} else if (!panyowned) {
panyowned = punit;
panyowned = punit;
}
}
} else if (!ptptother && !unit_transported(punit)) {
if (get_transporter_capacity(punit) > 0) {
ptptother = punit;
ptptother = punit;
} else if (!panyother) {
panyother = punit;
panyother = punit;
}
}
unit_list_iterate_end;
......
/* We used to unqueue here, but that's inherently risky
* for a function run from a timer - the UI can be in any
* inconsistent state. */
refresh_unit_mapcanvas(punit, unit_tile(punit), FALSE, FALSE);
refresh_unit_mapcanvas(punit, unit_tile(punit), FALSE, FALSE);
} unit_list_iterate_end;
}
......
} players_iterate_alive_end;
if (is_moving == 1 && is_waiting > 0) {
update_turn_done_button(FALSE); /* stress the slow player! */
update_turn_done_button(FALSE); /* Stress the slow player! */
}
blink_timer = timer_renew(blink_timer, TIMER_USER, TIMER_ACTIVE,
blink_timer != NULL ? NULL : "blink");
......
set_unit_icon(-1, punit);
i = 0; /* index into unit_below_canvas */
i = 0; /* Index into unit_below_canvas */
unit_list_iterate(unit_tile(punit)->units, aunit) {
if (aunit != punit) {
if (i < num_units_below) {
set_unit_icon(i, aunit);
}
i++;
if (i < num_units_below) {
set_unit_icon(i, aunit);
}
i++;
}
}
unit_list_iterate_end;
......
} else {
set_unit_icons_more_arrow(FALSE);
for (; i < num_units_below; i++) {
set_unit_icon(i, NULL);
set_unit_icon(i, NULL);
}
}
} else {
......
/* Set mouse cursor to select a unit. */
mouse_cursor_type = CURSOR_SELECT;
} else if (NULL != pcity
&& can_player_see_city_internals(client.conn.playing, pcity)) {
&& can_player_see_city_internals(client.conn.playing, pcity)) {
/* Set mouse cursor to select a city. */
mouse_cursor_type = CURSOR_SELECT;
} else {
......
mouse_cursor_type = CURSOR_NUKE;
} else if (can_units_attack_at(active_units, ptile)) {
/* Goto results in military attack. */
mouse_cursor_type = CURSOR_ATTACK;
mouse_cursor_type = CURSOR_ATTACK;
} else if (is_enemy_city_tile(ptile, client.conn.playing)) {
/* Goto results in attack of enemy city. */
mouse_cursor_type = CURSOR_ATTACK;
mouse_cursor_type = CURSOR_ATTACK;
} else {
mouse_cursor_type = CURSOR_GOTO;
mouse_cursor_type = CURSOR_GOTO;
}
} else {
mouse_cursor_type = CURSOR_INVALID;
......
}
if (unit_owner(pcargo) == unit_owner(punit)) {
plast = pcargo;
plast = pcargo;
}
}
} unit_list_iterate_end;
......
if (punit->hp + turns *
(get_unit_bonus(punit, EFT_UNIT_RECOVER)
- (max_hp * unit_class_get(punit)->hp_loss_pct / 100))
< max_hp) {
< max_hp) {
struct unit_order order;
order.order = ORDER_ACTIVITY;
......
}
unit_list_iterate(ptile->units, punit) {
if (punit->activity == ACTIVITY_SENTRY
&& unit_owner(punit) == client.conn.playing) {
&& unit_owner(punit) == client.conn.playing) {
request_new_unit_activity(punit, ACTIVITY_IDLE);
}
}
......
break;
case HOVER_PATROL:
do_unit_patrol_to(ptile);
break;
break;
case HOVER_ACT_SEL_TGT:
do_unit_act_sel_vs(ptile);
break;
......
&& battlegroups >= 0 && battlegroup < MAX_NUM_BATTLEGROUPS) {
if (!append) {
unit_list_iterate_safe(battlegroups[battlegroup], punit) {
if (!unit_is_in_focus(punit)) {
punit->battlegroup = BATTLEGROUP_NONE;
if (!unit_is_in_focus(punit)) {
punit->battlegroup = BATTLEGROUP_NONE;
dsend_packet_unit_sscs_set(&client.conn, punit->id,
USSDT_BATTLE_GROUP,
BATTLEGROUP_NONE);
refresh_unit_mapcanvas(punit, unit_tile(punit), TRUE, FALSE);
unit_list_remove(battlegroups[battlegroup], punit);
}
refresh_unit_mapcanvas(punit, unit_tile(punit), TRUE, FALSE);
unit_list_remove(battlegroups[battlegroup], punit);
}
} unit_list_iterate_safe_end;
}
unit_list_iterate(get_units_in_focus(), punit) {
if (punit->battlegroup != battlegroup) {
if (punit->battlegroup >= 0
&& punit->battlegroup < MAX_NUM_BATTLEGROUPS) {
unit_list_remove(battlegroups[punit->battlegroup], punit);
}
punit->battlegroup = battlegroup;
if (punit->battlegroup >= 0
&& punit->battlegroup < MAX_NUM_BATTLEGROUPS) {
unit_list_remove(battlegroups[punit->battlegroup], punit);
}
punit->battlegroup = battlegroup;
dsend_packet_unit_sscs_set(&client.conn, punit->id,
USSDT_BATTLE_GROUP,
battlegroup);
unit_list_append(battlegroups[battlegroup], punit);
refresh_unit_mapcanvas(punit, unit_tile(punit), TRUE, FALSE);
unit_list_append(battlegroups[battlegroup], punit);
refresh_unit_mapcanvas(punit, unit_tile(punit), TRUE, FALSE);
}
} unit_list_iterate_end;
unit_list_iterate(battlegroups[battlegroup], punit) {
......
return;
}
/* FIXME: this is very inefficient and can be improved. */
/* FIXME: This is very inefficient and can be improved. */
unit_list_iterate(battlegroups[battlegroup], punit) {
if (i == 0 && !append) {
unit_focus_set(punit);
unit_focus_set(punit);
} else {
unit_focus_add(punit);
unit_focus_add(punit);
}
i++;
} unit_list_iterate_end;
client/control.h
void do_unit_paradrop_to(struct unit *punit, struct tile *ptile);
void do_unit_patrol_to(struct tile *ptile);
void do_unit_connect(struct tile *ptile,
enum unit_activity activity,
enum unit_activity activity,
struct extra_type *tgt);
void do_map_click(struct tile *ptile, enum quickselect_type qtype);
void control_mouse_cursor(struct tile *ptile);
......
void request_move_unit_direction(struct unit *punit, int dir);
void request_new_unit_activity(struct unit *punit, enum unit_activity act);
void request_new_unit_activity_targeted(struct unit *punit,
enum unit_activity act,
struct extra_type *tgt);
enum unit_activity act,
struct extra_type *tgt);
void request_unit_load(struct unit *pcargo, struct unit *ptransporter,
struct tile *ptile);
void request_unit_unload(struct unit *pcargo);
    (1-1/1)