1 /**********************************************************************
2 Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the GNU General Public License as published by
5 the Free Software Foundation; either version 2, or (at your option)
8 This program is distributed in the hope that it will be useful,
9 but WITHOUT ANY WARRANTY; without even the implied warranty of
10 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 GNU General Public License for more details.
12 ***********************************************************************/
18 #endif /* __cplusplus */
23 enum cursor_hover_state
{
32 /* Selecting unit from a stack without popup. */
33 enum quickselect_type
{
34 SELECT_POPUP
= 0, SELECT_SEA
, SELECT_LAND
, SELECT_APPEND
37 void control_init(void);
38 void control_free(void);
39 void control_unit_killed(struct unit
*punit
);
41 void unit_change_battlegroup(struct unit
*punit
, int battlegroup
);
42 void unit_register_battlegroup(struct unit
*punit
);
44 extern enum cursor_hover_state hover_state
;
45 extern enum unit_activity connect_activity
;
46 extern struct act_tgt connect_tgt
;
47 extern enum unit_orders goto_last_order
;
48 extern bool non_ai_unit_focus
;
50 bool can_unit_do_connect(struct unit
*punit
,
51 enum unit_activity activity
,
54 void do_move_unit(struct unit
*punit
, struct unit
*target_unit
);
55 void do_unit_goto(struct tile
*ptile
);
56 void do_unit_nuke(struct unit
*punit
);
57 void do_unit_paradrop_to(struct unit
*punit
, struct tile
*ptile
);
58 void do_unit_patrol_to(struct tile
*ptile
);
59 void do_unit_connect(struct tile
*ptile
,
60 enum unit_activity activity
,
62 void do_map_click(struct tile
*ptile
, enum quickselect_type qtype
);
63 void control_mouse_cursor(struct tile
*ptile
);
65 void set_hover_state(struct unit_list
*punits
, enum cursor_hover_state state
,
66 enum unit_activity connect_activity
,
68 enum unit_orders goto_last_order
);
69 void request_center_focus_unit(void);
70 void request_move_unit_direction(struct unit
*punit
, int dir
);
71 void request_new_unit_activity(struct unit
*punit
, enum unit_activity act
);
72 void request_new_unit_activity_targeted(struct unit
*punit
,
73 enum unit_activity act
,
75 void request_new_unit_activity_base(struct unit
*punit
,
76 const struct base_type
*pbase
);
77 void request_new_unit_activity_road(struct unit
*punit
,
78 const struct road_type
*proad
);
79 void request_unit_load(struct unit
*pcargo
, struct unit
*ptransporter
);
80 void request_unit_unload(struct unit
*pcargo
);
81 void request_unit_autosettlers(const struct unit
*punit
);
82 void request_unit_build_city(struct unit
*punit
);
83 void request_unit_caravan_action(struct unit
*punit
, enum packet_type action
);
84 void request_unit_change_homecity(struct unit
*punit
);
85 void request_unit_connect(enum unit_activity activity
,
87 void request_unit_disband(struct unit
*punit
);
88 void request_unit_fortify(struct unit
*punit
);
89 void request_unit_goto(enum unit_orders last_order
);
90 void request_unit_move_done(void);
91 void request_unit_nuke(struct unit_list
*punits
);
92 void request_unit_paradrop(struct unit_list
*punits
);
93 void request_unit_patrol(void);
94 void request_unit_pillage(struct unit
*punit
);
95 void request_unit_sentry(struct unit
*punit
);
96 struct unit
*request_unit_unload_all(struct unit
*punit
);
97 void request_unit_airlift(struct unit
*punit
, struct city
*pcity
);
98 void request_unit_return(struct unit
*punit
);
99 void request_unit_upgrade(struct unit
*punit
);
100 void request_unit_convert(struct unit
*punit
);
101 void request_units_wait(struct unit_list
*punits
);
102 void request_unit_wakeup(struct unit
*punit
);
104 #define SPECENUM_NAME unit_select_type_mode
105 #define SPECENUM_VALUE0 SELTYPE_SINGLE
106 #define SPECENUM_VALUE1 SELTYPE_SAME
107 #define SPECENUM_VALUE2 SELTYPE_ALL
108 #include "specenum_gen.h"
110 #define SPECENUM_NAME unit_select_location_mode
111 #define SPECENUM_VALUE0 SELLOC_UNITS /* Units on tile. */
112 #define SPECENUM_VALUE1 SELLOC_TILE /* Tile. */
113 #define SPECENUM_VALUE2 SELLOC_CONT /* Continent. */
114 #define SPECENUM_VALUE3 SELLOC_LAND /* Move type: land. */
115 #define SPECENUM_VALUE4 SELLOC_SEA /* Move type: sea. */
116 #define SPECENUM_VALUE5 SELLOC_BOTH /* Move type: both. */
117 #define SPECENUM_VALUE6 SELLOC_WORLD /* World. */
118 #define SPECENUM_COUNT SELLOC_COUNT
119 #include "specenum_gen.h"
121 void request_unit_select(struct unit_list
*punits
,
122 enum unit_select_type_mode seltype
,
123 enum unit_select_location_mode selloc
);
125 void request_diplomat_action(enum diplomat_actions action
, int dipl_id
,
126 int target_id
, int value
);
127 void request_diplomat_answer(enum diplomat_actions action
, int dipl_id
,
128 int target_id
, int value
);
129 void request_toggle_city_outlines(void);
130 void request_toggle_city_output(void);
131 void request_toggle_map_grid(void);
132 void request_toggle_map_borders(void);
133 void request_toggle_map_native(void);
134 void request_toggle_city_full_bar(void);
135 void request_toggle_city_names(void);
136 void request_toggle_city_growth(void);
137 void request_toggle_city_productions(void);
138 void request_toggle_city_buycost(void);
139 void request_toggle_city_trade_routes(void);
140 void request_toggle_terrain(void);
141 void request_toggle_coastline(void);
142 void request_toggle_roads_rails(void);
143 void request_toggle_irrigation(void);
144 void request_toggle_mines(void);
145 void request_toggle_bases(void);
146 void request_toggle_specials(void);
147 void request_toggle_pollution(void);
148 void request_toggle_cities(void);
149 void request_toggle_units(void);
150 void request_toggle_unit_solid_bg(void);
151 void request_toggle_unit_shields(void);
152 void request_toggle_focus_unit(void);
153 void request_toggle_fog_of_war(void);
155 void wakeup_sentried_units(struct tile
*ptile
);
156 void clear_unit_orders(struct unit
*punit
);
158 bool unit_is_in_focus(const struct unit
*punit
);
159 struct unit
*get_focus_unit_on_tile(const struct tile
*ptile
);
160 struct unit
*head_of_units_in_focus(void);
161 struct unit_list
*get_units_in_focus(void);
162 int get_num_units_in_focus(void);
164 void unit_focus_set(struct unit
*punit
);
165 void unit_focus_set_and_select(struct unit
*punit
);
166 void unit_focus_add(struct unit
*punit
);
167 void unit_focus_remove(struct unit
*punit
);
168 void unit_focus_urgent(struct unit
*punit
);
170 void unit_focus_advance(void);
171 void unit_focus_update(void);
173 void auto_center_on_focus_unit(void);
174 void update_unit_pix_label(struct unit_list
*punitlist
);
176 struct unit
*find_visible_unit(struct tile
*ptile
);
177 void set_units_in_combat(struct unit
*pattacker
, struct unit
*pdefender
);
178 double blink_active_unit(void);
179 double blink_turn_done_button(void);
181 void process_caravan_arrival(struct unit
*punit
);
182 void process_diplomat_arrival(struct unit
*pdiplomat
, int victim_id
);
184 void key_cancel_action(void);
185 void key_center_capital(void);
186 void key_city_full_bar_toggle(void);
187 void key_city_names_toggle(void);
188 void key_city_growth_toggle(void);
189 void key_city_productions_toggle(void);
190 void key_city_buycost_toggle(void);
191 void key_city_trade_routes_toggle(void);
192 void key_terrain_toggle(void);
193 void key_coastline_toggle(void);
194 void key_roads_rails_toggle(void);
195 void key_irrigation_toggle(void);
196 void key_mines_toggle(void);
197 void key_bases_toggle(void);
198 void key_specials_toggle(void);
199 void key_pollution_toggle(void);
200 void key_cities_toggle(void);
201 void key_units_toggle(void);
202 void key_unit_solid_bg_toggle(void);
203 void key_unit_shields_toggle(void);
204 void key_focus_unit_toggle(void);
205 void key_fog_of_war_toggle(void);
206 void key_end_turn(void);
207 void key_city_outlines_toggle(void);
208 void key_city_output_toggle(void);
209 void key_map_grid_toggle(void);
210 void key_map_borders_toggle(void);
211 void key_map_native_toggle(void);
212 void key_recall_previous_focus_unit(void);
213 void key_unit_move(enum direction8 gui_dir
);
214 void key_unit_airbase(void);
215 void key_unit_auto_explore(void);
216 void key_unit_auto_settle(void);
217 void key_unit_build_city(void);
218 void key_unit_build_wonder(void);
219 void key_unit_connect(enum unit_activity activity
,
220 struct act_tgt
*tgt
);
221 void key_unit_diplomat_actions(void);
222 void key_unit_convert(void);
223 void key_unit_done(void);
224 void key_unit_fallout(void);
225 void key_unit_fortify(void);
226 void key_unit_fortress(void);
227 void key_unit_goto(void);
228 void key_unit_homecity(void);
229 void key_unit_irrigate(void);
230 void key_unit_mine(void);
231 void key_unit_nuke(void);
232 void key_unit_patrol(void);
233 void key_unit_paradrop(void);
234 void key_unit_pillage(void);
235 void key_unit_pollution(void);
236 void key_unit_road(void);
237 void key_unit_sentry(void);
238 void key_unit_trade_route(void);
239 void key_unit_transform(void);
240 void key_unit_unload_all(void);
241 void key_unit_wait(void);
242 void key_unit_wakeup_others(void);
243 void key_unit_assign_battlegroup(int battlegroup
, bool append
);
244 void key_unit_select_battlegroup(int battlegroup
, bool append
);
246 void key_editor_toggle(void);
247 void key_editor_recalculate_borders(void);
248 void key_editor_toggle_fogofwar(void);
250 void finish_city(struct tile
*ptile
, const char *name
);
251 void cancel_city(struct tile
*ptile
);
253 /* don't change this unless you also put more entries in data/Freeciv */
254 #define MAX_NUM_UNITS_BELOW 4
256 extern int num_units_below
;
260 #endif /* __cplusplus */
262 #endif /* FC__CONTROL_H */