Freeciv-3.3
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 do_unit_teleport_to (struct unit *punit, struct tile *ptile)
 
static struct unitquickselect (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 unitget_focus_unit_on_tile (const struct tile *ptile)
 
struct unithead_of_units_in_focus (void)
 
static struct tilefind_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 unitfind_best_focus_candidate (bool accept_current)
 
void unit_focus_advance (bool accept_current)
 
void unit_focus_update (void)
 
struct unitfind_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 unitrequest_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)
 
static bool action_requires_confirmation (action_id act, char *buf, size_t bufsize)
 
void request_do_action (action_id action, int actor_id, int target_id, int sub_tgt, const char *name)
 
void action_confirmation (struct act_confirmation_data *data, bool confirm)
 
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_autoworker (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)
 
static void request_unit_teleport (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_paths (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_teleport (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_work (void)
 
void key_unit_convert (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_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_paths_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_typeconnect_tgt
 
action_id goto_last_action
 
int goto_last_tgt
 
int goto_last_sub_tgt
 
enum unit_orders goto_last_order
 
static struct tilehover_tile = NULL
 
static struct unit_list * battlegroups [MAX_NUM_BATTLEGROUPS]
 
static struct unitpunit_moving = NULL
 
static struct unitpunit_attacking = NULL
 
static struct unitpunit_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 1610 of file control.c.

◆ SPECHASH_IDATA_TYPE [2/2]

#define SPECHASH_IDATA_TYPE   void *

Definition at line 1610 of file control.c.

◆ SPECHASH_IKEY_TYPE

#define SPECHASH_IKEY_TYPE   struct unit_type *

Definition at line 1609 of file control.c.

◆ SPECHASH_INT_KEY_TYPE

#define SPECHASH_INT_KEY_TYPE

Definition at line 1614 of file control.c.

◆ SPECHASH_TAG [1/2]

#define SPECHASH_TAG   unit_type

Definition at line 1608 of file control.c.

◆ SPECHASH_TAG [2/2]

#define SPECHASH_TAG   continent

Definition at line 1608 of file control.c.

Function Documentation

◆ action_confirmation()

void action_confirmation ( struct act_confirmation_data data,
bool  confirm 
)

GUI (likely user) either confirmed the action, or not. Even if not, we have to free the data.

Definition at line 1766 of file control.c.

Referenced by act_conf_response(), gui_request_action_confirmation(), popup_act_confirmation_dialog(), and request_action_confirmation().

◆ 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 1080 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 1110 of file control.c.

Referenced by action_decision_handle(), and action_decision_maybe_auto().

◆ action_requires_confirmation()

static bool action_requires_confirmation ( action_id  act,
char buf,
size_t  bufsize 
)
static

Return whether user should confirm the action. Buffer gets filled with explanation of the situation.

Definition at line 1699 of file control.c.

Referenced by request_do_action().

◆ 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 1092 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 1051 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 366 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 434 of file control.c.

Referenced by handle_new_year(), popup_action_selection(), popup_bribe_stack_dialog(), popup_bribe_unit_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 892 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 925 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 352 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 worker type unit of any player can irrigate.

Definition at line 1392 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 1415 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 1197 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 4110 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 1337 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_unit_orders()

void clear_unit_orders ( struct unit punit)

Clear all orders for the given unit.

Definition at line 481 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 1959 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 1215 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 447 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 467 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 1969 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 2909 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 2802 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 2894 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 3241 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 3124 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 3185 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 3225 of file control.c.

Referenced by do_map_click(), and patrol_here_callback().

◆ do_unit_teleport_to()

static void do_unit_teleport_to ( struct unit punit,
struct tile ptile 
)
static

Teleport to a location.

Definition at line 3146 of file control.c.

Referenced by do_map_click().

◆ 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 418 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 649 of file control.c.

Referenced by unit_focus_advance().

◆ find_visible_unit()

struct unit * find_visible_unit ( struct tile ptile)

◆ 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 4091 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)

◆ get_num_units_in_focus()

int get_num_units_in_focus ( void  )

◆ 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_callback(), clean_menu_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_work(), 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_homecity(), key_unit_move(), key_unit_paradrop(), key_unit_pillage(), key_unit_plant(), key_unit_road(), key_unit_sentry(), key_unit_teleport(), 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(), mr_menu::slot_deboard(), mr_menu::slot_delayed_goto(), mr_menu::slot_disband(), mr_menu::slot_paradrop(), 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  )

◆ 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 1321 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 3984 of file control.c.

Referenced by show_bases_callback(), and show_bases_callback().

◆ key_cancel_action()

void key_cancel_action ( void  )

◆ 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 3295 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 4016 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 3911 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 3885 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 3902 of file control.c.

Referenced by map_event_handler(), 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 3893 of file control.c.

Referenced by map_event_handler(), 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 3845 of file control.c.

Referenced by map_event_handler(), 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 3853 of file control.c.

Referenced by map_event_handler(), 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 3919 of file control.c.

Referenced by map_event_handler(), 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 3928 of file control.c.

Referenced by map_event_handler(), 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 3952 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 4072 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 4064 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 4081 of file control.c.

Referenced by toggle_fog_callback(), and toggle_fog_callback().

◆ key_end_turn()

void key_end_turn ( void  )

◆ key_focus_unit_toggle()

void key_focus_unit_toggle ( void  )

Handle user 'toggle key units display' input

Definition at line 4048 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 4056 of file control.c.

Referenced by map_event_handler(), 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 4000 of file control.c.

Referenced by map_event_handler(), 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 3968 of file control.c.

Referenced by map_event_handler(), 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 3869 of file control.c.

Referenced by map_event_handler(), 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 3861 of file control.c.

Referenced by map_event_handler(), 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 3877 of file control.c.

Referenced by map_event_handler(), 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 3976 of file control.c.

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

◆ key_paths_toggle()

void key_paths_toggle ( void  )

Handle user 'toggle paths display' input

Definition at line 3960 of file control.c.

Referenced by show_paths_callback(), and show_paths_callback().

◆ key_pollution_toggle()

void key_pollution_toggle ( void  )

Handle user 'toggle pollution display' input

Definition at line 4008 of file control.c.

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

◆ key_recall_previous_focus_unit()

void key_recall_previous_focus_unit ( void  )

◆ key_resources_toggle()

void key_resources_toggle ( void  )

Handle user 'toggle resources display' input

Definition at line 3992 of file control.c.

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

◆ key_terrain_toggle()

void key_terrain_toggle ( void  )

Handle user 'toggle terrain display' input

Definition at line 3944 of file control.c.

Referenced by map_event_handler(), 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 3384 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 3406 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 3560 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 
)

◆ key_unit_auto_explore()

void key_unit_auto_explore ( void  )

Handle user 'autoexplore' input

Definition at line 3577 of file control.c.

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

◆ key_unit_auto_work()

void key_unit_auto_work ( void  )

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

Definition at line 3590 of file control.c.

Referenced by auto_work_callback(), auto_work_callback(), and mr_menu::slot_auto_worker().

◆ key_unit_build_city()

void key_unit_build_city ( void  )

Handle use 'build city' input.

Definition at line 3353 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 3363 of file control.c.

Referenced by unit_order_callback().

◆ key_unit_clean()

void key_unit_clean ( void  )

Handle user 'clean' input

Definition at line 3720 of file control.c.

Referenced by clean_callback(), clean_nuisance_callback(), and unit_order_callback().

◆ key_unit_connect()

void key_unit_connect ( enum unit_activity  activity,
struct extra_type tgt 
)

◆ key_unit_convert()

void key_unit_convert ( void  )

Unit convert key pressed or respective menu entry selected.

Definition at line 3602 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 3676 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 3463 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 3651 of file control.c.

Referenced by key_unit_irrigate(), and key_unit_mine().

◆ key_unit_fortify()

void key_unit_fortify ( void  )

Handle user 'fortify' input

Definition at line 3612 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 3624 of file control.c.

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

◆ key_unit_goto()

void key_unit_goto ( void  )

◆ key_unit_homecity()

void key_unit_homecity ( void  )

Handle user 'change homecity' input

Definition at line 3641 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 3668 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 3688 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 3341 of file control.c.

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

◆ key_unit_paradrop()

void key_unit_paradrop ( void  )

Handle user 'paradrop' input

Definition at line 3479 of file control.c.

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

◆ key_unit_patrol()

void key_unit_patrol ( void  )

Handle user 'patrol' input

Definition at line 3487 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 3708 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 3696 of file control.c.

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

◆ key_unit_road()

void key_unit_road ( void  )

Handle user 'build road or railroad' input

Definition at line 3738 of file control.c.

Referenced by unit_order_callback().

◆ key_unit_select_battlegroup()

void key_unit_select_battlegroup ( int  battlegroup,
bool  append 
)

◆ key_unit_sentry()

void key_unit_sentry ( void  )

Handle user 'sentry' input

Definition at line 3756 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 4040 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 4032 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 3936 of file control.c.

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

◆ key_unit_teleport()

void key_unit_teleport ( void  )

Handle user 'teleport' input

Definition at line 3495 of file control.c.

Referenced by unit_teleport_callback().

◆ key_unit_trade_route()

void key_unit_trade_route ( void  )

Handle user 'establish trade route' input

Definition at line 3503 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 3768 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 3517 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  )

◆ key_unit_wakeup_others()

void key_unit_wakeup_others ( void  )

Handle user 'wakeup others' input

Definition at line 3550 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 4024 of file control.c.

Referenced by map_event_handler(), 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 3003 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 1798 of file control.c.

Referenced by diplomat_bribe_stack(), diplomat_bribe_stack_callback(), diplomat_bribe_unit(), diplomat_bribe_unit_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  )

◆ 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 1730 of file control.c.

Referenced by action_decision_maybe_auto(), airlift(), attack(), base(), bombard(), bombard2(), bombard3(), bombard_lethal(), bribe_stack_response(), bribe_unit_response(), capture_units(), caravan_establish_trade(), caravan_help_build(), caravan_marketplace(), clean(), conquer_city_shrink(), conquer_city_shrink2(), conquer_extras(), conquer_extras2(), convert_unit(), cultivate(), destroy_city(), diplomat_bribe_stack_yes_callback(), diplomat_bribe_unit_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(), do_unit_teleport_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_stack_dialog(), popup_bribe_unit_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_escape(), 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_board(), transport_board2(), transport_board3(), transport_deboard(), transport_embark(), transport_embark2(), transport_embark3(), transport_embark4(), transport_load(), transport_load2(), transport_load3(), transport_unload(), unit_disband_recover(), unit_home_city(), and wipe_units().

◆ 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 1879 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 
)

◆ request_new_unit_activity_targeted()

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

◆ request_toggle_bases()

void request_toggle_bases ( void  )

Toggle display of bases

Definition at line 2619 of file control.c.

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

◆ request_toggle_cities()

void request_toggle_cities ( void  )

Toggle display of cities

Definition at line 2671 of file control.c.

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

◆ request_toggle_city_buycost()

void request_toggle_city_buycost ( void  )

Toggle display of city buycost

Definition at line 2515 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 2463 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 2489 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 2476 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 2398 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 2411 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 2502 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 2528 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 2567 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 2723 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 2736 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 2645 of file control.c.

Referenced by key_huts_toggle().

◆ request_toggle_irrigation()

void request_toggle_irrigation ( void  )

Toggle display of irrigation

Definition at line 2593 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 2437 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 2424 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 2450 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 2606 of file control.c.

Referenced by key_mines_toggle().

◆ request_toggle_paths()

void request_toggle_paths ( void  )

Toggle display of paths

Definition at line 2580 of file control.c.

Referenced by key_paths_toggle().

◆ request_toggle_pollution()

void request_toggle_pollution ( void  )

Toggle display of pollution

Definition at line 2658 of file control.c.

Referenced by key_pollution_toggle().

◆ request_toggle_resources()

void request_toggle_resources ( void  )

Toggle display of resources

Definition at line 2632 of file control.c.

Referenced by key_resources_toggle().

◆ request_toggle_terrain()

void request_toggle_terrain ( void  )

Toggle display of terrain

Definition at line 2554 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 2710 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 2697 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 2541 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 2684 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 1543 of file control.c.

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

◆ request_unit_autoworker()

void request_unit_autoworker ( const struct unit punit)

Call to request (from the server) that the worker unit is put into autoworker mode.

Definition at line 2141 of file control.c.

Referenced by key_unit_auto_work(), 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 1817 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 2223 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 2094 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 1482 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 2118 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 2075 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)

◆ 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 1130 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 2156 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 2776 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 1836 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 2246 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 2319 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 2364 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 1552 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 
)

◆ request_unit_sentry()

void request_unit_sentry ( struct unit punit)

◆ 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 2128 of file control.c.

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

◆ request_unit_teleport()

static void request_unit_teleport ( struct unit_list *  punits)
static

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

Definition at line 2282 of file control.c.

Referenced by key_unit_teleport().

◆ 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 2194 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 1511 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 2106 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 1600 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 2763 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 290 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(), request_unit_teleport(), 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 1032 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 339 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 255 of file control.c.

Referenced by handle_unit_packet_common().

◆ unit_focus_add()

void unit_focus_add ( struct unit punit)

◆ unit_focus_advance()

void unit_focus_advance ( bool  accept_current)

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.

Parameters
accept_currentThe current focus can be kept if no other candidates

Definition at line 688 of file control.c.

Referenced by client_remove_unit(), control_unit_killed(), 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 591 of file control.c.

Referenced by usdlg_cmd_exec_unit().

◆ unit_focus_set()

void unit_focus_set ( struct unit punit)

◆ 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 636 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 789 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)

◆ 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 275 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 985 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 1583 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

◆ battlegroups

struct unit_list* battlegroups[MAX_NUM_BATTLEGROUPS]
static

◆ connect_activity

enum unit_activity connect_activity

◆ connect_tgt

struct extra_type* connect_tgt

◆ current_focus

struct unit_list* current_focus = NULL
static

◆ disband_unit_alternatives

int disband_unit_alternatives[3]
static
Initial value:

Definition at line 69 of file control.c.

Referenced by do_disband_alternative().

◆ goto_last_action

action_id goto_last_action

◆ goto_last_order

enum unit_orders goto_last_order

◆ goto_last_sub_tgt

int goto_last_sub_tgt

◆ goto_last_tgt

int goto_last_tgt

◆ hover_state

◆ 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

◆ previous_focus

struct unit_list* previous_focus = NULL
static

◆ 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