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 int check_recursive_road_connect(struct tile
*ptile
, const struct road_type
*proad
,
55 const struct unit
*punit
, const struct player
*pplayer
, int rec
);
57 void do_move_unit(struct unit
*punit
, struct unit
*target_unit
);
58 void do_unit_goto(struct tile
*ptile
);
59 void do_unit_nuke(struct unit
*punit
);
60 void do_unit_paradrop_to(struct unit
*punit
, struct tile
*ptile
);
61 void do_unit_patrol_to(struct tile
*ptile
);
62 void do_unit_connect(struct tile
*ptile
,
63 enum unit_activity activity
,
65 void do_map_click(struct tile
*ptile
, enum quickselect_type qtype
);
66 void control_mouse_cursor(struct tile
*ptile
);
68 void set_hover_state(struct unit_list
*punits
, enum cursor_hover_state state
,
69 enum unit_activity connect_activity
,
71 enum unit_orders goto_last_order
);
72 void request_center_focus_unit(void);
73 void request_move_unit_direction(struct unit
*punit
, int dir
);
74 void request_new_unit_activity(struct unit
*punit
, enum unit_activity act
);
75 void request_new_unit_activity_targeted(struct unit
*punit
,
76 enum unit_activity act
,
78 void request_new_unit_activity_base(struct unit
*punit
,
79 const struct base_type
*pbase
);
80 void request_new_unit_activity_road(struct unit
*punit
,
81 const struct road_type
*proad
);
82 void request_unit_load(struct unit
*pcargo
, struct unit
*ptransporter
);
83 void request_unit_unload(struct unit
*pcargo
);
84 void request_unit_autosettlers(const struct unit
*punit
);
85 void request_unit_build_city(struct unit
*punit
);
86 void request_unit_caravan_action(struct unit
*punit
, enum packet_type action
);
87 void request_unit_change_homecity(struct unit
*punit
);
88 void request_unit_connect(enum unit_activity activity
,
90 void request_unit_disband(struct unit
*punit
);
91 void request_unit_fortify(struct unit
*punit
);
92 void request_unit_goto(enum unit_orders last_order
);
93 void request_unit_move_done(void);
94 void request_unit_nuke(struct unit_list
*punits
);
95 void request_unit_paradrop(struct unit_list
*punits
);
96 void request_unit_patrol(void);
97 void request_unit_pillage(struct unit
*punit
);
98 void request_unit_sentry(struct unit
*punit
);
99 struct unit
*request_unit_unload_all(struct unit
*punit
);
100 void request_unit_airlift(struct unit
*punit
, struct city
*pcity
);
101 void request_unit_return(struct unit
*punit
);
102 void request_unit_upgrade(struct unit
*punit
);
103 void request_unit_convert(struct unit
*punit
);
104 void request_units_wait(struct unit_list
*punits
);
105 void request_unit_wakeup(struct unit
*punit
);
107 #define SPECENUM_NAME unit_select_type_mode
108 #define SPECENUM_VALUE0 SELTYPE_SINGLE
109 #define SPECENUM_VALUE1 SELTYPE_SAME
110 #define SPECENUM_VALUE2 SELTYPE_ALL
111 #include "specenum_gen.h"
113 #define SPECENUM_NAME unit_select_location_mode
114 #define SPECENUM_VALUE0 SELLOC_UNITS /* Units on tile. */
115 #define SPECENUM_VALUE1 SELLOC_TILE /* Tile. */
116 #define SPECENUM_VALUE2 SELLOC_CONT /* Continent. */
117 #define SPECENUM_VALUE3 SELLOC_LAND /* Move type: land. */
118 #define SPECENUM_VALUE4 SELLOC_SEA /* Move type: sea. */
119 #define SPECENUM_VALUE5 SELLOC_BOTH /* Move type: both. */
120 #define SPECENUM_VALUE6 SELLOC_WORLD /* World. */
121 #define SPECENUM_COUNT SELLOC_COUNT
122 #include "specenum_gen.h"
124 void request_unit_select(struct unit_list
*punits
,
125 enum unit_select_type_mode seltype
,
126 enum unit_select_location_mode selloc
);
128 void request_diplomat_action(enum diplomat_actions action
, int dipl_id
,
129 int target_id
, int value
);
130 void request_diplomat_answer(enum diplomat_actions action
, int dipl_id
,
131 int target_id
, int value
);
132 void request_toggle_city_outlines(void);
133 void request_toggle_city_output(void);
134 void request_toggle_map_grid(void);
135 void request_toggle_map_borders(void);
136 void request_toggle_map_native(void);
137 void request_toggle_city_full_bar(void);
138 void request_toggle_city_names(void);
139 void request_toggle_city_growth(void);
140 void request_toggle_city_productions(void);
141 void request_toggle_city_buycost(void);
142 void request_toggle_city_trade_routes(void);
143 void request_toggle_terrain(void);
144 void request_toggle_coastline(void);
145 void request_toggle_roads_rails(void);
146 void request_toggle_irrigation(void);
147 void request_toggle_mines(void);
148 void request_toggle_bases(void);
149 void request_toggle_specials(void);
150 void request_toggle_pollution(void);
151 void request_toggle_cities(void);
152 void request_toggle_units(void);
153 void request_toggle_unit_solid_bg(void);
154 void request_toggle_unit_shields(void);
155 void request_toggle_focus_unit(void);
156 void request_toggle_fog_of_war(void);
158 void wakeup_sentried_units(struct tile
*ptile
);
159 void clear_unit_orders(struct unit
*punit
);
161 bool unit_is_in_focus(const struct unit
*punit
);
162 struct unit
*get_focus_unit_on_tile(const struct tile
*ptile
);
163 struct unit
*head_of_units_in_focus(void);
164 struct unit_list
*get_units_in_focus(void);
165 int get_num_units_in_focus(void);
167 void unit_focus_set(struct unit
*punit
);
168 void unit_focus_set_and_select(struct unit
*punit
);
169 void unit_focus_add(struct unit
*punit
);
170 void unit_focus_remove(struct unit
*punit
);
171 void unit_focus_urgent(struct unit
*punit
);
173 void unit_focus_advance(void);
174 void unit_focus_update(void);
176 void auto_center_on_focus_unit(void);
177 void update_unit_pix_label(struct unit_list
*punitlist
);
179 struct unit
*find_visible_unit(struct tile
*ptile
);
180 void set_units_in_combat(struct unit
*pattacker
, struct unit
*pdefender
);
181 double blink_active_unit(void);
182 double blink_turn_done_button(void);
184 void process_caravan_arrival(struct unit
*punit
);
185 void process_diplomat_arrival(struct unit
*pdiplomat
, int victim_id
);
187 void key_cancel_action(void);
188 void key_center_capital(void);
189 void key_city_full_bar_toggle(void);
190 void key_city_names_toggle(void);
191 void key_city_growth_toggle(void);
192 void key_city_productions_toggle(void);
193 void key_city_buycost_toggle(void);
194 void key_city_trade_routes_toggle(void);
195 void key_terrain_toggle(void);
196 void key_coastline_toggle(void);
197 void key_roads_rails_toggle(void);
198 void key_irrigation_toggle(void);
199 void key_mines_toggle(void);
200 void key_bases_toggle(void);
201 void key_specials_toggle(void);
202 void key_pollution_toggle(void);
203 void key_cities_toggle(void);
204 void key_units_toggle(void);
205 void key_unit_solid_bg_toggle(void);
206 void key_unit_shields_toggle(void);
207 void key_focus_unit_toggle(void);
208 void key_fog_of_war_toggle(void);
209 void key_end_turn(void);
210 void key_city_outlines_toggle(void);
211 void key_city_output_toggle(void);
212 void key_map_grid_toggle(void);
213 void key_map_borders_toggle(void);
214 void key_map_native_toggle(void);
215 void key_recall_previous_focus_unit(void);
216 void key_unit_move(enum direction8 gui_dir
);
217 void key_unit_airbase(void);
218 void key_unit_auto_explore(void);
219 void key_unit_auto_settle(void);
220 void key_unit_build_city(void);
221 void key_unit_build_wonder(void);
222 void key_unit_connect(enum unit_activity activity
,
223 struct act_tgt
*tgt
);
224 void key_unit_diplomat_actions(void);
225 void key_unit_convert(void);
226 void key_unit_done(void);
227 void key_unit_fallout(void);
228 void key_unit_fortify(void);
229 void key_unit_fortress(void);
230 void key_unit_goto(void);
231 void key_unit_homecity(void);
232 void key_unit_irrigate(void);
233 void key_unit_mine(void);
234 void key_unit_nuke(void);
235 void key_unit_patrol(void);
236 void key_unit_paradrop(void);
237 void key_unit_pillage(void);
238 void key_unit_pollution(void);
239 void key_unit_road(void);
240 void key_unit_sentry(void);
241 void key_unit_trade_route(void);
242 void key_unit_transform(void);
243 void key_unit_unload_all(void);
244 void key_unit_wait(void);
245 void key_unit_wakeup_others(void);
246 void key_unit_assign_battlegroup(int battlegroup
, bool append
);
247 void key_unit_select_battlegroup(int battlegroup
, bool append
);
249 void key_editor_toggle(void);
250 void key_editor_recalculate_borders(void);
251 void key_editor_toggle_fogofwar(void);
253 void finish_city(struct tile
*ptile
, const char *name
);
254 void cancel_city(struct tile
*ptile
);
256 /* don't change this unless you also put more entries in data/Freeciv */
257 #define MAX_NUM_UNITS_BELOW 4
259 extern int num_units_below
;
263 #endif /* __cplusplus */
265 #endif /* FC__CONTROL_H */