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 ***********************************************************************/
22 #include <fc_config.h>
39 /** used for indicating menu about current option - for renaming
40 * and enabling, disabling */
89 /**************************************************************************
90 Struct holding rally point for city
91 **************************************************************************/
98 /**************************************************************************
99 Class holding city list for rally points
100 **************************************************************************/
108 void add(qfc_rally
* rally
);
109 bool clear(struct city
*rcity
);
110 QList
<qfc_rally
*> rally_list
;
114 struct city
*rally_city
;
117 void multiairlift(struct city
*acity
, Unit_type_id ut
);
119 /**************************************************************************
120 Class representing one unit for delayed goto
121 **************************************************************************/
122 class qfc_delayed_unit_item
125 qfc_delayed_unit_item(delay_order dg
, int i
) {
135 /**************************************************************************
136 Class holding unit list for delayed goto
137 **************************************************************************/
142 void add(qfc_delayed_unit_item
* fui
);
144 QList
<qfc_delayed_unit_item
*> unit_list
;
148 /**************************************************************************
149 Helper item for trade calculation
150 ***************************************************************************/
154 trade_city(struct city
*pcity
);
159 int trade_num
; // already created + generated
160 QList
<struct city
*> curr_tr_cities
;
161 QList
<struct city
*> new_tr_cities
;
162 QList
<struct city
*> pos_cities
;
168 /**************************************************************************
169 Struct of 2 tiles, used for drawing trade routes.
170 Also assigned caravan if it was sent
171 ***************************************************************************/
176 struct unit
*autocaravan
;
178 bool operator==(const qtiles
& a
) const
180 return (t1
== a
.t1
&& t2
== a
.t2
&& autocaravan
== a
.autocaravan
);
184 /**************************************************************************
185 Class trade generator, used for calulating possible trade routes
186 ***************************************************************************/
187 class trade_generator
194 QList
<struct city
*> virtual_cities
;
195 QList
<trade_city
*> cities
;
197 void add_all_cities();
198 void add_city(struct city
*pcity
);
199 void add_tile(struct tile
*ptile
);
201 void clear_trade_planing();
202 void remove_city(struct city
*pcity
);
203 void remove_virtual_city(struct tile
*ptile
);
206 bool discard_any(trade_city
*tc
, int freeroutes
);
207 bool discard_one(trade_city
*tc
);
208 int find_over_max(struct city
*pcity
);
209 trade_city
* find_most_free();
210 void check_if_done(trade_city
*tc1
, trade_city
*tc2
);
212 void discard_trade(trade_city
*tc1
, trade_city
*tc2
);
213 void find_certain_routes();
217 /****************************************************************************
218 Instantiable government menu.
219 ****************************************************************************/
220 class gov_menu
: public QMenu
223 static QSet
<gov_menu
*> instances
;
225 QSignalMapper
*gov_mapper
;
226 QVector
<QAction
*> actions
;
229 gov_menu(QWidget
* parent
= 0);
232 static void create_all();
233 static void update_all();
237 void change_gov(int target_gov
);
243 /**************************************************************************
244 Class representing global menus in gameview
245 **************************************************************************/
246 class mr_menu
: public QMenuBar
251 QMenu
*multiplayer_menu
;
252 QActionGroup
*airlift_type
;
253 QActionGroup
*action_vs_city
;
254 QActionGroup
*action_vs_unit
;
255 QMenu
*action_unit_menu
;
256 QMenu
*action_city_menu
;
257 QHash
<munit
, QAction
*> menu_list
;
258 qfc_units_list units_list
;
262 void menus_sensitive();
263 void update_airlift_menu();
264 void set_tile_for_order(struct tile
*ptile
);
265 void execute_shortcut(int sid
);
266 QString
shortcut_2_menustring(int sid
);
267 QAction
*minimap_status
;
268 QAction
*lock_status
;
270 QAction
*chat_status
;
271 QAction
*messages_status
;
273 bool quick_airlifting
;
274 Unit_type_id airlift_type_id
;
277 void local_options();
278 void shortcut_options();
279 void server_options();
280 void messages_options();
281 void save_options_now();
288 void slot_help(const QString
&topic
);
290 /*used by work menu*/
291 void slot_build_city();
292 void slot_go_build_city();
293 void slot_auto_settler();
294 void slot_build_road();
295 void slot_build_irrigation();
296 void slot_build_mine();
297 void slot_conn_road();
298 void slot_conn_rail();
299 void slot_conn_irrigation();
300 void slot_transform();
301 void slot_clean_pollution();
302 void slot_clean_fallout();
304 /*used by unit menu */
305 void slot_unit_sentry();
306 void slot_unit_explore();
307 void slot_unit_goto();
309 void slot_return_to_city();
311 void slot_unsentry();
314 void slot_unload_all();
315 void slot_set_home();
320 /*used by combat menu*/
321 void slot_unit_fortify();
322 void slot_unit_fortress();
323 void slot_unit_airbase();
326 void slot_explode_nuclear();
328 /*used by view menu*/
329 void slot_center_view();
330 void slot_minimap_view();
331 void slot_show_new_turn_text();
332 void slot_fullscreen();
334 void slot_city_outlines();
335 void slot_city_output();
336 void slot_map_grid();
339 void slot_native_tiles();
340 void slot_city_growth();
341 void slot_city_production();
342 void slot_city_buycost();
343 void slot_city_traderoutes();
344 void slot_city_names();
346 /*used by select menu */
347 void slot_select_one();
348 void slot_select_all_tile();
349 void slot_select_same_tile();
350 void slot_select_same_continent();
351 void slot_select_same_everywhere();
352 void slot_done_moving();
354 void slot_unit_filter();
356 /* used by multiplayer menu */
357 void slot_orders_clear();
358 void slot_execute_orders();
359 void slot_delayed_goto();
360 void slot_trade_add_all();
361 void slot_trade_city();
362 void slot_calculate();
363 void slot_clear_trade();
364 void slot_autocaravan();
366 void slot_quickairlift_set();
367 void slot_quickairlift();
368 void slot_action_vs_unit();
369 void slot_action_vs_city();
371 /*used by civilization menu */
372 void slot_show_map();
373 void calc_trade_routes();
374 void slot_popup_tax_rates();
375 void slot_popup_mult_rates();
376 void slot_show_eco_report();
377 void slot_show_units_report();
378 void slot_show_nations();
379 void slot_show_cities();
380 void slot_show_research_tab();
381 void slot_spaceship();
382 void slot_demographics();
383 void slot_achievements();
385 void slot_top_five();
386 void slot_traveler();
389 struct tile
* find_last_unit_pos(struct unit
* punit
, int pos
);
390 QSignalMapper
*signal_help_mapper
;
393 #endif /* FC__MENU_H */