Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/control.c File Reference

Freeciv-3.1

Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
control.c File Reference
`#include "astring.h"`
`#include "bitvector.h"`
`#include "fcintl.h"`
`#include "log.h"`
`#include "mem.h"`
`#include "timing.h"`
`#include "combat.h"`
`#include "game.h"`
`#include "map.h"`
`#include "movement.h"`
`#include "unitlist.h"`
`#include "path_finding.h"`
`#include "chatline_g.h"`
`#include "citydlg_g.h"`
`#include "dialogs_g.h"`
`#include "gui_main_g.h"`
`#include "mapctrl_g.h"`
`#include "mapview_g.h"`
`#include "menu_g.h"`
`#include "audio.h"`
`#include "client_main.h"`
`#include "climap.h"`
`#include "climisc.h"`
`#include "editor.h"`
`#include "goto.h"`
`#include "options.h"`
`#include "overview_common.h"`
`#include "tilespec.h"`
`#include "update_queue.h"`
`#include "control.h"`
`#include "spechash.h"`

Go to the source code of this file.

## Data Structures

struct | client_disband_unit_data

## Macros

#define | SPECHASH_TAG unit_type
#define | SPECHASH_IKEY_TYPE struct unit_type *
#define | SPECHASH_IDATA_TYPE void *
#define | SPECHASH_TAG continent
#define | SPECHASH_INT_KEY_TYPE
#define | SPECHASH_IDATA_TYPE void *

## Functions

static void | key_unit_gen_clean (enum unit_activity act, enum extra_rmcause rmcause)
static struct unit * | quickselect (struct tile *ptile, enum quickselect_type qtype)
void | control_init (void)
void | control_free (void)
struct unit_list * | get_units_in_focus (void)
int | get_num_units_in_focus (void)
static void | store_previous_focus (void)
void | unit_focus_urgent (struct unit *punit)
static void | focus_units_changed (void)
void | control_unit_killed (struct unit *punit)
void | unit_change_battlegroup (struct unit *punit, int battlegroup)
void | unit_register_battlegroup (struct unit *punit)
void | set_hover_state (struct unit_list *punits, enum cursor_hover_state state, enum unit_activity activity, struct extra_type *tgt, int last_tgt, int last_sub_tgt, action_id action, enum unit_orders order)
void | clear_hover_state (void)
bool | should_ask_server_for_actions (const struct unit *punit)
static bool | can_ask_server_for_actions (void)
static void | ask_server_for_actions (struct unit *punit)
bool | unit_is_in_focus (const struct unit *punit)
struct unit * | get_focus_unit_on_tile (const struct tile *ptile)
struct unit * | head_of_units_in_focus (void)
static struct tile * | find_a_focus_unit_tile_to_center_on (void)
void | auto_center_on_focus_unit (void)
static void | current_focus_append (struct unit *punit)
static void | current_focus_remove (struct unit *punit)
void | clear_unit_orders (struct unit *punit)
void | unit_focus_set (struct unit *punit)
void | unit_focus_add (struct unit *punit)
void | unit_focus_remove (struct unit *punit)
void | unit_focus_set_and_select (struct unit *punit)
static struct unit * | find_best_focus_candidate (bool accept_current)
void | unit_focus_advance (void)
void | unit_focus_update (void)
struct unit * | find_visible_unit (struct tile *ptile)
double | blink_active_unit (void)
double | blink_turn_done_button (void)
void | update_unit_pix_label (struct unit_list *punitlist)
void | set_units_in_combat (struct unit *pattacker, struct unit *pdefender)
void | action_selection_no_longer_in_progress (const int old_actor_id)
void | action_decision_clear_want (const int old_actor_id)
void | action_selection_next_in_focus (const int old_actor_id)
void | action_decision_request (struct unit *actor_unit)
void | request_unit_goto (enum unit_orders last_order, action_id act_id, int sub_tgt_id)
static bool | can_units_attack_at (struct unit_list *punits, const struct tile *ptile)
void | control_mouse_cursor (struct tile *ptile)
static bool | is_activity_on_tile (struct tile *ptile, enum unit_activity activity)
int | check_recursive_road_connect (struct tile *ptile, const struct extra_type *pextra, const struct unit *punit, const struct player *pplayer, int rec)
static bool | can_be_irrigated (const struct tile *ptile, const struct unit *punit)
bool | can_unit_do_connect (struct unit *punit, enum unit_activity activity, struct extra_type *tgt)
void | request_unit_connect (enum unit_activity activity, struct extra_type *tgt)
struct unit * | request_unit_unload_all (struct unit *punit)
void | request_unit_airlift (struct unit *punit, struct city *pcity)
void | request_unit_return (struct unit *punit)
void | wakeup_sentried_units (struct tile *ptile)
void | request_unit_wakeup (struct unit *punit)
void | request_unit_select (struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
void | request_do_action (action_id action, int actor_id, int target_id, int sub_tgt, const char *name)
void | request_action_details (action_id action, int actor_id, int target_id)
void | request_unit_build_city (struct unit *punit)
void | request_unit_non_action_move (struct unit *punit, struct tile *dest_tile)
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)
static void | client_disband_unit_data_destroy (void *p)
static void | do_disband_alternative (void *p)
void | request_unit_disband (struct unit *punit)
void | request_unit_change_homecity (struct unit *punit)
void | request_unit_upgrade (struct unit *punit)
void | request_unit_convert (struct unit *punit)
void | request_unit_ssa_set (const struct unit *punit, enum server_side_agent agent)
void | request_unit_autosettlers (const struct unit *punit)
void | request_unit_load (struct unit *pcargo, struct unit *ptrans, struct tile *ptile)
void | request_unit_unload (struct unit *pcargo)
void | request_unit_caravan_action (struct unit *punit, action_id action)
void | request_unit_paradrop (struct unit_list *punits)
void | request_unit_patrol (void)
void | request_unit_sentry (struct unit *punit)
void | request_unit_fortify (struct unit *punit)
void | request_unit_pillage (struct unit *punit)
void | request_toggle_city_outlines (void)
void | request_toggle_city_output (void)
void | request_toggle_map_grid (void)
void | request_toggle_map_borders (void)
void | request_toggle_map_native (void)
void | request_toggle_city_full_bar (void)
void | request_toggle_city_names (void)
void | request_toggle_city_growth (void)
void | request_toggle_city_productions (void)
void | request_toggle_city_buycost (void)
void | request_toggle_city_trade_routes (void)
void | request_toggle_unit_stack_size (void)
void | request_toggle_terrain (void)
void | request_toggle_coastline (void)
void | request_toggle_roads_rails (void)
void | request_toggle_irrigation (void)
void | request_toggle_mines (void)
void | request_toggle_bases (void)
void | request_toggle_resources (void)
void | request_toggle_huts (void)
void | request_toggle_pollution (void)
void | request_toggle_cities (void)
void | request_toggle_units (void)
void | request_toggle_unit_solid_bg (void)
void | request_toggle_unit_shields (void)
void | request_toggle_focus_unit (void)
void | request_toggle_fog_of_war (void)
void | request_center_focus_unit (void)
void | request_units_wait (struct unit_list *punits)
void | request_unit_move_done (void)
void | do_move_unit (struct unit *punit, struct unit *target_unit)
static void | do_unit_act_sel_vs (struct tile *ptile)
void | do_map_click (struct tile *ptile, enum quickselect_type qtype)
void | do_unit_goto (struct tile *ptile)
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, struct extra_type *tgt)
void | key_cancel_action (void)
void | key_center_capital (void)
void | key_end_turn (void)
void | key_recall_previous_focus_unit (void)
void | key_unit_move (enum direction8 gui_dir)
void | key_unit_build_city (void)
void | key_unit_build_wonder (void)
void | key_unit_connect (enum unit_activity activity, struct extra_type *tgt)
void | key_unit_action_select (void)
void | key_unit_action_select_tgt (void)
void | key_unit_done (void)
void | key_unit_goto (void)
void | key_unit_paradrop (void)
void | key_unit_patrol (void)
void | key_unit_trade_route (void)
void | key_unit_unload_all (void)
void | key_unit_wait (void)
void | key_unit_wakeup_others (void)
void | key_unit_airbase (void)
void | key_unit_auto_explore (void)
void | key_unit_auto_settle (void)
void | key_unit_convert (void)
void | key_unit_fallout (void)
void | key_unit_fortify (void)
void | key_unit_fortress (void)
void | key_unit_homecity (void)
static void | key_unit_extra (enum unit_activity act, enum extra_cause cause)
void | key_unit_irrigate (void)
void | key_unit_cultivate (void)
void | key_unit_mine (void)
void | key_unit_plant (void)
void | key_unit_pillage (void)
void | key_unit_clean (void)
void | key_unit_pollution (void)
void | key_unit_road (void)
void | key_unit_sentry (void)
void | key_unit_transform (void)
void | key_unit_assign_battlegroup (int battlegroup, bool append)
void | key_unit_select_battlegroup (int battlegroup, bool append)
void | key_city_outlines_toggle (void)
void | key_city_output_toggle (void)
void | key_map_grid_toggle (void)
void | key_map_borders_toggle (void)
void | key_map_native_toggle (void)
void | key_city_full_bar_toggle (void)
void | key_city_names_toggle (void)
void | key_city_growth_toggle (void)
void | key_city_buycost_toggle (void)
void | key_city_productions_toggle (void)
void | key_city_trade_routes_toggle (void)
void | key_unit_stack_size_toggle (void)
void | key_terrain_toggle (void)
void | key_coastline_toggle (void)
void | key_roads_rails_toggle (void)
void | key_irrigation_toggle (void)
void | key_mines_toggle (void)
void | key_bases_toggle (void)
void | key_resources_toggle (void)
void | key_huts_toggle (void)
void | key_pollution_toggle (void)
void | key_cities_toggle (void)
void | key_units_toggle (void)
void | key_unit_solid_bg_toggle (void)
void | key_unit_shields_toggle (void)
void | key_focus_unit_toggle (void)
void | key_fog_of_war_toggle (void)
void | key_editor_toggle (void)
void | key_editor_recalculate_borders (void)
void | key_editor_toggle_fogofwar (void)
void | finish_city (struct tile *ptile, const char *name)
void | cancel_city (struct tile *ptile)

## Variables

static int | disband_unit_alternatives [3]
int | num_units_below = MAX_NUM_UNITS_BELOW
static struct unit_list * | current_focus = NULL
static struct unit_list * | previous_focus = NULL
static struct unit_list * | urgent_focus_queue = NULL
enum cursor_hover_state | hover_state = HOVER_NONE
enum unit_activity | connect_activity
struct extra_type * | connect_tgt
action_id | goto_last_action
int | goto_last_tgt
int | goto_last_sub_tgt
enum unit_orders | goto_last_order
static struct tile * | hover_tile = NULL
static struct unit_list * | battlegroups [MAX_NUM_BATTLEGROUPS]
static struct unit * | punit_moving = NULL
static struct unit * | punit_attacking = NULL
static struct unit * | punit_defending = NULL
static int | action_selection_in_progress_for = IDENTITY_NUMBER_ZERO
bool | non_ai_unit_focus

## Macro Definition Documentation

## ◆ SPECHASH_IDATA_TYPE [1/2]

#define SPECHASH_IDATA_TYPE void *

Definition at line 1579 of file control.c.

## ◆ SPECHASH_IDATA_TYPE [2/2]

#define SPECHASH_IDATA_TYPE void *

Definition at line 1579 of file control.c.

## ◆ SPECHASH_IKEY_TYPE

#define SPECHASH_IKEY_TYPE struct unit_type *

Definition at line 1578 of file control.c.

## ◆ SPECHASH_INT_KEY_TYPE

#define SPECHASH_INT_KEY_TYPE

Definition at line 1583 of file control.c.

## ◆ SPECHASH_TAG [1/2]

#define SPECHASH_TAG unit_type

Definition at line 1577 of file control.c.

## ◆ SPECHASH_TAG [2/2]

#define SPECHASH_TAG continent

Definition at line 1577 of file control.c.

## Function Documentation

## ◆ action_decision_clear_want()

void action_decision_clear_want | ( | const int | old_actor_id | ) |

Have the server record that a decision no longer is wanted for the specified unit.

Definition at line 1053 of file control.c.

Referenced by act_sel_done_primary(), action_decision_maybe_auto(), diplomat_queue_handle_primary(), diplomat_queue_handle_primary(), handle_city_sabotage_list(), handle_unit_action_answer(), and handle_unit_actions().

## ◆ action_decision_request()

void action_decision_request | ( | struct unit * | actor_unit | ) |

Request that the player makes a decision for the specified unit.

Definition at line 1083 of file control.c.

Referenced by action_decision_handle(), and action_decision_maybe_auto().

## ◆ action_selection_next_in_focus()

void action_selection_next_in_focus | ( | const int | old_actor_id | ) |

Move on to the next unit in focus that needs an action decision.

Definition at line 1065 of file control.c.

Referenced by act_sel_done_primary(), diplomat_queue_handle_primary(), diplomat_queue_handle_primary(), handle_city_sabotage_list(), handle_unit_action_answer(), handle_unit_actions(), and handle_unit_remove().

## ◆ action_selection_no_longer_in_progress()

void action_selection_no_longer_in_progress | ( | const int | old_actor_id | ) |

The action selection process is no longer in progress for the specified unit. It is safe to let another unit enter action selection.

Definition at line 1032 of file control.c.

Referenced by act_sel_done_primary(), diplomat_queue_handle_primary(), diplomat_queue_handle_primary(), handle_city_sabotage_list(), handle_unit_action_answer(), handle_unit_actions(), tgt_extra_change_callback(), and tgt_unit_change_callback().

## ◆ ask_server_for_actions()

static void ask_server_for_actions | ( | struct unit * | punit | ) |

static

Ask the server about what actions punit may be able to perform against it's stored target tile.

The server's reply will pop up the action selection dialog unless no alternatives exists.

Definition at line 361 of file control.c.

Referenced by action_decision_request(), action_selection_next_in_focus(), and current_focus_append().

## ◆ auto_center_on_focus_unit()

void auto_center_on_focus_unit | ( | void |  | ) |

Center on the focus unit, if off-screen and auto_center_on_unit is true.

Definition at line 430 of file control.c.

Referenced by handle_new_year(), popup_action_selection(), popup_bribe_dialog(), popup_incite_dialog(), popup_sabotage_dialog(), and unit_focus_set().

## ◆ blink_active_unit()

double blink_active_unit | ( | void |  | ) |

Blink the active unit (if necessary). Return the time until the next blink (in seconds).

Definition at line 875 of file control.c.

Referenced by real_timer_callback().

## ◆ blink_turn_done_button()

double blink_turn_done_button | ( | void |  | ) |

Blink the turn done button (if necessary). Return the time until the next blink (in seconds).

Definition at line 907 of file control.c.

Referenced by real_timer_callback().

## ◆ can_ask_server_for_actions()

static bool can_ask_server_for_actions | ( | void |  | ) |

static

Returns TRUE iff it is OK to ask the server about what actions a unit can perform.

Definition at line 347 of file control.c.

Referenced by action_decision_request(), current_focus_append(), and unit_focus_update().

## ◆ can_be_irrigated()

static bool can_be_irrigated | ( | const struct tile * | ptile,
|  | const struct unit * | punit
| ) |  |

static

Can tile be irrigated by given unit? Unit can be NULL to check if any settler type unit of any player can irrigate.

Definition at line 1361 of file control.c.

Referenced by can_unit_do_connect().

## ◆ can_unit_do_connect()

bool can_unit_do_connect | ( | struct unit * | punit,
|  | enum unit_activity | activity,
|  | struct extra_type * | tgt
| ) |  |

Return whether the unit can connect with given activity (or with any activity if activity arg is set to ACTIVITY_IDLE)

This function is client-specific.

Definition at line 1384 of file control.c.

Referenced by can_units_do_connect(), and real_menus_update().

## ◆ can_units_attack_at()

static bool can_units_attack_at | ( | struct unit_list * | punits,
|  | const struct tile * | ptile
| ) |  |

static

Return TRUE if at least one of the units can do an attack at the tile.

Definition at line 1170 of file control.c.

Referenced by control_mouse_cursor().

## ◆ cancel_city()

void cancel_city | ( | struct tile * | ptile | ) |

Do not build city after all. Cancel city building mark from all units prepared for it.

Definition at line 3961 of file control.c.

Referenced by name_new_city_popup_callback(), newcity_cancel_callback(), and popup_newcity_dialog().

## ◆ check_recursive_road_connect()

int check_recursive_road_connect | ( | struct tile * | ptile,
|  | const struct extra_type * | pextra,
|  | const struct unit * | punit,
|  | const struct player * | pplayer,
|  | int | rec
| ) |  |

Fill orders to build recursive roads. This modifies ptile, so virtual copy of the real tile should be passed.

Definition at line 1306 of file control.c.

Referenced by can_unit_do_connect(), check_recursive_road_connect(), and get_activity_time().

## ◆ clear_hover_state()

void clear_hover_state | ( | void |  | ) |

Clear current hover state (go to HOVER_NONE).

Definition at line 323 of file control.c.

Referenced by control_free(), control_unit_killed(), do_map_click(), do_move_unit(), do_unit_connect(), do_unit_patrol_to(), handle_game_info(), key_cancel_action(), key_unit_action_select_tgt(), paradrop_here_callback(), release_goto_button(), map_view::shortcut_pressed(), unit_focus_add(), unit_focus_advance(), unit_focus_remove(), and unit_focus_set().

## ◆ clear_unit_orders()

void clear_unit_orders | ( | struct unit * | punit | ) |

Clear all orders for the given unit.

Definition at line 477 of file control.c.

Referenced by current_focus_append(), request_unit_move_done(), and send_goto_route().

## ◆ client_disband_unit_data_destroy()

static void client_disband_unit_data_destroy | ( | void * | p | ) |

static

Destroy the client disband unit data.

Definition at line 1860 of file control.c.

Referenced by do_disband_alternative(), and request_unit_disband().

## ◆ control_free()

void control_free | ( | void |  | ) |

Called only by client_game_free() in client/client_main.c

Definition at line 154 of file control.c.

Referenced by client_game_free(), and client_game_reset().

## ◆ control_init()

void control_init | ( | void |  | ) |

Called only by client_game_init() in client/client_main.c

Definition at line 137 of file control.c.

Referenced by client_game_init(), and client_game_reset().

## ◆ control_mouse_cursor()

void control_mouse_cursor | ( | struct tile * | ptile | ) |

Determines which mouse cursor should be used, according to hover_state, and the information gathered from the tile which is under the mouse cursor (ptile).

Definition at line 1188 of file control.c.

Referenced by anim_cursor_cb(), leave_mapcanvas(), main_mouse_motion_handler(), mouse_scroll_mapcanvas(), mouse_scroll_mapcanvas(), map_view::mouseMoveEvent(), move_mapcanvas(), move_mapcanvas(), request_unit_connect(), request_unit_goto(), set_server_busy(), and mr_menu::slot_delayed_goto().

## ◆ control_unit_killed()

void control_unit_killed | ( | struct unit * | punit | ) |

Called when a unit is killed; this removes it from the control lists.

Definition at line 226 of file control.c.

Referenced by client_remove_unit().

## ◆ current_focus_append()

static void current_focus_append | ( | struct unit * | punit | ) |

static

Add unit to list of units currently in focus.

Definition at line 443 of file control.c.

Referenced by unit_focus_add(), and unit_focus_set().

## ◆ current_focus_remove()

static void current_focus_remove | ( | struct unit * | punit | ) |

static

Remove focus from unit.

Definition at line 463 of file control.c.

Referenced by unit_focus_remove().

## ◆ do_disband_alternative()

static void do_disband_alternative | ( | void * | p | ) |

static

Try to disband a unit using actions ordered by preference.

Definition at line 1870 of file control.c.

Referenced by do_disband_alternative(), and request_unit_disband().

## ◆ do_map_click()

void do_map_click | ( | struct tile * | ptile,
|  | enum quickselect_type | qtype
| ) |  |

Handles everything when the user clicked a tile

Definition at line 2768 of file control.c.

Referenced by action_button_pressed(), butt_down_overviewcanvas(), and left_butt_down_overviewcanvas().

## ◆ do_move_unit()

void do_move_unit | ( | struct unit * | punit,
|  | struct unit * | target_unit
| ) |  |

Called to have the client move a unit from one location to another, updating the graphics if necessary. The caller must redraw the target location after the move.

Definition at line 2662 of file control.c.

Referenced by handle_unit_packet_common().

## ◆ do_unit_act_sel_vs()

static void do_unit_act_sel_vs | ( | struct tile * | ptile | ) |

static

An action selection dialog for the selected units against the specified tile is wanted.

Definition at line 2753 of file control.c.

Referenced by do_map_click().

## ◆ do_unit_connect()

void do_unit_connect | ( | struct tile * | ptile,
|  | enum unit_activity | activity,
|  | struct extra_type * | tgt
| ) |  |

"Connect" to the given location.

Definition at line 3056 of file control.c.

Referenced by do_map_click().

## ◆ do_unit_goto()

void do_unit_goto | ( | struct tile * | ptile | ) |

Finish the goto mode and let the units stored in goto_map_list move to a given location.

Definition at line 2978 of file control.c.

Referenced by do_map_click(), and release_goto_button().

## ◆ do_unit_paradrop_to()

void do_unit_paradrop_to | ( | struct unit * | punit,
|  | struct tile * | ptile
| ) |  |

Paradrop to a location.

Definition at line 3000 of file control.c.

Referenced by do_map_click(), and paradrop_here_callback().

## ◆ do_unit_patrol_to()

void do_unit_patrol_to | ( | struct tile * | ptile | ) |

Patrol to a location.

Definition at line 3040 of file control.c.

Referenced by do_map_click(), and patrol_here_callback().

## ◆ find_a_focus_unit_tile_to_center_on()

static struct tile * find_a_focus_unit_tile_to_center_on | ( | void |  | ) |

static

Finds a single focus unit that we can center on. May return NULL.

Definition at line 414 of file control.c.

Referenced by auto_center_on_focus_unit(), and request_center_focus_unit().

## ◆ find_best_focus_candidate()

static struct unit * find_best_focus_candidate | ( | bool | accept_current | ) |

static

Find the nearest available unit for focus, excluding any current unit in focus unless "accept_current" is TRUE. If the current focus unit is the only possible unit, or if there is no possible unit, returns NULL.

Definition at line 634 of file control.c.

Referenced by unit_focus_advance().

## ◆ find_visible_unit()

struct unit * find_visible_unit | ( | struct tile * | ptile | ) |

Return a pointer to a visible unit, if there is one.

Definition at line 805 of file control.c.

Referenced by clipboard_copy_production(), control_mouse_cursor(), get_drawable_unit(), inputline_make_chat_link(), chatwdg::make_link(), overview_tile_color(), popit(), popit(), popit(), popup_info_text(), and fc_client::popup_tile_info().

## ◆ finish_city()

void finish_city | ( | struct tile * | ptile,
|  | const char * | name
| ) |  |

All units ready to build city to the tile should now proceed.

Definition at line 3942 of file control.c.

Referenced by name_new_city_popup_callback(), newcity_ok_callback(), and popup_newcity_dialog().

## ◆ focus_units_changed()

static void focus_units_changed | ( | void |  | ) |

static

Do various updates required when the set of units in focus changes.

Definition at line 215 of file control.c.

Referenced by control_unit_killed(), unit_focus_add(), unit_focus_remove(), and unit_focus_set().

## ◆ get_focus_unit_on_tile()

struct unit * get_focus_unit_on_tile | ( | const struct tile * | ptile | ) |

Return TRUE iff a unit on this tile is in focus.

Definition at line 392 of file control.c.

Referenced by city_packet_common(), client_remove_unit(), find_a_focus_unit_tile_to_center_on(), find_best_focus_candidate(), handle_city_remove(), handle_tile_info(), and handle_unit_packet_common().

## ◆ get_num_units_in_focus()

int get_num_units_in_focus | ( | void |  | ) |

Return the number of units currently in focus (0 or more).

Definition at line 185 of file control.c.

Referenced by blink_active_unit(), center_on_something(), client_remove_unit(), control_unit_killed(), do_map_click(), find_a_focus_unit_tile_to_center_on(), handle_unit_packet_common(), maybe_activate_keyboardless_goto(), mr_menu::menus_sensitive(), popup_airlift_dialog(), popup_goto_dialog(), real_menus_update(), real_timer_callback(), request_unit_move_done(), reset_unit_table(), store_previous_focus(), toggle_unit_info_window_callback(), unit_focus_advance(), unit_focus_remove(), unit_focus_set(), unit_focus_update(), unit_goto_city_callback(), unit_goto_city_callback(), and usdlg_tab_append_units().

## ◆ get_units_in_focus()

struct unit_list * get_units_in_focus | ( | void |  | ) |

Returns list of units currently in focus.

Definition at line 177 of file control.c.

Referenced by action_selection_next_in_focus(), goto_dialog::airlift_to(), base_callback(), base_callback(), blink_active_unit(), build_city_callback(), build_city_callback(), build_road_callback(), build_road_callback(), clean_menu_callback(), clean_pollution_callback(), client_remove_unit(), control_mouse_cursor(), control_unit_killed(), do_map_click(), do_move_unit(), do_unit_act_sel_vs(), fill_grid_sprite_array(), goto_dialog::fill_tab(), find_visible_unit(), focus_units_changed(), fortify_callback(), fortify_callback(), get_focus_unit_on_tile(), goto_dialog::go_to_city(), goto_cmd_callback(), handle_city_info(), handle_new_year(), handle_unit_packet_common(), irrigation_callback(), is_valid_goto_draw_line(), goto_dialog::item_selected(), key_cancel_action(), key_unit_action_select(), key_unit_action_select_tgt(), key_unit_airbase(), key_unit_assign_battlegroup(), key_unit_auto_explore(), key_unit_auto_settle(), key_unit_build_city(), key_unit_build_wonder(), key_unit_clean(), key_unit_convert(), key_unit_cultivate(), key_unit_extra(), key_unit_fortify(), key_unit_fortress(), key_unit_gen_clean(), key_unit_homecity(), key_unit_move(), key_unit_paradrop(), key_unit_pillage(), key_unit_plant(), key_unit_road(), key_unit_sentry(), key_unit_trade_route(), key_unit_transform(), key_unit_unload_all(), key_unit_wait(), key_unit_wakeup_others(), leave_mapcanvas(), leave_mapcanvas(), mr_menu::menus_sensitive(), mine_callback(), overview_update_line(), paradrop_here_callback(), patrol_here_callback(), popup_info_text(), real_menus_update(), real_resize_window_callback(), real_set_client_page(), refresh_airlift_button(), refresh_airlift_column(), release_goto_button(), request_unit_connect(), request_unit_goto(), request_unit_move_done(), request_unit_patrol(), request_units_wait(), reset_unit_table(), road_callback(), road_callback(), select_all_on_tile_callback(), select_all_on_tile_callback(), select_same_type_callback(), select_same_type_callback(), select_same_type_cont_callback(), select_same_type_cont_callback(), select_same_type_tile_callback(), select_same_type_tile_callback(), select_single_callback(), select_single_callback(), set_client_state(), set_turn_done_button_state(), mr_menu::slot_board(), mr_menu::slot_build_base(), mr_menu::slot_build_city(), mr_menu::slot_build_path(), mr_menu::slot_build_road(), mr_menu::slot_clean_pollution(), mr_menu::slot_deboard(), mr_menu::slot_delayed_goto(), mr_menu::slot_disband(), mr_menu::slot_return_to_city(), mr_menu::slot_select_all_tile(), mr_menu::slot_select_one(), mr_menu::slot_select_same_continent(), mr_menu::slot_select_same_everywhere(), mr_menu::slot_select_same_tile(), mr_menu::slot_upgrade(), store_previous_focus(), tileset_changed(), toggle_unit_info_window_callback(), unit_board_callback(), unit_board_callback(), unit_deboard_callback(), unit_deboard_callback(), unit_disband_callback(), unit_disband_callback(), unit_focus_advance(), unit_focus_update(), unit_is_in_focus(), unit_order_callback(), unit_return_callback(), unit_return_callback(), unit_upgrade_callback(), unit_upgrade_callback(), go_act_menu::update(), hud_units::update_actions(), mr_menu::update_bases_menu(), update_line(), mr_menu::update_roads_menu(), and update_source_label().

## ◆ head_of_units_in_focus()

struct unit * head_of_units_in_focus | ( | void |  | ) |

Return head of focus units list.

Definition at line 406 of file control.c.

Referenced by center_on_something(), goto_dialog::fill_tab(), find_a_focus_unit_tile_to_center_on(), find_best_focus_candidate(), goto_city_callback(), goto_here_callback(), unit_hud_selector::island_filter(), main_key_down_handler(), popup_advanced_terrain_dialog(), quickselect(), reset_unit_table(), mr_menu::slot_autocaravan(), toggle_map_window_callback(), unit_focus_advance(), unit_focus_set(), unit_hud_selector::unit_hud_selector(), unit_order_callback(), unit_select_dialog_popup(), unit_actions::update_actions(), hud_units::update_actions(), fc_client::update_info_label(), units_select::update_units(), and usdlg_tile().

## ◆ is_activity_on_tile()

static bool is_activity_on_tile | ( | struct tile * | ptile,
|  | enum unit_activity | activity
| ) |  |

static

Return TRUE if there are any units doing the activity on the tile.

Definition at line 1290 of file control.c.

Referenced by can_unit_do_connect().

## ◆ key_bases_toggle()

void key_bases_toggle | ( | void |  | ) |

Handle user 'toggle bases display' input

Definition at line 3835 of file control.c.

Referenced by show_bases_callback(), and show_bases_callback().

## ◆ key_cancel_action()

void key_cancel_action | ( | void |  | ) |

The 'Escape' key.

Definition at line 3073 of file control.c.

Referenced by button_down_on_map(), key_press_map_canvas(), key_press_map_canvas(), map_view::keyPressEvent(), and map_event_handler().

## ◆ key_center_capital()

void key_center_capital | ( | void |  | ) |

Center the mapview on the player's named capital, or print a failure message.

Definition at line 3109 of file control.c.

Referenced by fc_client::create_game_page(), key_press_map_canvas(), and key_press_map_canvas().

## ◆ key_cities_toggle()

void key_cities_toggle | ( | void |  | ) |

Handle user 'toggle cities display' input

Definition at line 3867 of file control.c.

Referenced by show_cities_callback(), and show_cities_callback().

## ◆ key_city_buycost_toggle()

void key_city_buycost_toggle | ( | void |  | ) |

Toggles the showing of the buy cost of the current production in the city descriptions.

Definition at line 3762 of file control.c.

Referenced by show_city_buy_cost_callback(), show_city_buy_cost_callback(), and mr_menu::slot_city_buycost().

## ◆ key_city_full_bar_toggle()

void key_city_full_bar_toggle | ( | void |  | ) |

Toggle the "Draw the city bar" option.

Definition at line 3736 of file control.c.

Referenced by show_city_full_bar_callback(), show_city_full_bar_callback(), and mr_menu::slot_fullbar().

## ◆ key_city_growth_toggle()

void key_city_growth_toggle | ( | void |  | ) |

Toggles the "show city growth turns" option by passing off the request to another function...

Definition at line 3753 of file control.c.

Referenced by map_event_handler(), show_city_growth_callback(), show_city_growth_callback(), and mr_menu::slot_city_growth().

## ◆ key_city_names_toggle()

void key_city_names_toggle | ( | void |  | ) |

Handle user 'toggle city names display' input

Definition at line 3744 of file control.c.

Referenced by map_event_handler(), show_city_names_callback(), show_city_names_callback(), and mr_menu::slot_city_names().

## ◆ key_city_outlines_toggle()

void key_city_outlines_toggle | ( | void |  | ) |

Toggle drawing of city outlines.

Definition at line 3696 of file control.c.

Referenced by map_event_handler(), show_city_outlines_callback(), show_city_outlines_callback(), and mr_menu::slot_city_outlines().

## ◆ key_city_output_toggle()

void key_city_output_toggle | ( | void |  | ) |

Toggle drawing of city output produced by workers of the city.

Definition at line 3704 of file control.c.

Referenced by map_event_handler(), show_city_output_callback(), show_city_output_callback(), and mr_menu::slot_city_output().

## ◆ key_city_productions_toggle()

void key_city_productions_toggle | ( | void |  | ) |

Handle user 'toggle city production display' input

Definition at line 3770 of file control.c.

Referenced by map_event_handler(), show_city_productions_callback(), show_city_productions_callback(), and mr_menu::slot_city_production().

## ◆ key_city_trade_routes_toggle()

void key_city_trade_routes_toggle | ( | void |  | ) |

Handle client request to toggle drawing of trade route information by the city name for cities visible on the main map view.

Definition at line 3779 of file control.c.

Referenced by map_event_handler(), show_city_trade_routes_callback(), show_city_trade_routes_callback(), and mr_menu::slot_city_trade_routes().

## ◆ key_coastline_toggle()

void key_coastline_toggle | ( | void |  | ) |

Handle user 'toggle coastline display' input

Definition at line 3803 of file control.c.

Referenced by show_coastline_callback(), and show_coastline_callback().

## ◆ key_editor_recalculate_borders()

void key_editor_recalculate_borders | ( | void |  | ) |

Recalculate borders.

Definition at line 3923 of file control.c.

Referenced by recalc_borders_callback().

## ◆ key_editor_toggle()

void key_editor_toggle | ( | void |  | ) |

Toggle editor mode in the server.

Definition at line 3915 of file control.c.

Referenced by edit_mode_callback(), and edit_mode_callback().

## ◆ key_editor_toggle_fogofwar()

void key_editor_toggle_fogofwar | ( | void |  | ) |

Send a request to the server to toggle fog-of-war for the current player (only applies in edit mode).

Definition at line 3932 of file control.c.

Referenced by toggle_fog_callback(), and toggle_fog_callback().

## ◆ key_end_turn()

void key_end_turn | ( | void |  | ) |

Handle user 'end turn' input.

Definition at line 3126 of file control.c.

Referenced by end_turn_callback(), map_view::keyPressEvent(), main_key_down_handler(), side_finish_turn(), toplevel_key_press_handler(), toplevel_key_press_handler(), and unit_focus_advance().

## ◆ key_focus_unit_toggle()

void key_focus_unit_toggle | ( | void |  | ) |

Handle user 'toggle key units display' input

Definition at line 3899 of file control.c.

Referenced by show_focus_unit_callback(), and show_focus_unit_callback().

## ◆ key_fog_of_war_toggle()

void key_fog_of_war_toggle | ( | void |  | ) |

Handle user 'toggle fog of war display' input

Definition at line 3907 of file control.c.

Referenced by map_event_handler(), show_fog_of_war_callback(), and show_fog_of_war_callback().

## ◆ key_huts_toggle()

void key_huts_toggle | ( | void |  | ) |

Handle user 'toggle huts display' input

Definition at line 3851 of file control.c.

Referenced by map_event_handler(), show_huts_callback(), and show_huts_callback().

## ◆ key_irrigation_toggle()

void key_irrigation_toggle | ( | void |  | ) |

Handle user 'toggle irrigation display' input

Definition at line 3819 of file control.c.

Referenced by map_event_handler(), show_irrigation_callback(), and show_irrigation_callback().

## ◆ key_map_borders_toggle()

void key_map_borders_toggle | ( | void |  | ) |

Toggle map borders on the mapview on/off based on a keypress.

Definition at line 3720 of file control.c.

Referenced by map_event_handler(), show_national_borders_callback(), show_national_borders_callback(), and mr_menu::slot_borders().

## ◆ key_map_grid_toggle()

void key_map_grid_toggle | ( | void |  | ) |

Handle user 'toggle map grid' input

Definition at line 3712 of file control.c.

Referenced by map_event_handler(), show_map_grid_callback(), show_map_grid_callback(), and mr_menu::slot_map_grid().

## ◆ key_map_native_toggle()

void key_map_native_toggle | ( | void |  | ) |

Toggle native tiles on the mapview on/off based on a keypress.

Definition at line 3728 of file control.c.

Referenced by map_event_handler(), show_native_tiles_callback(), show_native_tiles_callback(), and mr_menu::slot_native_tiles().

## ◆ key_mines_toggle()

void key_mines_toggle | ( | void |  | ) |

Handle user 'toggle mine display' input

Definition at line 3827 of file control.c.

Referenced by map_event_handler(), show_mine_callback(), and show_mines_callback().

## ◆ key_pollution_toggle()

void key_pollution_toggle | ( | void |  | ) |

Handle user 'toggle pollution display' input

Definition at line 3859 of file control.c.

Referenced by map_event_handler(), show_pollution_callback(), and show_pollution_callback().

## ◆ key_recall_previous_focus_unit()

void key_recall_previous_focus_unit | ( | void |  | ) |

Recall the previous focus unit(s). See store_previous_focus().

Definition at line 3134 of file control.c.

Referenced by key_press_map_canvas(), key_press_map_canvas(), map_view::keyPressEvent(), and map_event_handler().

## ◆ key_resources_toggle()

void key_resources_toggle | ( | void |  | ) |

Handle user 'toggle resources display' input

Definition at line 3843 of file control.c.

Referenced by map_event_handler(), show_resources_callback(), and show_resources_callback().

## ◆ key_roads_rails_toggle()

void key_roads_rails_toggle | ( | void |  | ) |

Handle user 'toggle road/railroad display' input

Definition at line 3811 of file control.c.

Referenced by show_paths_callback(), and show_road_rails_callback().

## ◆ key_terrain_toggle()

void key_terrain_toggle | ( | void |  | ) |

Handle user 'toggle terrain display' input

Definition at line 3795 of file control.c.

Referenced by map_event_handler(), show_terrain_callback(), and show_terrain_callback().

## ◆ key_unit_action_select()

void key_unit_action_select | ( | void |  | ) |

Handle user 'Do...' input

Definition at line 3198 of file control.c.

Referenced by key_unit_action_select_tgt().

## ◆ key_unit_action_select_tgt()

void key_unit_action_select_tgt | ( | void |  | ) |

Have the user select what action the unit(s) in focus should perform to the targets at the tile the user will specify by clicking on it.

Will stop asking for a target tile and have each actor unit act against its own tile if called twice.

Definition at line 3220 of file control.c.

Referenced by diplomat_action_callback(), do_action_callback(), mr_menu::slot_action(), and unit_order_callback().

## ◆ key_unit_airbase()

void key_unit_airbase | ( | void |  | ) |

Handle user 'build base of class airbase' input

Definition at line 3366 of file control.c.

Referenced by build_airbase_callback(), build_airbase_callback(), mr_menu::slot_unit_airbase(), and unit_order_callback().

## ◆ key_unit_assign_battlegroup()

void key_unit_assign_battlegroup | ( | int | battlegroup,
|  | bool | append
| ) |  |

Assign all focus units to this battlegroup.

Definition at line 3631 of file control.c.

Referenced by bg_append0_callback(), bg_append1_callback(), bg_append2_callback(), bg_append3_callback(), bg_append_callback(), bg_assign0_callback(), bg_assign1_callback(), bg_assign2_callback(), bg_assign3_callback(), bg_assign_callback(), mr_menu::slot_bg1append(), mr_menu::slot_bg1assign(), mr_menu::slot_bg2append(), mr_menu::slot_bg2assign(), mr_menu::slot_bg3append(), mr_menu::slot_bg3assign(), mr_menu::slot_bg4append(), and mr_menu::slot_bg4assign().

## ◆ key_unit_auto_explore()

void key_unit_auto_explore | ( | void |  | ) |

Handle user 'autoexplore' input

Definition at line 3383 of file control.c.

Referenced by mr_menu::slot_unit_explore(), unit_explore_callback(), unit_explore_callback(), and unit_order_callback().

## ◆ key_unit_auto_settle()

void key_unit_auto_settle | ( | void |  | ) |

Call to request (from the server) that the focus unit is put into autosettler mode.

Definition at line 3396 of file control.c.

Referenced by auto_settle_callback(), auto_settle_callback(), and mr_menu::slot_auto_settler().

## ◆ key_unit_build_city()

void key_unit_build_city | ( | void |  | ) |

Handle use 'build city' input.

Definition at line 3167 of file control.c.

Referenced by unit_order_callback().

## ◆ key_unit_build_wonder()

void key_unit_build_wonder | ( | void |  | ) |

Handle user 'help build wonder' input

Definition at line 3177 of file control.c.

Referenced by unit_order_callback().

## ◆ key_unit_clean()

void key_unit_clean | ( | void |  | ) |

Handle user 'clean' input

Definition at line 3553 of file control.c.

Referenced by clean_callback().

## ◆ key_unit_connect()

void key_unit_connect | ( | enum unit_activity | activity,
|  | struct extra_type * | tgt
| ) |  |

Handle user pressing key for 'Connect' command

Definition at line 3189 of file control.c.

Referenced by connect_irrigation_callback(), connect_irrigation_callback(), connect_maglev_callback(), connect_maglev_callback(), connect_rail_callback(), connect_rail_callback(), connect_road_callback(), connect_road_callback(), mr_menu::slot_conn_irrigation(), mr_menu::slot_conn_maglev(), mr_menu::slot_conn_rail(), mr_menu::slot_conn_road(), and unit_order_callback().

## ◆ key_unit_convert()

void key_unit_convert | ( | void |  | ) |

Unit convert key pressed or respective menu entry selected.

Definition at line 3408 of file control.c.

Referenced by mr_menu::slot_convert(), unit_convert_callback(), unit_convert_callback(), and unit_order_callback().

## ◆ key_unit_cultivate()

void key_unit_cultivate | ( | void |  | ) |

Handle user 'cultivate' input

Definition at line 3509 of file control.c.

Referenced by cultivate_callback(), cultivate_callback(), mr_menu::slot_cultivate(), and unit_order_callback().

## ◆ key_unit_done()

void key_unit_done | ( | void |  | ) |

Handle user 'unit done' input

Definition at line 3277 of file control.c.

Referenced by mr_menu::slot_done_moving(), unit_done_callback(), unit_done_callback(), and unit_order_callback().

## ◆ key_unit_extra()

static void key_unit_extra | ( | enum unit_activity | act,
|  | enum extra_cause | cause
| ) |  |

static

Handle user extra building input of given type

Definition at line 3465 of file control.c.

Referenced by key_unit_irrigate(), and key_unit_mine().

## ◆ key_unit_fallout()

void key_unit_fallout | ( | void |  | ) |

Handle user 'clean fallout' input

Definition at line 3418 of file control.c.

Referenced by clean_fallout_callback(), mr_menu::slot_clean_fallout(), and unit_order_callback().

## ◆ key_unit_fortify()

void key_unit_fortify | ( | void |  | ) |

Handle user 'fortify' input

Definition at line 3426 of file control.c.

Referenced by mr_menu::slot_unit_fortify(), and unit_order_callback().

## ◆ key_unit_fortress()

void key_unit_fortress | ( | void |  | ) |

Handle user 'build base of class fortress' input

Definition at line 3438 of file control.c.

Referenced by build_fortress_callback(), build_fortress_callback(), mr_menu::slot_unit_fortress(), and unit_order_callback().

## ◆ key_unit_gen_clean()

static void key_unit_gen_clean | ( | enum unit_activity | act,
|  | enum extra_rmcause | rmcause
| ) |  |

static

Handle user extra cleaning input of given class

Definition at line 3482 of file control.c.

Referenced by key_unit_fallout(), and key_unit_pollution().

## ◆ key_unit_goto()

void key_unit_goto | ( | void |  | ) |

Handle user 'unit goto' input

Definition at line 3285 of file control.c.

Referenced by button_down_on_map(), finger_down_on_map(), mr_menu::slot_unit_goto(), unit_goto_callback(), unit_goto_callback(), and unit_order_callback().

## ◆ key_unit_homecity()

void key_unit_homecity | ( | void |  | ) |

Handle user 'change homecity' input

Definition at line 3455 of file control.c.

Referenced by mr_menu::slot_set_home(), unit_homecity_callback(), unit_homecity_callback(), and unit_order_callback().

## ◆ key_unit_irrigate()

void key_unit_irrigate | ( | void |  | ) |

Handle user 'irrigate' input

Definition at line 3501 of file control.c.

Referenced by build_irrigation_callback(), build_irrigation_callback(), mr_menu::slot_build_irrigation(), and unit_order_callback().

## ◆ key_unit_mine()

void key_unit_mine | ( | void |  | ) |

Handle user 'build mine' input

Definition at line 3521 of file control.c.

Referenced by build_mine_callback(), build_mine_callback(), mr_menu::slot_build_mine(), and unit_order_callback().

## ◆ key_unit_move()

void key_unit_move | ( | enum direction8 | gui_dir | ) |

Move the focus unit in the given direction. Here directions are defined according to the GUI, so that north is "up" in the interface.

Definition at line 3155 of file control.c.

Referenced by key_press_map_canvas(), key_press_map_canvas(), map_view::keyPressEvent(), and map_event_handler().

## ◆ key_unit_paradrop()

void key_unit_paradrop | ( | void |  | ) |

Handle user 'paradrop' input

Definition at line 3293 of file control.c.

Referenced by do_paradrop_callback(), paradrop_callback(), mr_menu::slot_clean_pollution(), and unit_order_callback().

## ◆ key_unit_patrol()

void key_unit_patrol | ( | void |  | ) |

Handle user 'patrol' input

Definition at line 3301 of file control.c.

Referenced by mr_menu::slot_patrol(), unit_order_callback(), unit_patrol_callback(), and unit_patrol_callback().

## ◆ key_unit_pillage()

void key_unit_pillage | ( | void |  | ) |

Handle user 'pillage' input

Definition at line 3541 of file control.c.

Referenced by do_pillage_callback(), pillage_callback(), mr_menu::slot_pillage(), and unit_order_callback().

## ◆ key_unit_plant()

void key_unit_plant | ( | void |  | ) |

Handle user 'plant' input

Definition at line 3529 of file control.c.

Referenced by plant_callback(), plant_callback(), mr_menu::slot_plant(), and unit_order_callback().

## ◆ key_unit_pollution()

void key_unit_pollution | ( | void |  | ) |

Handle user 'clean pollution' input

Definition at line 3581 of file control.c.

Referenced by unit_order_callback().

## ◆ key_unit_road()

void key_unit_road | ( | void |  | ) |

Handle user 'build road or railroad' input

Definition at line 3589 of file control.c.

Referenced by unit_order_callback().

## ◆ key_unit_select_battlegroup()

void key_unit_select_battlegroup | ( | int | battlegroup,
|  | bool | append
| ) |  |

Bring this battlegroup into focus.

Definition at line 3670 of file control.c.

Referenced by bg_select0_callback(), bg_select1_callback(), bg_select2_callback(), bg_select3_callback(), bg_select_callback(), mr_menu::slot_bg1select(), mr_menu::slot_bg2select(), mr_menu::slot_bg3select(), and mr_menu::slot_bg4select().

## ◆ key_unit_sentry()

void key_unit_sentry | ( | void |  | ) |

Handle user 'sentry' input

Definition at line 3607 of file control.c.

Referenced by mr_menu::slot_unit_sentry(), unit_order_callback(), unit_sentry_callback(), and unit_sentry_callback().

## ◆ key_unit_shields_toggle()

void key_unit_shields_toggle | ( | void |  | ) |

Toggle the "Draw shield graphics for units" option.

Definition at line 3891 of file control.c.

Referenced by show_unit_shields_callback(), and show_unit_shields_callback().

## ◆ key_unit_solid_bg_toggle()

void key_unit_solid_bg_toggle | ( | void |  | ) |

Toggle the "Solid unit background color" option.

Definition at line 3883 of file control.c.

Referenced by show_unit_solid_bg_callback(), and show_unit_solid_bg_callback().

## ◆ key_unit_stack_size_toggle()

void key_unit_stack_size_toggle | ( | void |  | ) |

Handle client request to toggle drawing of unit stack size information

Definition at line 3787 of file control.c.

Referenced by show_stack_size_callback(), show_stack_size_callback(), and mr_menu::slot_stack_size().

## ◆ key_unit_trade_route()

void key_unit_trade_route | ( | void |  | ) |

Handle user 'establish trade route' input

Definition at line 3309 of file control.c.

Referenced by unit_order_callback().

## ◆ key_unit_transform()

void key_unit_transform | ( | void |  | ) |

Handle user 'transform unit' input

Definition at line 3619 of file control.c.

Referenced by mr_menu::slot_transform(), transform_terrain_callback(), transform_terrain_callback(), and unit_order_callback().

## ◆ key_unit_unload_all()

void key_unit_unload_all | ( | void |  | ) |

Handle user 'unload all' input

Definition at line 3323 of file control.c.

Referenced by mr_menu::slot_unload_all(), unit_order_callback(), unit_unload_transporter_callback(), and unit_unload_transporter_callback().

## ◆ key_unit_wait()

void key_unit_wait | ( | void |  | ) |

Handle user 'wait' input

Definition at line 3348 of file control.c.

Referenced by act_sel_wait(), act_sel_wait_callback(), act_sel_wait_callback(), fc_client::create_game_page(), mr_menu::slot_wait(), unit_info_window_callback(), unit_order_callback(), unit_wait_callback(), and unit_wait_callback().

## ◆ key_unit_wakeup_others()

void key_unit_wakeup_others | ( | void |  | ) |

Handle user 'wakeup others' input

Definition at line 3356 of file control.c.

Referenced by mr_menu::slot_unsentry(), unit_order_callback(), unit_unsentry_callback(), and unsentry_all_callback().

## ◆ key_units_toggle()

void key_units_toggle | ( | void |  | ) |

Handle user 'toggle units display' input

Definition at line 3875 of file control.c.

Referenced by map_event_handler(), show_units_callback(), and show_units_callback().

## ◆ quickselect()

static struct unit * quickselect | ( | struct tile * | ptile,
|  | enum quickselect_type | qtype
| ) |  |

static

Quickselecting a unit is normally done with [control] left, right click, for the current tile. Bypassing the stack popup is quite convenient, and can be tactically important in furious multiplayer games.

Definition at line 2857 of file control.c.

Referenced by do_map_click().

## ◆ request_action_details()

void request_action_details | ( | action_id | action,
|  | int | actor_id,
|  | int | target_id
| ) |  |

Request data for follow up questions about an action the unit can perform.

- action : The action the follow up question is about.
- actor_id : The unit ID of the acting unit.
- target_id : The ID of the target unit or city.

Definition at line 1695 of file control.c.

Referenced by diplomat_bribe(), diplomat_bribe_callback(), diplomat_incite(), diplomat_incite_callback(), diplomat_incite_escape(), request_action_details_callback(), spy_incite_callback(), spy_request_sabotage_esc_list(), spy_request_sabotage_list(), spy_request_strike_bld_list(), spy_sabotage_esc_request(), spy_sabotage_request(), and spy_strike_bld_request().

## ◆ request_center_focus_unit()

void request_center_focus_unit | ( | void |  | ) |

Center to focus unit.

Definition at line 2610 of file control.c.

Referenced by center_on_unit(), map_event_handler(), click_label::on_clicked(), side_center_unit(), mr_menu::slot_center_view(), and unit_info_window_callback().

## ◆ request_do_action()

void request_do_action | ( | action_id | action,
|  | int | actor_id,
|  | int | target_id,
|  | int | sub_tgt,
|  | const char * | name
| ) |  |

Request an actor unit to do a specific action.

- action : The action to be requested.
- actor_id : The unit ID of the actor unit.
- target_id : The ID of the target unit, city or tile.
- sub_tgt : The sub target. Only some actions take a sub target. The sub target kind depends on the action. Example sub targets are the technology to steal from a city, the extra to pillage at a tile and the building to sabotage in a city.
- name : Used by ACTION_FOUND_CITY to specify city name.

Definition at line 1675 of file control.c.

Referenced by action_decision_maybe_auto(), airlift(), attack(), base(), bombard(), bombard2(), bombard3(), bribe_response(), capture_units(), caravan_establish_trade(), caravan_help_build(), caravan_marketplace(), clean_fallout(), clean_pollution(), conquer_city(), conquer_city2(), conquer_extras(), conquer_extras2(), convert_unit(), cultivate(), destroy_city(), diplomat_bribe_yes_callback(), diplomat_embassy(), diplomat_incite_yes_callback(), diplomat_investigate(), diplomat_sabotage(), diplomat_sabotage_esc(), diplomat_steal(), diplomat_steal_esc(), disband_unit(), disembark1(), disembark2(), do_disband_alternative(), do_unit_paradrop_to(), enter_hut(), enter_hut2(), expel_unit(), finish_city(), fortify(), frighten_hut(), frighten_hut2(), handle_city_name_suggestion_info(), heal_unit(), heal_unit2(), homeless(), incite_response(), irrigate(), join_city(), mine(), nuke(), nuke_city(), nuke_units(), paradrop(), paradrop_conquer(), paradrop_enter(), paradrop_enter_conquer(), paradrop_frighten(), paradrop_frighten_conquer(), pillage(), plant(), popup_action_selection(), popup_bribe_dialog(), popup_incite_dialog(), regular_move(), request_unit_airlift(), request_unit_build_city(), request_unit_caravan_action(), request_unit_change_homecity(), request_unit_load(), request_unit_unload(), request_unit_upgrade(), road(), sabotage_impr_callback(), simple_action_callback(), simple_action_callback(), spy_advances_response(), spy_embassy(), spy_improvements_response(), spy_investigate(), spy_nuke_city(), spy_nuke_city_esc(), spy_poison(), spy_poison_esc(), spy_sabotage(), spy_sabotage_unit(), spy_sabotage_unit_esc(), spy_steal_callback(), spy_steal_gold(), spy_steal_gold_esc(), spy_steal_maps(), spy_steal_maps_esc(), spy_steal_popup_shared(), spy_steal_something(), suicide_attack(), transform_terrain(), transport_alight(), transport_board(), transport_embark(), transport_embark2(), transport_embark3(), transport_unload(), unit_disband_recover(), and unit_home_city().

## ◆ request_move_unit_direction()

void request_move_unit_direction | ( | struct unit * | punit,
|  | int | dir
| ) |  |

This function is called whenever the player pressed an arrow key.

We do NOT take into account that punit might be a caravan or a diplomat trying to move into a city, or a diplomat going into a tile with a unit; the server will catch those cases and send the client a package to pop up a dialog. (the server code has to be there anyway as goto's are entirely in the server)

Definition at line 1777 of file control.c.

Referenced by key_unit_move(), and mr_menu::slot_execute_orders().

## ◆ request_new_unit_activity()

void request_new_unit_activity | ( | struct unit * | punit,
|  | enum unit_activity | act
| ) |  |

Send request for unit activity changing to server. If activity has target, use request_new_unit_activity_targeted() instead.

Definition at line 1828 of file control.c.

Referenced by activate_all_units(), adv_unit_select_callback(), adv_unit_sentry_idle_callback(), clear_unit_orders(), focus_units_info_callback(), handle_player_diplstate(), key_unit_cultivate(), key_unit_fortify(), key_unit_plant(), key_unit_sentry(), key_unit_transform(), request_unit_convert(), request_unit_fortify(), request_unit_sentry(), unit_select_callback(), usdlg_cmd_exec_unit(), and wakeup_sentried_units().

## ◆ request_new_unit_activity_targeted()

void request_new_unit_activity_targeted | ( | struct unit * | punit,
|  | enum unit_activity | act,
|  | struct extra_type * | tgt
| ) |  |

Send request for unit activity changing to server. This is for activities that are targeted to certain special or base type.

Definition at line 1837 of file control.c.

Referenced by base_callback(), base_callback(), build_road_callback(), build_road_callback(), clean_menu_callback(), clean_pollution_callback(), irrigation_callback(), key_unit_airbase(), key_unit_clean(), key_unit_extra(), key_unit_fortress(), key_unit_gen_clean(), key_unit_road(), mine_callback(), pillage_callback(), pillage_callback(), pillage_something(), request_new_unit_activity(), request_unit_pillage(), road_callback(), road_callback(), mr_menu::slot_build_base(), mr_menu::slot_build_path(), mr_menu::slot_build_road(), and mr_menu::slot_clean_pollution().

## ◆ request_toggle_bases()

void request_toggle_bases | ( | void |  | ) |

Toggle display of bases

Definition at line 2479 of file control.c.

Referenced by key_bases_toggle(), and map_event_handler().

## ◆ request_toggle_cities()

void request_toggle_cities | ( | void |  | ) |

Toggle display of cities

Definition at line 2531 of file control.c.

Referenced by key_cities_toggle(), and map_event_handler().

## ◆ request_toggle_city_buycost()

void request_toggle_city_buycost | ( | void |  | ) |

Toggle display of city buycost

Definition at line 2375 of file control.c.

Referenced by key_city_buycost_toggle().

## ◆ request_toggle_city_full_bar()

void request_toggle_city_full_bar | ( | void |  | ) |

Toggle display of city full bar.

Definition at line 2323 of file control.c.

Referenced by key_city_full_bar_toggle().

## ◆ request_toggle_city_growth()

void request_toggle_city_growth | ( | void |  | ) |

Toggle display of city growth (turns-to-grow)

Definition at line 2349 of file control.c.

Referenced by key_city_growth_toggle().

## ◆ request_toggle_city_names()

void request_toggle_city_names | ( | void |  | ) |

Toggle display of city names

Definition at line 2336 of file control.c.

Referenced by key_city_names_toggle().

## ◆ request_toggle_city_outlines()

void request_toggle_city_outlines | ( | void |  | ) |

Toggle display of city outlines on the map

Definition at line 2258 of file control.c.

Referenced by key_city_outlines_toggle().

## ◆ request_toggle_city_output()

void request_toggle_city_output | ( | void |  | ) |

Toggle display of worker output of cities on the map

Definition at line 2271 of file control.c.

Referenced by key_city_output_toggle().

## ◆ request_toggle_city_productions()

void request_toggle_city_productions | ( | void |  | ) |

Toggle display of city productions

Definition at line 2362 of file control.c.

Referenced by key_city_productions_toggle().

## ◆ request_toggle_city_trade_routes()

void request_toggle_city_trade_routes | ( | void |  | ) |

Toggle display of city trade routes

Definition at line 2388 of file control.c.

Referenced by key_city_trade_routes_toggle().

## ◆ request_toggle_coastline()

void request_toggle_coastline | ( | void |  | ) |

Toggle display of coastline

Definition at line 2427 of file control.c.

Referenced by key_coastline_toggle().

## ◆ request_toggle_focus_unit()

void request_toggle_focus_unit | ( | void |  | ) |

Toggle display of focus unit

Definition at line 2583 of file control.c.

Referenced by key_focus_unit_toggle().

## ◆ request_toggle_fog_of_war()

void request_toggle_fog_of_war | ( | void |  | ) |

Toggle display of fog of war

Definition at line 2596 of file control.c.

Referenced by key_fog_of_war_toggle().

## ◆ request_toggle_huts()

void request_toggle_huts | ( | void |  | ) |

Toggle display of huts

Definition at line 2505 of file control.c.

Referenced by key_huts_toggle().

## ◆ request_toggle_irrigation()

void request_toggle_irrigation | ( | void |  | ) |

Toggle display of irrigation

Definition at line 2453 of file control.c.

Referenced by key_irrigation_toggle().

## ◆ request_toggle_map_borders()

void request_toggle_map_borders | ( | void |  | ) |

Toggle display of national borders on the map

Definition at line 2297 of file control.c.

Referenced by key_map_borders_toggle().

## ◆ request_toggle_map_grid()

void request_toggle_map_grid | ( | void |  | ) |

Toggle display of grid lines on the map

Definition at line 2284 of file control.c.

Referenced by key_map_grid_toggle().

## ◆ request_toggle_map_native()

void request_toggle_map_native | ( | void |  | ) |

Toggle display of native tiles on the map

Definition at line 2310 of file control.c.

Referenced by key_map_native_toggle().

## ◆ request_toggle_mines()

void request_toggle_mines | ( | void |  | ) |

Toggle display of mines

Definition at line 2466 of file control.c.

Referenced by key_mines_toggle().

## ◆ request_toggle_pollution()

void request_toggle_pollution | ( | void |  | ) |

Toggle display of pollution

Definition at line 2518 of file control.c.

Referenced by key_pollution_toggle().

## ◆ request_toggle_resources()

void request_toggle_resources | ( | void |  | ) |

Toggle display of resources

Definition at line 2492 of file control.c.

Referenced by key_resources_toggle().

## ◆ request_toggle_roads_rails()

void request_toggle_roads_rails | ( | void |  | ) |

Toggle display of roads and rails

Definition at line 2440 of file control.c.

Referenced by key_roads_rails_toggle().

## ◆ request_toggle_terrain()

void request_toggle_terrain | ( | void |  | ) |

Toggle display of terrain

Definition at line 2414 of file control.c.

Referenced by key_terrain_toggle().

## ◆ request_toggle_unit_shields()

void request_toggle_unit_shields | ( | void |  | ) |

Toggle display of unit shields.

Definition at line 2570 of file control.c.

Referenced by key_unit_shields_toggle().

## ◆ request_toggle_unit_solid_bg()

void request_toggle_unit_solid_bg | ( | void |  | ) |

Toggle display of unit solid background.

Definition at line 2557 of file control.c.

Referenced by key_unit_solid_bg_toggle().

## ◆ request_toggle_unit_stack_size()

void request_toggle_unit_stack_size | ( | void |  | ) |

Toggle display of unit stack sizes

Definition at line 2401 of file control.c.

Referenced by key_unit_stack_size_toggle().

## ◆ request_toggle_units()

void request_toggle_units | ( | void |  | ) |

Toggle display of units

Definition at line 2544 of file control.c.

Referenced by key_units_toggle().

## ◆ request_unit_airlift()

void request_unit_airlift | ( | struct unit * | punit,
|  | struct city * | pcity
| ) |  |

Send unit airlift request to server.

Definition at line 1512 of file control.c.

Referenced by goto_dialog::airlift_to(), goto_city_callback(), goto_cmd_callback(), and multiairlift().

## ◆ request_unit_autosettlers()

void request_unit_autosettlers | ( | const struct unit * | punit | ) |

Call to request (from the server) that the settler unit is put into autosettler mode.

Definition at line 2041 of file control.c.

Referenced by key_unit_auto_settle(), and unit_order_callback().

## ◆ request_unit_build_city()

void request_unit_build_city | ( | struct unit * | punit | ) |

Player pressed 'b' or otherwise instructed unit to build or add to city. If the unit can build a city, we popup the appropriate dialog. Otherwise, we just send a packet to the server. If this action is not appropriate, the server will respond with an appropriate message. (This is to avoid duplicating all the server checks and messages here.)

Definition at line 1714 of file control.c.

Referenced by build_city_callback(), build_city_callback(), key_unit_build_city(), and mr_menu::slot_build_city().

## ◆ request_unit_caravan_action()

void request_unit_caravan_action | ( | struct unit * | punit,
|  | action_id | action
| ) |  |

Send request to do caravan action - establishing trade route or helping in wonder building - to server.

Definition at line 2121 of file control.c.

Referenced by build_city_callback(), build_city_callback(), build_road_callback(), build_road_callback(), key_unit_build_wonder(), key_unit_trade_route(), mr_menu::slot_build_city(), and mr_menu::slot_build_road().

## ◆ request_unit_change_homecity()

void request_unit_change_homecity | ( | struct unit * | punit | ) |

Send request to change unit homecity to server.

Definition at line 1994 of file control.c.

Referenced by unit_item::change_homecity(), homecity_units_orders_city_dlg_callback(), key_unit_homecity(), unit_homecity_callback(), and unit_homecity_callback().

## ◆ request_unit_connect()

void request_unit_connect | ( | enum unit_activity | activity,
|  | struct extra_type * | tgt
| ) |  |

Prompt player for entering destination point for unit connect (e.g. connecting with roads)

Definition at line 1451 of file control.c.

Referenced by key_unit_connect().

## ◆ request_unit_convert()

void request_unit_convert | ( | struct unit * | punit | ) |

Sends unit convert packet.

Definition at line 2018 of file control.c.

Referenced by key_unit_convert().

## ◆ request_unit_disband()

void request_unit_disband | ( | struct unit * | punit | ) |

Send request to disband unit to server.

Definition at line 1975 of file control.c.

Referenced by disband_all_units(), disband_box::disband_clicked(), ok_disband_unit_window_callback(), and popup_disband_dialog().

## ◆ request_unit_fortify()

void request_unit_fortify | ( | struct unit * | punit | ) |

Try to fortify unit.

Definition at line 2213 of file control.c.

Referenced by fortify_callback(), fortify_callback(), unit_item::fortify_unit(), fortify_units_orders_city_dlg_callback(), unit_fortify_callback(), and unit_fortify_callback().

## ◆ request_unit_goto()

void request_unit_goto | ( | enum unit_orders | last_order,
|  | action_id | act_id,
|  | int | sub_tgt_id
| ) |  |

Do a goto with an order at the end (or ORDER_LAST).

Definition at line 1103 of file control.c.

Referenced by key_unit_goto(), maybe_activate_keyboardless_goto(), go_act_menu::start_go_act(), unit_goto_and_callback(), unit_goto_and_callback(), and unit_order_callback().

## ◆ request_unit_load()

void request_unit_load | ( | struct unit * | pcargo,
|  | struct unit * | ptrans,
|  | struct tile * | ptile
| ) |  |

Send a request to the server that the cargo be loaded into the transporter.

If ptransporter is NULL a suitable transporter will be chosen.

Definition at line 2056 of file control.c.

Referenced by qtg_request_transport(), request_transport(), hud_unit_loader::selection_changed(), transport_response_callback(), and unit_order_callback().

## ◆ request_unit_move_done()

void request_unit_move_done | ( | void |  | ) |

Set focus units to FOCUS_DONE state.

Definition at line 2636 of file control.c.

Referenced by key_unit_done().

## ◆ request_unit_non_action_move()

void request_unit_non_action_move | ( | struct unit * | punit,
|  | struct tile * | dest_tile
| ) |  |

Order a unit to move to a neighboring tile without performing an action.

Does nothing it the destination tile isn't next to the tile where the unit currently is located.

Definition at line 1733 of file control.c.

## ◆ request_unit_paradrop()

void request_unit_paradrop | ( | struct unit_list * | punits | ) |

Have the player select what tile to paradrop to. Once selected a paradrop request will be sent to server.

Definition at line 2144 of file control.c.

Referenced by key_unit_paradrop().

## ◆ request_unit_patrol()

void request_unit_patrol | ( | void |  | ) |

Either start new patrol route planning, or add waypoint to current one.

Definition at line 2179 of file control.c.

Referenced by key_unit_patrol().

## ◆ request_unit_pillage()

void request_unit_pillage | ( | struct unit * | punit | ) |

Send pillage request to server.

Definition at line 2224 of file control.c.

Referenced by key_unit_pillage().

## ◆ request_unit_return()

void request_unit_return | ( | struct unit * | punit | ) |

Return-and-recover for a particular unit. This sets the unit to GOTO the nearest city.

Definition at line 1521 of file control.c.

Referenced by mr_menu::slot_return_to_city(), unit_order_callback(), unit_return_callback(), and unit_return_callback().

## ◆ request_unit_select()

void request_unit_select | ( | struct unit_list * | punits,
|  | enum unit_select_type_mode | seltype,
|  | enum unit_select_location_mode | selloc
| ) |  |

Select all units based on the given list of units and the selection modes.

Definition at line 1590 of file control.c.

Referenced by select_all_on_tile_callback(), select_all_on_tile_callback(), select_same_type_callback(), select_same_type_callback(), select_same_type_cont_callback(), select_same_type_cont_callback(), select_same_type_tile_callback(), select_same_type_tile_callback(), select_single_callback(), select_single_callback(), mr_menu::slot_select_all_tile(), mr_menu::slot_select_one(), mr_menu::slot_select_same_continent(), mr_menu::slot_select_same_everywhere(), and mr_menu::slot_select_same_tile().

## ◆ request_unit_sentry()

void request_unit_sentry | ( | struct unit * | punit | ) |

Try to sentry unit.

Definition at line 2202 of file control.c.

Referenced by unit_item::sentry_unit(), sentry_units_orders_city_dlg_callback(), unit_sentry_callback(), and unit_sentry_callback().

## ◆ request_unit_ssa_set()

void request_unit_ssa_set | ( | const struct unit * | punit,
|  | enum server_side_agent | agent
| ) |  |

Call to request (from the server) that the unit is put under the control of the specified server side agent or - if agent is SSA_NONE - under client control.

Definition at line 2028 of file control.c.

Referenced by key_unit_auto_explore(), request_do_action(), request_move_unit_direction(), request_new_unit_activity_targeted(), request_orders_cleared(), request_unit_autosettlers(), request_unit_non_action_move(), send_connect_route(), and send_path_orders().

## ◆ request_unit_unload()

void request_unit_unload | ( | struct unit * | pcargo | ) |

Send a request to the server that the cargo be unloaded from its current transporter.

Definition at line 2092 of file control.c.

Referenced by request_unit_unload_all(), mr_menu::slot_deboard(), unit_deboard_callback(), unit_deboard_callback(), unit_order_callback(), unit_unload_callback(), unit_unload_callback(), and unit_item::unload_unit().

## ◆ request_unit_unload_all()

struct unit * request_unit_unload_all | ( | struct unit * | punit | ) |

Returns one of the unit of the transporter which can have focus next.

Definition at line 1480 of file control.c.

Referenced by key_unit_unload_all(), and unit_item::unload_all().

## ◆ request_unit_upgrade()

void request_unit_upgrade | ( | struct unit * | punit | ) |

Send request to upgrade unit to server.

Definition at line 2006 of file control.c.

Referenced by ok_upgrade_unit_window_callback(), and popup_upgrade_dialog().

## ◆ request_unit_wakeup()

void request_unit_wakeup | ( | struct unit * | punit | ) |

(RP:) un-sentry all my own sentried units on punit's tile

Definition at line 1569 of file control.c.

Referenced by key_unit_wakeup_others().

## ◆ request_units_wait()

void request_units_wait | ( | struct unit_list * | punits | ) |

Set units in list to waiting focus. If they are current focus units, advance focus.

Definition at line 2623 of file control.c.

Referenced by key_unit_wait().

## ◆ set_hover_state()

void set_hover_state | ( | struct unit_list * | punits,
|  | enum cursor_hover_state | state,
|  | enum unit_activity | activity,
|  | struct extra_type * | tgt,
|  | int | last_tgt,
|  | int | last_sub_tgt,
|  | action_id | action,
|  | enum unit_orders | order
| ) |  |

Enter the given hover state.

activity => The connect activity (ACTIVITY_IRRIGATE, etc.) order => The last order (ORDER_PERFORM_ACTION, ORDER_LAST, etc.)

Definition at line 285 of file control.c.

Referenced by clear_hover_state(), key_cancel_action(), key_unit_action_select_tgt(), overview_update_line(), paradrop_here_callback(), patrol_here_callback(), request_unit_connect(), request_unit_goto(), request_unit_paradrop(), request_unit_patrol(), mr_menu::slot_delayed_goto(), and update_line().

## ◆ set_units_in_combat()

void set_units_in_combat | ( | struct unit * | pattacker,
|  | struct unit * | pdefender
| ) |  |

Adjusts way combatants are displayed suitable for combat.

Definition at line 1013 of file control.c.

Referenced by decrease_unit_hp_smooth(), and handle_unit_combat_info().

## ◆ should_ask_server_for_actions()

bool should_ask_server_for_actions | ( | const struct unit * | punit | ) |

Returns TRUE iff the client should ask the server about what actions a unit can perform.

Definition at line 334 of file control.c.

Referenced by action_selection_next_in_focus(), current_focus_append(), fill_unit_sprite_array(), handle_unit_packet_common(), and unit_focus_advance().

## ◆ store_previous_focus()

static void store_previous_focus | ( | void |  | ) |

static

Store the focus unit(s). This is used so that we can return to the previously focused unit with an appropriate keypress.

Definition at line 194 of file control.c.

Referenced by unit_focus_set().

## ◆ unit_change_battlegroup()

void unit_change_battlegroup | ( | struct unit * | punit,
|  | int | battlegroup
| ) |  |

Change the battlegroup for this unit.

Definition at line 250 of file control.c.

Referenced by handle_unit_packet_common().

## ◆ unit_focus_add()

void unit_focus_add | ( | struct unit * | punit | ) |

Adds this unit to the list of units in focus.

Definition at line 557 of file control.c.

Referenced by define_tiles_within_rectangle(), do_map_click(), key_recall_previous_focus_unit(), key_unit_assign_battlegroup(), key_unit_select_battlegroup(), request_unit_select(), unit_hud_selector::uhs_select(), and usdlg_cmd_exec_unit().

## ◆ unit_focus_advance()

void unit_focus_advance | ( | void |  | ) |

This function may be called from packhand.c, via unit_focus_update(), as a result of packets indicating change in activity for a unit. Also called when user press the "Wait" command.

FIXME: Add feature to focus only units of a certain category.

Definition at line 671 of file control.c.

Referenced by client_remove_unit(), request_unit_move_done(), request_units_wait(), unit_focus_remove(), and unit_focus_update().

## ◆ unit_focus_remove()

void unit_focus_remove | ( | struct unit * | punit | ) |

Removes this unit from the list of units in focus.

Definition at line 587 of file control.c.

Referenced by usdlg_cmd_exec_unit().

## ◆ unit_focus_set()

void unit_focus_set | ( | struct unit * | punit | ) |

Sets the focus unit directly. The unit given will be given the focus; if NULL the focus will be cleared.

This function is called for several reasons. Sometimes a fast-focus happens immediately as a result of a client action. Other times it happens because of a server-sent packet that wakes up a unit.

Definition at line 502 of file control.c.

Referenced by activate_all_units(), unit_item::activate_and_close_dialog(), activate_and_exit_units_orders_city_dlg_callback(), unit_item::activate_unit(), activate_units_orders_city_dlg_callback(), adv_unit_select_callback(), define_tiles_within_rectangle(), focus_units_info_callback(), handle_city_sabotage_list(), handle_unit_action_answer(), key_recall_previous_focus_unit(), key_unit_select_battlegroup(), key_unit_unload_all(), middle_present_unit_release(), middle_supported_unit_release(), unit_item::mousePressEvent(), units_select::mousePressEvent(), present_unit_activate_close_callback(), present_unit_activate_close_callback(), present_unit_middle_callback(), request_unit_select(), right_unit_release(), select_unit_image_callback(), select_unit_pic_callback(), set_client_state(), supported_unit_activate_close_callback(), supported_unit_activate_close_callback(), supported_unit_middle_callback(), unit_activate_callback(), unit_activate_callback(), unit_focus_advance(), unit_focus_set_and_select(), unit_select_callback(), units_orders_city_dlg_callback(), and usdlg_cmd_focus_real().

## ◆ unit_focus_set_and_select()

void unit_focus_set_and_select | ( | struct unit * | punit | ) |

The only difference is that here we draw the "cross".

Definition at line 621 of file control.c.

Referenced by do_map_click(), units_report_command_callback(), and unittype_item::wheelEvent().

## ◆ unit_focus_update()

void unit_focus_update | ( | void |  | ) |

If there is no unit currently in focus, or if the current unit in focus should not be in focus, then get a new focus unit. We let GOTO-ing units stay in focus, so that if they have moves left at the end of the goto, then they are still in focus.

Definition at line 772 of file control.c.

Referenced by handle_game_info(), handle_new_year(), handle_unit_packet_common(), real_set_client_page(), set_client_state(), and usdlg_cmd_exec().

## ◆ unit_focus_urgent()

void unit_focus_urgent | ( | struct unit * | punit | ) |

Store a priority focus unit.

Definition at line 207 of file control.c.

Referenced by action_decision_request(), and handle_unit_packet_common().

## ◆ unit_is_in_focus()

bool unit_is_in_focus | ( | const struct unit * | punit | ) |

Return TRUE iff this unit is in focus.

Definition at line 384 of file control.c.

Referenced by action_decision_request(), do_move_unit(), fill_sprite_array(), find_best_focus_candidate(), get_drawable_unit(), goto_map_unit(), handle_unit_packet_common(), key_unit_assign_battlegroup(), quickselect(), select_unit_image_callback(), select_unit_pic_callback(), set_units_in_combat(), unit_drawn_with_city_outline(), unit_focus_add(), unit_focus_remove(), usdlg_cmd_cursor_changed(), usdlg_cmd_exec_unit(), and usdlg_tab_append_units().

## ◆ unit_register_battlegroup()

void unit_register_battlegroup | ( | struct unit * | punit | ) |

Call this on new units to enter them in the battlegroup lists.

Definition at line 270 of file control.c.

Referenced by handle_unit_packet_common().

## ◆ update_unit_pix_label()

void update_unit_pix_label | ( | struct unit_list * | punitlist | ) |

Update unit icons (and arrow) in the information display, for specified punit as the active unit and other units on the same square. In practice punit is almost always (or maybe strictly always?) the focus unit.

Static vars store some info on current (ie previous) state, to avoid unnecessary redraws; initialise to "flag" values to always redraw first time. In principle we might need more info (eg ai.control, connecting), but in practice this is enough?

Used to store unit_ids for below units, to use for callbacks (now done inside gui-dep set_unit_icon()), but even with ids here they would not be enough information to know whether to redraw – instead redraw every time. (Could store enough info to know, but is it worth it?)

Definition at line 966 of file control.c.

Referenced by client_remove_unit(), reset_unit_table(), and update_unit_info_label().

## ◆ wakeup_sentried_units()

void wakeup_sentried_units | ( | struct tile * | ptile | ) |

Wakes all owned sentried units on tile.

Definition at line 1552 of file control.c.

Referenced by request_unit_wakeup(), and wakeup_button_pressed().

## Variable Documentation

## ◆ action_selection_in_progress_for

int action_selection_in_progress_for = IDENTITY_NUMBER_ZERO

static

Definition at line 119 of file control.c.

Referenced by action_selection_no_longer_in_progress(), ask_server_for_actions(), and can_ask_server_for_actions().

## ◆ battlegroups

struct unit_list* battlegroups[MAX_NUM_BATTLEGROUPS]

static

Definition at line 99 of file control.c.

Referenced by control_free(), control_init(), control_unit_killed(), key_unit_assign_battlegroup(), key_unit_select_battlegroup(), unit_change_battlegroup(), and unit_register_battlegroup().

## ◆ connect_activity

enum unit_activity connect_activity

Definition at line 90 of file control.c.

Referenced by do_map_click(), get_activity_time(), get_connect_road(), goto_fill_parameter_full(), key_cancel_action(), key_unit_action_select_tgt(), overview_update_line(), request_unit_connect(), set_hover_state(), and update_line().

## ◆ connect_tgt

struct extra_type* connect_tgt

Definition at line 91 of file control.c.

Referenced by do_map_click(), get_activity_time(), get_connect_road(), key_cancel_action(), key_unit_action_select_tgt(), overview_update_line(), request_unit_connect(), set_hover_state(), and update_line().

## ◆ current_focus

struct unit_list* current_focus = NULL

static

Definition at line 79 of file control.c.

Referenced by control_free(), control_init(), current_focus_append(), current_focus_remove(), get_num_units_in_focus(), get_units_in_focus(), head_of_units_in_focus(), and unit_focus_set().

## ◆ disband_unit_alternatives

int disband_unit_alternatives[3]

static

Initial value:
= {
ACTION_DISBAND_UNIT,
ACTION_DISBAND_UNIT_RECOVER,
ACTION_HELP_WONDER,
}

Definition at line 69 of file control.c.

Referenced by do_disband_alternative().

## ◆ goto_last_action

action_id goto_last_action

Definition at line 93 of file control.c.

Referenced by control_mouse_cursor(), do_map_click(), goto_fill_parameter_full(), key_cancel_action(), key_unit_action_select_tgt(), overview_update_line(), send_goto_route(), set_hover_state(), and update_line().

## ◆ goto_last_order

enum unit_orders goto_last_order

Definition at line 96 of file control.c.

Referenced by key_cancel_action(), key_unit_action_select_tgt(), overview_update_line(), send_goto_route(), set_hover_state(), and update_line().

## ◆ goto_last_sub_tgt

int goto_last_sub_tgt

Definition at line 95 of file control.c.

Referenced by key_cancel_action(), key_unit_action_select_tgt(), overview_update_line(), send_goto_route(), set_hover_state(), and update_line().

## ◆ goto_last_tgt

int goto_last_tgt

Definition at line 94 of file control.c.

Referenced by key_cancel_action(), key_unit_action_select_tgt(), send_goto_route(), and set_hover_state().

## ◆ hover_state

enum cursor_hover_state hover_state = HOVER_NONE

Definition at line 89 of file control.c.

Referenced by base_set_mapview_origin(), butt_down_mapcanvas(), butt_release_mapcanvas(), control_mouse_cursor(), do_map_click(), do_move_unit(), do_unit_goto(), get_activity_time(), get_unit_info_label_text2(), goto_fill_parameter_full(), goto_get_turns(), goto_map_free(), goto_tile_state(), key_cancel_action(), key_unit_action_select_tgt(), mouse_scroll_mapcanvas(), mouse_scroll_mapcanvas(), map_view::mouseMoveEvent(), move_mapcanvas(), move_mapcanvas(), overview_update_line(), release_goto_button(), request_unit_connect(), request_unit_goto(), request_unit_patrol(), right_butt_down_mapcanvas(), right_butt_up_mapcanvas(), set_hover_state(), mr_menu::slot_delayed_goto(), unit_focus_add(), unit_focus_remove(), update_last_part(), and update_line().

## ◆ hover_tile

struct tile* hover_tile = NULL

static

Definition at line 98 of file control.c.

Referenced by control_init(), and control_mouse_cursor().

## ◆ non_ai_unit_focus

bool non_ai_unit_focus

Definition at line 125 of file control.c.

Referenced by handle_start_phase(), and unit_focus_advance().

## ◆ num_units_below

int num_units_below = MAX_NUM_UNITS_BELOW

Definition at line 76 of file control.c.

Referenced by free_unit_table(), populate_unit_image_table(), populate_unit_pic_table(), set_unit_icon(), and update_unit_pix_label().

## ◆ previous_focus

struct unit_list* previous_focus = NULL

static

Definition at line 83 of file control.c.

Referenced by control_free(), control_init(), control_unit_killed(), key_recall_previous_focus_unit(), and store_previous_focus().

## ◆ punit_attacking

struct unit* punit_attacking = NULL

static

Definition at line 105 of file control.c.

Referenced by find_visible_unit(), and set_units_in_combat().

## ◆ punit_defending

struct unit* punit_defending = NULL

static

Definition at line 106 of file control.c.

Referenced by find_visible_unit(), and set_units_in_combat().

## ◆ punit_moving

struct unit* punit_moving = NULL

static

Definition at line 102 of file control.c.

Referenced by do_move_unit(), and find_visible_unit().

## ◆ urgent_focus_queue

struct unit_list* urgent_focus_queue = NULL

static

Definition at line 86 of file control.c.

Referenced by control_free(), control_init(), control_unit_killed(), unit_focus_advance(), and unit_focus_urgent().