Freeciv-3.3
Loading...
Searching...
No Matches
menu.cpp
Go to the documentation of this file.
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)
6 any later version.
7
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***********************************************************************/
13
14#ifdef HAVE_CONFIG_H
15#include <fc_config.h>
16#endif
17
18// Qt
19#include <QActionGroup>
20#include <QApplication>
21#include <QFileDialog>
22#include <QMainWindow>
23#include <QMessageBox>
24#include <QScrollArea>
25#include <QStandardPaths>
26#include <QVBoxLayout>
27
28// utility
29#include "string_vector.h"
30
31// common
32#include "game.h"
33#include "government.h"
34#include "goto.h"
35#include "name_translation.h"
36#include "road.h"
37#include "unit.h"
38
39// client
40#include "connectdlg_common.h"
41#include "control.h"
42#include "helpdata.h"
43
44// gui-qt
45#include "fc_client.h"
46#include "chatline.h"
47#include "cityrep.h"
48#include "dialogs.h"
49#include "gotodlg.h"
50#include "gui_main.h"
51#include "hudwidget.h"
52#include "mapctrl.h"
53#include "messagedlg.h"
54#include "plrdlg.h"
55#include "ratesdlg.h"
56#include "repodlgs.h"
57#include "shortcuts.h"
58#include "spaceshipdlg.h"
59#include "sprite.h"
60
61#include "menu.h"
62
63static void enable_interface(bool enable);
64
65/**********************************************************************/
69{
70 city = pcity;
71 tile = nullptr;
72 trade_num = 0;
74}
75
76/**********************************************************************/
83
84/**********************************************************************/
88{
89 int i, s;
90 struct city *pcity;
91 struct player *pplayer = client_player();
92
94 s = city_list_size(pplayer->cities);
95 if (s == 0) {
96 return;
97 }
98 for (i = 0; i < s; i++) {
99 pcity = city_list_get(pplayer->cities, i);
101 }
102}
103
104/**********************************************************************/
108{
109 struct city *pcity;
110 trade_city *tc;
111
112 foreach(pcity, virtual_cities) {
114 }
115 virtual_cities.clear();
116 foreach(tc, cities) {
117 delete tc;
118 }
119 cities.clear();
120 lines.clear();
121 gui()->mapview_wdg->repaint();
122}
123
124/**********************************************************************/
128{
129 trade_city *tc = new trade_city(pcity);
130
131 cities.append(tc);
132 gui()->infotab->chtwdg->append(QString(_("Adding city %1 to trade planning"))
133 .arg(tc->city->name));
134}
135
136/**********************************************************************/
140{
141 struct city *pcity;
142 trade_city *tc;
143
144 pcity = tile_city(ptile);
145
146 foreach (tc, cities) {
147 if (pcity != nullptr) {
148 if (tc->city == pcity) {
150 return;
151 }
152 }
153 if (tc->city->tile == ptile) {
154 remove_virtual_city(ptile);
155 return;
156 }
157 }
158
159 if (pcity != nullptr) {
161 return;
162 }
163
164 pcity = create_city_virtual(client_player(), ptile, "Virtual");
166 virtual_cities.append(pcity);
167}
168
169/**********************************************************************/
173{
174 trade_city *tc;
175
176 foreach (tc, cities) {
177 if (tc->city->tile == pcity->tile) {
178 cities.removeAll(tc);
179 gui()->infotab->chtwdg->append(
180 QString(_("Removing city %1 from trade planning"))
181 .arg(tc->city->name));
182 return;
183 }
184 }
185}
186
187/**********************************************************************/
191{
192 struct city *c;
193 trade_city *tc;
194
195 foreach (c, virtual_cities) {
196 if (c->tile == ptile) {
197 virtual_cities.removeAll(c);
198 gui()->infotab->chtwdg->append(
199 QString(_("Removing city %1 from trade planning")).arg(c->name));
200 }
201 }
202
203 foreach (tc, cities) {
204 if (tc->city->tile == ptile) {
205 cities.removeAll(tc);
206 return;
207 }
208 }
209}
210
211/**********************************************************************/
217{
219
220 foreach (ttc, cities) {
221 if (!have_cities_trade_route(tc->city, ttc->city)
223 tc->poss_trade_num++;
224 tc->pos_cities.append(ttc->city);
225 }
226 tc->over_max = tc->trade_num + tc->poss_trade_num
227 - max_trade_routes(tc->city);
228 }
229}
230
231/**********************************************************************/
235{
236 trade_city *tc;
237 int i;
238 bool tdone;
239 int count = cities.size();
240 int *cities_ids = (int *)fc_malloc(sizeof(int) * count);
241 trade_city **cities_order = (trade_city **)fc_malloc(sizeof(trade_city *) * count);
242
243 for (i = 0; i < 100; i++) {
244 int n;
245
246 tdone = true;
247
248 for (n = 0; n < count; n++) {
249 cities_ids[n] = n;
251 }
253
254 cities.clear();
255 for (n = 0; n < count; n++) {
257 }
258
259 lines.clear();
260 foreach (tc, cities) {
261 tc->pos_cities.clear();
262 tc->new_tr_cities.clear();
263 tc->curr_tr_cities.clear();
264 }
265 foreach (tc, cities) {
267 tc->poss_trade_num = 0;
268 tc->pos_cities.clear();
269 tc->new_tr_cities.clear();
270 tc->curr_tr_cities.clear();
271 tc->done = false;
272 calculate_inner(tc);
273 }
274
276 discard();
278
279 foreach (tc, cities) {
280 if (!tc->done) {
281 tdone = false;
282 }
283 }
284 if (tdone) {
285 break;
286 }
287 }
288 foreach (tc, cities) {
289 if (!tc->done) {
290 char text[1024];
291 fc_snprintf(text, sizeof(text),
292 PL_("City %s - 1 free trade route.",
293 "City %s - %d free trade routes.",
294 max_trade_routes(tc->city) - tc->trade_num),
295 city_link(tc->city),
296 max_trade_routes(tc->city) - tc->trade_num);
298 }
299 }
300
303
304 gui()->mapview_wdg->repaint();
305}
306
307/**********************************************************************/
312{
313 trade_city *tc;
314 int max = 0;
315
316 foreach (tc, cities) {
317 if (pcity != tc->city) {
318 max = qMax(max, tc->over_max);
319 }
320 }
321 return max;
322}
323
324/**********************************************************************/
328{
329 trade_city *tc;
330 trade_city *rc = nullptr;
331 int max = 0;
332
333 foreach (tc, cities) {
334 if (max < tc->over_max) {
335 max = tc->over_max;
336 rc = tc;
337 }
338 }
339 return rc;
340}
341
342/**********************************************************************/
346{
347 trade_city *tc;
348 int j = 5;
349
350 for (int i = j; i > -j; i--) {
351 while ((tc = find_most_free())) {
352 if (!discard_one(tc)) {
353 if (!discard_any(tc, i)) {
354 break;
355 }
356 }
357 }
358 }
359}
360
361/**********************************************************************/
365{
366 tc->pos_cities.removeOne(ttc->city);
367 ttc->pos_cities.removeOne(tc->city);
368 tc->poss_trade_num--;
369 ttc->poss_trade_num--;
370 tc->over_max--;
371 ttc->over_max--;
372 check_if_done(tc, ttc);
373}
374
375/**********************************************************************/
379{
380 int best = 0;
381 int current_candidate = 0;
382 int best_id;
384
385 for (int i = cities.size() - 1 ; i >= 0; i--) {
386 ttc = cities.at(i);
388 if (current_candidate > best) {
389 best_id = i;
390 }
391 }
392 if (best == 0) {
393 return false;
394 }
395
396 ttc = cities.at(best_id);
397 discard_trade(tc, ttc);
398 return true;
399}
400
401/**********************************************************************/
405{
407
408 for (int i = cities.size() - 1 ; i >= 0; i--) {
409 ttc = cities.at(i);
410 if (tc->pos_cities.contains(ttc->city)
411 && ttc->pos_cities.contains(tc->city)
412 && ttc->over_max > freeroutes) {
413 discard_trade(tc, ttc);
414 return true;
415 }
416 }
417 return false;
418}
419
420/**********************************************************************/
426{
428
429 foreach (ttc, cities) {
430 if (ttc->done || ttc->over_max > 0
431 || tc == ttc || tc->done || tc->over_max > 0) {
432 continue;
433 }
434 if (tc->pos_cities.contains(ttc->city)
435 && ttc->pos_cities.contains(tc->city)) {
436 struct qtiles gilles;
437
438 tc->pos_cities.removeOne(ttc->city);
439 ttc->pos_cities.removeOne(tc->city);
440 tc->poss_trade_num--;
441 ttc->poss_trade_num--;
442 tc->new_tr_cities.append(ttc->city);
443 ttc->new_tr_cities.append(ttc->city);
444 tc->trade_num++;
445 ttc->trade_num++;
446 tc->over_max--;
447 ttc->over_max--;
448 check_if_done(tc, ttc);
449 gilles.t1 = tc->city->tile;
450 gilles.t2 = ttc->city->tile;
451 gilles.autocaravan = nullptr;
452 lines.append(gilles);
453 }
454 }
455}
456
457/**********************************************************************/
461{
462 trade_city *tc;
463
464 foreach (tc, cities) {
465 if (tc->done || tc->over_max > 0) {
466 continue;
467 }
469 }
470}
471
472/**********************************************************************/
476{
477 if (tc1->trade_num == max_trade_routes(tc1->city)) {
478 tc1->done = true;
479 }
480 if (tc2->trade_num == max_trade_routes(tc2->city)) {
481 tc2->done = true;
482 }
483}
484
485/**********************************************************************/
491
492/**********************************************************************/
499
500/**********************************************************************/
504{
505 unit_list.clear();
506}
507
508/**********************************************************************/
513{
515 return;
516 }
517 gui()->menu_bar->clear();
518 gui()->menu_bar->setup_menus();
519
521
522 // A new ruleset may have been loaded.
524}
525
526/**********************************************************************/
531{
532 if (C_S_RUNNING <= client_state()) {
533 gui()->menuBar()->setVisible(true);
534 if (!is_waiting_turn_change()) {
535 gui()->menu_bar->menus_sensitive();
536 gui()->menu_bar->update_airlift_menu();
537 gui()->menu_bar->update_roads_menu();
538 gui()->menu_bar->update_bases_menu();
541 gui()->unitinfo_wdg->update_actions(nullptr);
542 }
543 } else {
544 gui()->menuBar()->setVisible(false);
545 }
546}
547
548/**********************************************************************/
553static const char *get_tile_change_menu_text(struct tile *ptile,
554 enum unit_activity activity)
555{
556 struct tile *newtile = tile_virtual_new(ptile);
557 const char *text;
558
559 tile_apply_activity(newtile, activity, nullptr);
560 text = tile_get_info_text(newtile, FALSE, 0);
562
563 return text;
564}
565
566/**********************************************************************/
570 QMenu(_("Government"), parent)
571{
572 // Register ourselves to get updates for free.
573 instances << this;
574 setAttribute(Qt::WA_TranslucentBackground);
575}
576
577/**********************************************************************/
581{
583 instances.remove(this);
584}
585
586/**********************************************************************/
591 struct government *gov, *revol_gov;
592 int gov_count, i;
593
594 // Clear any content
595 foreach(action, QWidget::actions()) {
597 action->deleteLater();
598 }
599 actions.clear();
600
602 actions.reserve(gov_count + 1);
603 action = addAction(_("Revolution..."));
604 connect(action, &QAction::triggered, this, &gov_menu::revolution);
605 actions.append(action);
606
607 addSeparator();
608
609 // Add an action for each government. There is no icon yet.
611 for (i = 0; i < gov_count; ++i) {
612 gov = government_by_number(i);
613 if (gov != revol_gov) { // Skip revolution government
614 // Defeat keyboard shortcut mnemonics
616 .replace("&", "&&"));
617 // We need to keep track of the gov <-> action mapping to be able to
618 // set enabled/disabled depending on available govs.
619 actions.append(action);
620 QObject::connect(action, &QAction::triggered, [this,i]() {
621 change_gov(i);
622 });
623 }
624 }
625}
626
627/**********************************************************************/
631{
632 struct government *gov, *revol_gov;
633 struct sprite *sprite;
634 int gov_count, i, j;
635
638 for (i = 0, j = 0; i < gov_count; i++) {
639 gov = government_by_number(i);
640 if (gov != revol_gov) { // Skip revolution government
642 if (sprite != nullptr) {
643 actions[j + 1]->setIcon(QIcon(*(sprite->pm)));
644 }
645 actions[j + 1]->setEnabled(
647 j++;
648 } else {
649 actions[0]->setEnabled(!client_is_observer()
651 }
652 }
653}
654
655/**********************************************************************/
662
663/**********************************************************************/
670
671/**************************************************************************
672 Keeps track of all gov_menu instances.
673**************************************************************************/
675
676/**********************************************************************/
680{
681 foreach (gov_menu *m, instances) {
682 m->create();
683 }
684}
685
686/**********************************************************************/
690{
691 foreach (gov_menu *m, instances) {
692 m->update();
693 }
694}
695
696/**********************************************************************/
700 : QMenu(_("Go to and..."), parent)
701{
702 // Will need auto updates etc.
703 instances << this;
704}
705
706/**********************************************************************/
710{
711 // Updates are no longer needed.
712 instances.remove(this);
713}
714
715/**********************************************************************/
719{
720 // Clear menu item to action ID mapping.
721 items.clear();
722
723 // Remove the menu items
724 clear();
725}
726
727/**********************************************************************/
731{
732 QAction *item;
733 int tgt_kind_group;
734
735 // Group goto and perform action menu items by target kind.
738 struct action *paction = action_by_number(act_id);
740 .replace("&", "&&"));
741
742 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
743 // This action isn't performed by an unit.
744 continue;
745 }
746
748 // Wrong group.
749 continue;
750 }
751
752 if (action_id_has_complex_target(act_id)) {
754 items.insert(sub_target_menu->menuAction(), act_id);
755
756#define CREATE_SUB_ITEM(_menu_, _act_id_, _sub_tgt_id_, _sub_tgt_name_) \
757 { \
758 QAction *_sub_item_ = _menu_->addAction(_sub_tgt_name_); \
759 int _sub_target_id_ = _sub_tgt_id_; \
760 QObject::connect(_sub_item_, &QAction::triggered, \
761 [this, _act_id_, _sub_target_id_]() { \
762 start_go_act(_act_id_, _sub_target_id_); \
763 }); \
764 }
765
767 case ASTK_BUILDING:
773 break;
774 case ASTK_TECH:
780 break;
781 case ASTK_EXTRA:
783 extra_type_iterate(pextra) {
784 if (!actres_creates_extra(paction->result, pextra)
785 && !actres_removes_extra(paction->result, pextra)) {
786 // Not relevant
787 continue;
788 }
789
791 extra_number(pextra),
792 extra_name_translation(pextra));
794 break;
795 case ASTK_NONE:
796 // Should not be here.
798 break;
799 case ASTK_COUNT:
800 // Should not exits
802 break;
803 }
804 continue;
805 }
806
807#define ADD_OLD_SHORTCUT(wanted_action_id, sc_id) \
808 if (act_id == wanted_action_id) { \
809 item->setShortcut(QKeySequence(shortcut_to_string( \
810 fc_shortcuts::sc()->get_shortcut(sc_id)))); \
811 }
812
813 /* Create and add the menu item. It will be hidden or shown based on
814 * unit type. */
816 items.insert(item, act_id);
817
818 /* Add the keyboard shortcuts for "Go to and..." menu items that
819 * existed independently before the "Go to and..." menu arrived. */
823
824 QObject::connect(item, &QAction::triggered, [this,act_id]() {
825 start_go_act(act_id, NO_TARGET);
826 });
828 }
829}
830
831/**********************************************************************/
835{
836 bool can_do_something = false;
837
838 if (!actions_are_ready()) {
839 // Nothing to do.
840 return;
841 }
842
843 if (items.isEmpty()) {
844 // The goto and act menu needs menu items.
845 create();
846 }
847
848 /* Enable a menu item if it is theoretically possible that one of the
849 * selected units can perform it. Checking if the action can be performed
850 * at the current tile is pointless since it should be performed at the
851 * target tile. */
852 foreach(QAction *item, items.keys()) {
854 items.value(item), TRUE)) {
855 item->setVisible(true);
856 can_do_something = true;
857 } else {
858 item->setVisible(false);
859 }
860 }
861
862 if (can_do_something) {
863 // At least one menu item is enabled for one of the selected units.
864 setEnabled(true);
865 } else {
866 // No menu item is enabled any of the selected units.
867 setEnabled(false);
868 }
869}
870
871/**********************************************************************/
874void go_act_menu::start_go_act(int act_id, int sub_tgt_id)
875{
876 request_unit_goto(ORDER_PERFORM_ACTION, act_id, sub_tgt_id);
877}
878
879/**************************************************************************
880 Store all goto and act menu items so they can be updated etc
881**************************************************************************/
883
884/**********************************************************************/
888{
889 foreach (go_act_menu *m, instances) {
890 m->reset();
891 }
892}
893
894/**********************************************************************/
898{
899 foreach (go_act_menu *m, instances) {
900 m->update();
901 }
902}
903
904/**********************************************************************/
908{
910 struct tile *ptile = nullptr;
911 struct unit *zunit;
912 struct unit *qunit;
913
914 int i = 0;
915 qunit = punit;
916 foreach (fui, units_list.unit_list) {
917 zunit = unit_list_find(client_player()->units, fui->id);
918 i++;
919 if (i >= pos) {
920 punit = qunit;
921 return ptile;
922 }
923 if (zunit == nullptr) {
924 continue;
925 }
926
927 if (punit == zunit) { // Unit found
928 /* Unit was ordered to attack city so it might stay in
929 front of that city */
931 ptile = tile_before_end_path(punit, fui->ptile);
932 if (ptile == nullptr) {
933 ptile = fui->ptile;
934 }
935 } else {
936 ptile = fui->ptile;
937 }
938 // Unit found in transport
939 } else if (unit_contained_in(punit, zunit)) {
940 ptile = fui->ptile;
941 }
942 }
943 return nullptr;
944}
945
946/**********************************************************************/
949mr_menu::mr_menu() : QMenuBar()
950{
951}
952
953/**********************************************************************/
959{
960 QAction *act;
961 QMenu *sub_menu;
962 QMenu *main_menu;
964 int i;
965
966 delayed_order = false;
967 airlift_type_id = 0;
968 quick_airlifting = false;
969
970 // Game Menu
971 main_menu = this->addMenu(_("Game"));
972
973#ifdef __APPLE__
974 // On Mac, Qt would try to move menu entry named just "Options" to
975 // application menu, but as this is submenu and not an action
976 // 1) It would fail to appear in the destination
977 // 2) It's impossible to override the behavior with QAction::menuRule()
978 // We add an invisible character for the string comparison to fail.
979 sub_menu = main_menu->addMenu(QString("\u200B") + _("Options"));
980#else // __APPLE__
981 sub_menu = main_menu->addMenu(_("Options"));
982#endif // __APPLE__
983
984 act = sub_menu->addAction(_("Set local options"));
985 connect(act, &QAction::triggered, this, &mr_menu::local_options);
986 act = sub_menu->addAction(_("Server Options"));
987 connect(act, &QAction::triggered, this, &mr_menu::server_options);
988 act = sub_menu->addAction(_("Messages"));
989 connect(act, &QAction::triggered, this, &mr_menu::messages_options);
990 act = sub_menu->addAction(_("Shortcuts"));
991 connect(act, &QAction::triggered, this, &mr_menu::shortcut_options);
992 act = sub_menu->addAction(_("Load another tileset"));
993 connect(act, &QAction::triggered, this, &mr_menu::tileset_custom_load);
994 act = sub_menu->addAction(_("Save Options Now"));
995 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
996 connect(act, &QAction::triggered, this, &mr_menu::save_options_now);
997 act = sub_menu->addAction(_("Save Options on Exit"));
998 act->setCheckable(true);
999 act->setChecked(gui_options.save_options_on_exit);
1000 main_menu->addSeparator();
1001 act = main_menu->addAction(_("Save Game"));
1002 act->setShortcut(QKeySequence(tr("Ctrl+s")));
1003 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
1004 menu_list.insert(SAVE, act);
1005 connect(act, &QAction::triggered, this, &mr_menu::save_game);
1006 act = main_menu->addAction(_("Save Game As..."));
1007 menu_list.insert(SAVE, act);
1008 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
1009 connect(act, &QAction::triggered, this, &mr_menu::save_game_as);
1010 act = main_menu->addAction(_("Save Map to Image"));
1011 connect(act, &QAction::triggered, this, &mr_menu::save_image);
1012 main_menu->addSeparator();
1013 act = main_menu->addAction(_("Leave game"));
1014 act->setIcon(style()->standardIcon(QStyle::SP_DialogDiscardButton));
1015 connect(act, &QAction::triggered, this, &mr_menu::back_to_menu);
1016 act = main_menu->addAction(_("Quit"));
1017 act->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
1018 connect(act, &QAction::triggered, this, &mr_menu::quit_game);
1019
1020 // View Menu
1021 main_menu = this->addMenu(Q_("?verb:View"));
1022 act = main_menu->addAction(_("Center View"));
1023 act->setShortcut(QKeySequence(shortcut_to_string(
1024 fc_shortcuts::sc()->get_shortcut(SC_CENTER_VIEW))));
1025 connect(act, &QAction::triggered, this, &mr_menu::slot_center_view);
1026 main_menu->addSeparator();
1027 act = main_menu->addAction(_("Fullscreen"));
1028 act->setShortcut(QKeySequence(shortcut_to_string(
1029 fc_shortcuts::sc()->get_shortcut(SC_FULLSCREEN))));
1030 act->setCheckable(true);
1031 act->setChecked(gui_options.gui_qt_fullscreen);
1032 connect(act, &QAction::triggered, this, &mr_menu::slot_fullscreen);
1033 main_menu->addSeparator();
1034 minimap_status = main_menu->addAction(_("Minimap"));
1035 minimap_status->setCheckable(true);
1037 fc_shortcuts::sc()->get_shortcut(SC_MINIMAP))));
1038 minimap_status->setChecked(true);
1039 connect(minimap_status, &QAction::triggered, this,
1041 osd_status = main_menu->addAction(_("Show new turn information"));
1042 osd_status->setCheckable(true);
1043 osd_status->setChecked(gui()->qt_settings.show_new_turn_text);
1044 connect(osd_status, &QAction::triggered, this,
1046 btlog_status = main_menu->addAction(_("Show combat detailed information"));
1047 btlog_status->setCheckable(true);
1048 btlog_status->setChecked(gui()->qt_settings.show_battle_log);
1049 connect(btlog_status, &QAction::triggered, this, &mr_menu::slot_battlelog);
1050 lock_status = main_menu->addAction(_("Lock interface"));
1051 lock_status->setCheckable(true);
1053 fc_shortcuts::sc()->get_shortcut(SC_IFACE_LOCK))));
1054 lock_status->setChecked(false);
1055 connect(lock_status, &QAction::triggered, this, &mr_menu::slot_lock);
1056 connect(minimap_status, &QAction::triggered, this, &mr_menu::slot_lock);
1057 main_menu->addSeparator();
1058 act = main_menu->addAction(_("Zoom in"));
1059 act->setShortcut(QKeySequence(shortcut_to_string(
1060 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_IN))));
1061 connect(act, &QAction::triggered, this, &mr_menu::zoom_in);
1062 act = main_menu->addAction(_("Zoom default"));
1063 act->setShortcut(QKeySequence(shortcut_to_string(
1064 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_RESET))));
1065 connect(act, &QAction::triggered, this, &mr_menu::zoom_reset);
1066 act = main_menu->addAction(_("Zoom out"));
1067 act->setShortcut(QKeySequence(shortcut_to_string(
1068 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_OUT))));
1069 connect(act, &QAction::triggered, this, &mr_menu::zoom_out);
1070 scale_fonts_status = main_menu->addAction(_("Scale fonts"));
1071 connect(scale_fonts_status, &QAction::triggered, this,
1073 scale_fonts_status->setCheckable(true);
1074 scale_fonts_status->setChecked(true);
1075 main_menu->addSeparator();
1076 act = main_menu->addAction(_("City Outlines"));
1077 act->setCheckable(true);
1078 act->setChecked(gui_options.draw_city_outlines);
1079 connect(act, &QAction::triggered, this, &mr_menu::slot_city_outlines);
1080 act = main_menu->addAction(_("City Output"));
1081 act->setCheckable(true);
1082 act->setChecked(gui_options.draw_city_output);
1083 act->setShortcut(QKeySequence(shortcut_to_string(
1084 fc_shortcuts::sc()->get_shortcut(SC_CITY_OUTPUT))));
1085 connect(act, &QAction::triggered, this, &mr_menu::slot_city_output);
1086 act = main_menu->addAction(_("Map Grid"));
1087 act->setShortcut(QKeySequence(shortcut_to_string(
1088 fc_shortcuts::sc()->get_shortcut(SC_MAP_GRID))));
1089 act->setCheckable(true);
1090 act->setChecked(gui_options.draw_map_grid);
1091 connect(act, &QAction::triggered, this, &mr_menu::slot_map_grid);
1092 act = main_menu->addAction(_("National Borders"));
1093 act->setCheckable(true);
1094 act->setChecked(gui_options.draw_borders);
1095 act->setShortcut(QKeySequence(shortcut_to_string(
1096 fc_shortcuts::sc()->get_shortcut(SC_NAT_BORDERS))));
1097 connect(act, &QAction::triggered, this, &mr_menu::slot_borders);
1098 act = main_menu->addAction(_("Native Tiles"));
1099 act->setCheckable(true);
1100 act->setChecked(gui_options.draw_native);
1101 act->setShortcut(QKeySequence(tr("ctrl+shift+n")));
1102 connect(act, &QAction::triggered, this, &mr_menu::slot_native_tiles);
1103 act = main_menu->addAction(_("City Full Bar"));
1104 act->setCheckable(true);
1105 act->setShortcut(QKeySequence(shortcut_to_string(
1106 fc_shortcuts::sc()->get_shortcut(SC_SHOW_FULLBAR))));
1107 act->setChecked(gui_options.draw_full_citybar);
1108 connect(act, &QAction::triggered, this, &mr_menu::slot_fullbar);
1109 act = main_menu->addAction(_("City Names"));
1110 act->setCheckable(true);
1111 act->setChecked(gui_options.draw_city_names);
1112 act->setShortcut(QKeySequence(shortcut_to_string(
1113 fc_shortcuts::sc()->get_shortcut(SC_CITY_NAMES))));
1114 connect(act, &QAction::triggered, this, &mr_menu::slot_city_names);
1115 act = main_menu->addAction(_("City Growth"));
1116 act->setCheckable(true);
1117 act->setChecked(gui_options.draw_city_growth);
1118 act->setShortcut(QKeySequence(tr("ctrl+o")));
1119 connect(act, &QAction::triggered, this, &mr_menu::slot_city_growth);
1120 act = main_menu->addAction(_("City Production"));
1121 act->setCheckable(true);
1122 act->setChecked(gui_options.draw_city_productions);
1123 act->setShortcut(QKeySequence(shortcut_to_string(
1124 fc_shortcuts::sc()->get_shortcut(SC_CITY_PROD))));
1125 connect(act, &QAction::triggered, this, &mr_menu::slot_city_production);
1126 act = main_menu->addAction(_("City Buy Cost"));
1127 act->setCheckable(true);
1128 act->setChecked(gui_options.draw_city_buycost);
1129 connect(act, &QAction::triggered, this, &mr_menu::slot_city_buycost);
1130 act = main_menu->addAction(_("City Trade Routes"));
1131 act->setCheckable(true);
1132 act->setChecked(gui_options.draw_city_trade_routes);
1133 act->setShortcut(QKeySequence(shortcut_to_string(
1134 fc_shortcuts::sc()->get_shortcut(SC_TRADE_ROUTES))));
1135 connect(act, &QAction::triggered, this, &mr_menu::slot_city_trade_routes);
1136 act = main_menu->addAction(_("Unit Stack Size"));
1137 act->setCheckable(true);
1138 act->setChecked(gui_options.draw_unit_stack_size);
1139 act->setShortcut(QKeySequence(shortcut_to_string(
1140 fc_shortcuts::sc()->get_shortcut(SC_STACK_SIZE))));
1141 connect(act, &QAction::triggered, this, &mr_menu::slot_stack_size);
1142
1143 // Select Menu
1144 main_menu = this->addMenu(_("Select"));
1145 act = main_menu->addAction(_("Single Unit (Unselect Others)"));
1146 act->setShortcut(QKeySequence(tr("shift+z")));
1147 menu_list.insert(STANDARD, act);
1148 connect(act, &QAction::triggered, this, &mr_menu::slot_select_one);
1149 act = main_menu->addAction(_("All On Tile"));
1150 act->setShortcut(QKeySequence(tr("v")));
1151 menu_list.insert(STANDARD, act);
1152 connect(act, &QAction::triggered, this, &mr_menu::slot_select_all_tile);
1153 main_menu->addSeparator();
1154 act = main_menu->addAction(_("Same Type on Tile"));
1155 act->setShortcut(QKeySequence(tr("shift+v")));
1156 menu_list.insert(STANDARD, act);
1157 connect(act, &QAction::triggered, this, &mr_menu::slot_select_same_tile);
1158 act = main_menu->addAction(_("Same Type on Continent"));
1159 act->setShortcut(QKeySequence(tr("shift+c")));
1160 menu_list.insert(STANDARD, act);
1161 connect(act, &QAction::triggered, this,
1163 act = main_menu->addAction(_("Same Type Everywhere"));
1164 act->setShortcut(QKeySequence(tr("shift+x")));
1165 menu_list.insert(STANDARD, act);
1166 connect(act, &QAction::triggered, this,
1168 main_menu->addSeparator();
1169 act = main_menu->addAction(_("Wait"));
1170 act->setShortcut(QKeySequence(shortcut_to_string(
1171 fc_shortcuts::sc()->get_shortcut(SC_WAIT))));
1172 menu_list.insert(STANDARD, act);
1173 connect(act, &QAction::triggered, this, &mr_menu::slot_wait);
1174 act = main_menu->addAction(_("Done"));
1175 act->setShortcut(QKeySequence(shortcut_to_string(
1176 fc_shortcuts::sc()->get_shortcut(SC_DONE_MOVING))));
1177 menu_list.insert(STANDARD, act);
1178 connect(act, &QAction::triggered, this, &mr_menu::slot_done_moving);
1179
1180 act = main_menu->addAction(_("Advanced unit selection"));
1181 act->setShortcut(QKeySequence(tr("ctrl+e")));
1182 menu_list.insert(NOT_4_OBS, act);
1183 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_filter);
1184
1185 // Unit Menu
1186 main_menu = this->addMenu(_("Unit"));
1187 act = main_menu->addAction(_("Go to Tile"));
1188 act->setShortcut(QKeySequence(shortcut_to_string(
1189 fc_shortcuts::sc()->get_shortcut(SC_GOTO))));
1190 menu_list.insert(STANDARD, act);
1191 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_goto);
1192
1193 // The goto and act sub menu is handled as a separate object.
1194 main_menu->addMenu(new go_act_menu(this));
1195
1196 act = main_menu->addAction(_("Go to Nearest City"));
1197 act->setShortcut(QKeySequence(tr("shift+g")));
1198 menu_list.insert(GOTO_CITY, act);
1199 connect(act, &QAction::triggered, this, &mr_menu::slot_return_to_city);
1200 act = main_menu->addAction(_("Go to/Airlift to City..."));
1201 act->setShortcut(QKeySequence(shortcut_to_string(
1202 fc_shortcuts::sc()->get_shortcut(SC_GOTOAIRLIFT))));
1203 menu_list.insert(AIRLIFT, act);
1204 connect(act, &QAction::triggered, this, &mr_menu::slot_airlift);
1205 main_menu->addSeparator();
1206 act = main_menu->addAction(_("Auto Explore"));
1207 menu_list.insert(EXPLORE, act);
1208 act->setShortcut(QKeySequence(shortcut_to_string(
1209 fc_shortcuts::sc()->get_shortcut(SC_AUTOEXPLORE))));
1210 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_explore);
1211 act = main_menu->addAction(_("Patrol"));
1212 menu_list.insert(STANDARD, act);
1213 act->setEnabled(false);
1214 act->setShortcut(QKeySequence(shortcut_to_string(
1215 fc_shortcuts::sc()->get_shortcut(SC_PATROL))));
1216 connect(act, &QAction::triggered, this, &mr_menu::slot_patrol);
1217 main_menu->addSeparator();
1218 act = main_menu->addAction(_("Sentry"));
1219 act->setShortcut(QKeySequence(shortcut_to_string(
1220 fc_shortcuts::sc()->get_shortcut(SC_SENTRY))));
1221 menu_list.insert(SENTRY, act);
1222 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_sentry);
1223 act = main_menu->addAction(_("Unsentry All On Tile"));
1224 act->setShortcut(QKeySequence(shortcut_to_string(
1225 fc_shortcuts::sc()->get_shortcut(SC_UNSENTRY_TILE))));
1226 menu_list.insert(WAKEUP, act);
1227 connect(act, &QAction::triggered, this, &mr_menu::slot_unsentry);
1228 main_menu->addSeparator();
1229 act = main_menu->addAction(_("Load"));
1230 act->setShortcut(QKeySequence(shortcut_to_string(
1231 fc_shortcuts::sc()->get_shortcut(SC_BOARD))));
1232 menu_list.insert(BOARD, act);
1233 connect(act, &QAction::triggered, this, &mr_menu::slot_board);
1234 act = main_menu->addAction(_("Unload"));
1235 act->setShortcut(QKeySequence(shortcut_to_string(
1236 fc_shortcuts::sc()->get_shortcut(SC_DEBOARD))));
1237 menu_list.insert(DEBOARD, act);
1238 connect(act, &QAction::triggered, this, &mr_menu::slot_deboard);
1239 act = main_menu->addAction(_("Unload All From Transporter"));
1240 act->setShortcut(QKeySequence(tr("shift+t")));
1241 menu_list.insert(TRANSPORTER, act);
1242 connect(act, &QAction::triggered, this, &mr_menu::slot_unload_all);
1243 main_menu->addSeparator();
1244
1245 // Defeat keyboard shortcut mnemonics
1247 .replace("&", "&&"));
1248 menu_list.insert(HOMECITY, act);
1249 act->setShortcut(QKeySequence(shortcut_to_string(
1250 fc_shortcuts::sc()->get_shortcut(SC_SETHOME))));
1251 connect(act, &QAction::triggered, this, &mr_menu::slot_set_home);
1252 act = main_menu->addAction(_("Upgrade"));
1253 act->setShortcut(QKeySequence(shortcut_to_string(
1254 fc_shortcuts::sc()->get_shortcut(SC_UPGRADE_UNIT))));
1255 menu_list.insert(UPGRADE, act);
1256 connect(act, &QAction::triggered, this, &mr_menu::slot_upgrade);
1257 act = main_menu->addAction(_("Convert"));
1258 act->setShortcut(QKeySequence(tr("shift+o")));
1259 menu_list.insert(CONVERT, act);
1260 connect(act, &QAction::triggered, this, &mr_menu::slot_convert);
1261 act = main_menu->addAction(_("Disband"));
1262 act->setShortcut(QKeySequence(tr("shift+d")));
1263 menu_list.insert(DISBAND, act);
1264 connect(act, &QAction::triggered, this, &mr_menu::slot_disband);
1265
1266 // Combat Menu
1267 main_menu = this->addMenu(_("Combat"));
1268 act = main_menu->addAction(_("Fortify Unit"));
1269 menu_list.insert(FORTIFY, act);
1270 act->setShortcut(QKeySequence(shortcut_to_string(
1271 fc_shortcuts::sc()->get_shortcut(SC_FORTIFY))));
1272 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_fortify);
1273 act = main_menu->addAction(QString(Q_(terrain_control.gui_type_base0))
1274 .replace("&", "&&"));
1275 menu_list.insert(FORTRESS, act);
1276 act->setShortcut(QKeySequence(tr("shift+f")));
1277 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_fortress);
1278 act = main_menu->addAction(QString(Q_(terrain_control.gui_type_base1))
1279 .replace("&", "&&"));
1280 menu_list.insert(AIRBASE, act);
1281 act->setShortcut(QKeySequence(tr("shift+e")));
1282 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_airbase);
1283 bases_menu = main_menu->addMenu(_("Build Base"));
1284 main_menu->addSeparator();
1285 act = main_menu->addAction(_("Paradrop"));
1286 menu_list.insert(PARADROP, act);
1287 act->setShortcut(QKeySequence(shortcut_to_string(
1288 fc_shortcuts::sc()->get_shortcut(SC_PARADROP))));
1289 connect(act, &QAction::triggered, this, &mr_menu::slot_paradrop);
1290 act = main_menu->addAction(_("Pillage"));
1291 menu_list.insert(PILLAGE, act);
1292 act->setShortcut(QKeySequence(tr("shift+p")));
1293 connect(act, &QAction::triggered, this, &mr_menu::slot_pillage);
1294 // TRANS: Menu item to bring up the action selection dialog.
1295 act = main_menu->addAction(_("Do..."));
1296 menu_list.insert(ORDER_DIPLOMAT_DLG, act);
1297 act->setShortcut(QKeySequence(shortcut_to_string(
1298 fc_shortcuts::sc()->get_shortcut(SC_DO))));
1299 connect(act, &QAction::triggered, this, &mr_menu::slot_action);
1300
1301 // Work Menu
1302 main_menu = this->addMenu(_("Work"));
1304 .replace("&", "&&"));
1305 act->setShortcut(QKeySequence(shortcut_to_string(
1306 fc_shortcuts::sc()->get_shortcut(SC_BUILDCITY))));
1307 menu_list.insert(BUILD, act);
1308 connect(act, &QAction::triggered, this, &mr_menu::slot_build_city);
1309 act = main_menu->addAction(_("Auto Worker"));
1310 act->setShortcut(QKeySequence(shortcut_to_string(
1311 fc_shortcuts::sc()->get_shortcut(SC_AUTOMATE))));
1312 menu_list.insert(AUTOWORKER, act);
1313 connect(act, &QAction::triggered, this, &mr_menu::slot_auto_worker);
1314 main_menu->addSeparator();
1315 act = main_menu->addAction(_("Build Road"));
1316 menu_list.insert(ROAD, act);
1317 act->setShortcut(QKeySequence(shortcut_to_string(
1318 fc_shortcuts::sc()->get_shortcut(SC_BUILDROAD))));
1319 connect(act, &QAction::triggered, this, &mr_menu::slot_build_road);
1320 roads_menu = main_menu->addMenu(_("Build Path"));
1321 act = main_menu->addAction(_("Build Irrigation"));
1322 act->setShortcut(QKeySequence(shortcut_to_string(
1323 fc_shortcuts::sc()->get_shortcut(SC_BUILDIRRIGATION))));
1324 menu_list.insert(IRRIGATION, act);
1325 connect(act, &QAction::triggered, this, &mr_menu::slot_build_irrigation);
1326 act = main_menu->addAction(_("Cultivate"));
1327 act->setShortcut(QKeySequence(shortcut_to_string(
1328 fc_shortcuts::sc()->get_shortcut(SC_CULTIVATE))));
1329 menu_list.insert(CULTIVATE, act);
1330 connect(act, &QAction::triggered, this, &mr_menu::slot_cultivate);
1331 act = main_menu->addAction(_("Build Mine"));
1332 act->setShortcut(QKeySequence(shortcut_to_string(
1333 fc_shortcuts::sc()->get_shortcut(SC_BUILDMINE))));
1334 menu_list.insert(MINE, act);
1335 connect(act, &QAction::triggered, this, &mr_menu::slot_build_mine);
1336 act = main_menu->addAction(_("Plant"));
1337 act->setShortcut(QKeySequence(shortcut_to_string(
1338 fc_shortcuts::sc()->get_shortcut(SC_PLANT))));
1339 menu_list.insert(PLANT, act);
1340 connect(act, &QAction::triggered, this, &mr_menu::slot_plant);
1341 main_menu->addSeparator();
1342 act = main_menu->addAction(_("Connect With Road"));
1343 act->setShortcut(QKeySequence(tr("ctrl+r")));
1344 menu_list.insert(CONNECT_ROAD, act);
1345 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_road);
1346 act = main_menu->addAction(_("Connect With Railroad"));
1347 menu_list.insert(CONNECT_RAIL, act);
1348 act->setShortcut(QKeySequence(tr("ctrl+l")));
1349 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_rail);
1350 act = main_menu->addAction(_("Connect With Maglev"));
1351 menu_list.insert(CONNECT_MAGLEV, act);
1352 act->setShortcut(QKeySequence(tr("ctrl+m")));
1353 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_maglev);
1354 act = main_menu->addAction(_("Connect With Irrigation"));
1355 menu_list.insert(CONNECT_IRRIGATION, act);
1356 act->setShortcut(QKeySequence(tr("ctrl+i")));
1357 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_irrigation);
1358 main_menu->addSeparator();
1359 act = main_menu->addAction(_("Transform Terrain"));
1360 menu_list.insert(TRANSFORM, act);
1361 act->setShortcut(QKeySequence(shortcut_to_string(
1362 fc_shortcuts::sc()->get_shortcut(SC_TRANSFORM))));
1363 connect(act, &QAction::triggered, this, &mr_menu::slot_transform);
1364 act = main_menu->addAction(_("Clean"));
1365 menu_list.insert(CLEAN, act);
1366 act->setShortcut(QKeySequence(shortcut_to_string(
1367 fc_shortcuts::sc()->get_shortcut(SC_CLEAN))));
1368 connect(act, &QAction::triggered, this, &mr_menu::slot_clean);
1370 .replace("&", "&&"));
1371 act->setShortcut(QKeySequence(tr("b")));
1372 menu_list.insert(BUILD_WONDER, act);
1373 connect(act, &QAction::triggered, this, &mr_menu::slot_build_city);
1375 .replace("&", "&&"));
1376 act->setShortcut(QKeySequence(tr("r")));
1377 menu_list.insert(ORDER_TRADE_ROUTE, act);
1378 connect(act, &QAction::triggered, this, &mr_menu::slot_build_road);
1379
1380 // Multiplayer Menu
1381 multiplayer_menu = this->addMenu(_("Multiplayer"));
1382 act = multiplayer_menu->addAction(_("Delayed Goto"));
1383 act->setShortcut(QKeySequence(tr("z")));
1384 connect(act, &QAction::triggered, this, &mr_menu::slot_delayed_goto);
1385 act = multiplayer_menu->addAction(_("Delayed Orders Execute"));
1386 act->setShortcut(QKeySequence(tr("ctrl+z")));
1387 connect(act, &QAction::triggered, this, &mr_menu::slot_execute_orders);
1388 act = multiplayer_menu->addAction(_("Clear Orders"));
1389 act->setShortcut(QKeySequence(tr("ctrl+shift+c")));
1390 connect(act, &QAction::triggered, this, &mr_menu::slot_orders_clear);
1391 act = multiplayer_menu->addAction(_("Add all cities to trade planning"));
1392 connect(act, &QAction::triggered, this, &mr_menu::slot_trade_add_all);
1393 act = multiplayer_menu->addAction(_("Calculate trade planning"));
1394 connect(act, &QAction::triggered, this, &mr_menu::slot_calculate);
1395 act = multiplayer_menu->addAction(_("Add/Remove City"));
1396 act->setShortcut(QKeySequence(tr("ctrl+t")));
1397 connect(act, &QAction::triggered, this, &mr_menu::slot_trade_city);
1398 act = multiplayer_menu->addAction(_("Clear Trade Planning"));
1399 connect(act, &QAction::triggered, this, &mr_menu::slot_clear_trade);
1400 act = multiplayer_menu->addAction(_("Automatic caravan"));
1401 menu_list.insert(AUTOTRADEROUTE, act);
1402 connect(act, &QAction::triggered, this, &mr_menu::slot_autocaravan);
1403 act->setShortcut(QKeySequence(tr("ctrl+j")));
1404 act = multiplayer_menu->addAction(_("Set/Unset rally point"));
1405 act->setShortcut(QKeySequence(tr("shift+s")));
1406 connect(act, &QAction::triggered, this, &mr_menu::slot_rally);
1407 act = multiplayer_menu->addAction(_("Quick Airlift"));
1408 act->setShortcut(QKeySequence(tr("ctrl+y")));
1409 connect(act, &QAction::triggered, this, &mr_menu::slot_quickairlift);
1410 airlift_type = new QActionGroup(this);
1411 airlift_menu = multiplayer_menu->addMenu(_("Unit type for quickairlifting"));
1412
1413 // Default diplo
1414 action_vs_city = new QActionGroup(this);
1415 action_vs_unit = new QActionGroup(this);
1416 action_unit_menu = multiplayer_menu->addMenu(_("Default action vs unit"));
1417
1418 act = action_unit_menu->addAction(_("Ask"));
1419 act->setCheckable(true);
1420 act->setChecked(true);
1421 act->setData(-1);
1422 action_vs_unit->addAction(act);
1423 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1424
1425 act = action_unit_menu->addAction(_("Bribe Unit"));
1426 act->setCheckable(true);
1427 act->setChecked(false);
1428 act->setData(ACTION_SPY_BRIBE_UNIT);
1429 action_vs_unit->addAction(act);
1430 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1431
1432 act = action_unit_menu->addAction(_("Sabotage"));
1433 act->setCheckable(true);
1434 act->setChecked(false);
1435 act->setData(ACTION_SPY_SABOTAGE_UNIT);
1436 action_vs_unit->addAction(act);
1437 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1438
1439 act = action_unit_menu->addAction(_("Sabotage Unit Escape"));
1440 act->setCheckable(true);
1441 act->setChecked(false);
1442 act->setData(ACTION_SPY_SABOTAGE_UNIT_ESC);
1443 action_vs_unit->addAction(act);
1444 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1445
1446 action_city_menu = multiplayer_menu->addMenu(_("Default action vs city"));
1447 act = action_city_menu->addAction(_("Ask"));
1448 act->setCheckable(true);
1449 act->setChecked(true);
1450 act->setData(-1);
1451 action_vs_city->addAction(act);
1452 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1453
1454 act = action_city_menu->addAction(_("Investigate city"));
1455 act->setCheckable(true);
1456 act->setChecked(false);
1457 act->setData(ACTION_SPY_INVESTIGATE_CITY);
1458 action_vs_city->addAction(act);
1459 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1460
1461 act = action_city_menu->addAction(_("Investigate city (spends the unit)"));
1462 act->setCheckable(true);
1463 act->setChecked(false);
1464 act->setData(ACTION_INV_CITY_SPEND);
1465 action_vs_city->addAction(act);
1466 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1467
1468 act = action_city_menu->addAction(_("Establish embassy"));
1469 act->setCheckable(true);
1470 act->setChecked(false);
1471 act->setData(ACTION_ESTABLISH_EMBASSY);
1472 action_vs_city->addAction(act);
1473 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1474
1475 act = action_city_menu->addAction(_("Become Ambassador"));
1476 act->setCheckable(true);
1477 act->setChecked(false);
1478 act->setData(ACTION_ESTABLISH_EMBASSY_STAY);
1479 action_vs_city->addAction(act);
1480 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1481
1482 act = action_city_menu->addAction(_("Steal technology"));
1483 act->setCheckable(true);
1484 act->setChecked(false);
1485 act->setData(ACTION_SPY_STEAL_TECH);
1486 action_vs_city->addAction(act);
1487 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1488
1489 act = action_city_menu->addAction(_("Steal technology and escape"));
1490 act->setCheckable(true);
1491 act->setChecked(false);
1492 act->setData(ACTION_SPY_STEAL_TECH_ESC);
1493 action_vs_city->addAction(act);
1494 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1495
1496 act = action_city_menu->addAction(_("Incite a revolt"));
1497 act->setCheckable(true);
1498 act->setChecked(false);
1499 act->setData(ACTION_SPY_INCITE_CITY);
1500 action_vs_city->addAction(act);
1501 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1502
1503 act = action_city_menu->addAction(_("Incite a Revolt and Escape"));
1504 act->setCheckable(true);
1505 act->setChecked(false);
1506 act->setData(ACTION_SPY_INCITE_CITY_ESC);
1507 action_vs_city->addAction(act);
1508 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1509
1510 act = action_city_menu->addAction(_("Poison city"));
1511 act->setCheckable(true);
1512 act->setChecked(false);
1513 act->setData(ACTION_SPY_POISON);
1514 action_vs_city->addAction(act);
1515 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1516
1517 act = action_city_menu->addAction(_("Poison City Escape"));
1518 act->setCheckable(true);
1519 act->setChecked(false);
1520 act->setData(ACTION_SPY_POISON_ESC);
1521 action_vs_city->addAction(act);
1522 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1523
1524 // Civilization menu
1525 main_menu = this->addMenu(_("Civilization"));
1526 act = main_menu->addAction(_("Tax Rates..."));
1527 menu_list.insert(NOT_4_OBS, act);
1528 connect(act, &QAction::triggered, this, &mr_menu::slot_popup_tax_rates);
1529 main_menu->addSeparator();
1530
1531 act = main_menu->addAction(_("Policies..."));
1532 menu_list.insert(MULTIPLIERS, act);
1533 connect(act, &QAction::triggered, this, &mr_menu::slot_popup_mult_rates);
1534 main_menu->addSeparator();
1535
1536 main_menu->addMenu(new class gov_menu(this));
1537 main_menu->addSeparator();
1538
1539 act = main_menu->addAction(Q_("?noun:View"));
1540 act->setShortcut(QKeySequence(tr("F1")));
1541 connect(act, &QAction::triggered, this, &mr_menu::slot_show_map);
1542
1543 act = main_menu->addAction(_("Units"));
1544 act->setShortcut(QKeySequence(tr("F2")));
1545 connect(act, &QAction::triggered, this, &mr_menu::slot_show_units_report);
1546
1547 act = main_menu->addAction(_("Nations"));
1548 act->setShortcut(QKeySequence(tr("F3")));
1549 connect(act, &QAction::triggered, this, &mr_menu::slot_show_nations);
1550
1551 act = main_menu->addAction(_("Cities"));
1552 act->setShortcut(QKeySequence(tr("F4")));
1553 connect(act, &QAction::triggered, this, &mr_menu::slot_show_cities);
1554
1555 act = main_menu->addAction(_("Economy"));
1556 act->setShortcut(QKeySequence(tr("F5")));
1557 connect(act, &QAction::triggered, this, &mr_menu::slot_show_eco_report);
1558
1559 act = main_menu->addAction(_("Research"));
1560 act->setShortcut(QKeySequence(tr("F6")));
1561 connect(act, &QAction::triggered, this, &mr_menu::slot_show_research_tab);
1562
1563 act = main_menu->addAction(_("Wonders of the World"));
1564 act->setShortcut(QKeySequence(tr("F7")));
1565 connect(act, &QAction::triggered, this, &mr_menu::slot_traveler);
1566
1567 act = main_menu->addAction(_("Top Cities"));
1568 act->setShortcut(QKeySequence(tr("F8")));
1569 menu_list.insert(TOP_CITIES, act);
1570 connect(act, &QAction::triggered, this, &mr_menu::slot_top_cities);
1571
1572 act = main_menu->addAction(_("Demographics"));
1573 act->setShortcut(QKeySequence(tr("F11")));
1574 connect(act, &QAction::triggered, this, &mr_menu::slot_demographics);
1575
1576 act = main_menu->addAction(_("Spaceship"));
1577 act->setShortcut(QKeySequence(tr("F12")));
1578 connect(act, &QAction::triggered, this, &mr_menu::slot_spaceship);
1579
1580 act = main_menu->addAction(_("Achievements"));
1581 connect(act, &QAction::triggered, this, &mr_menu::slot_achievements);
1582
1583 act = main_menu->addAction(_("Endgame report"));
1584 menu_list.insert(ENDGAME, act);
1585 connect(act, &QAction::triggered, this, &mr_menu::slot_endgame);
1586
1587 // Battle Groups Menu
1588 main_menu = this->addMenu(_("Battle Groups"));
1589
1590 act = main_menu->addAction(_("Select Battle Group 1"));
1591 act->setShortcut(QKeySequence(tr("Shift+F1")));
1592 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1select);
1593
1594 act = main_menu->addAction(_("Assign Battle Group 1"));
1595 act->setShortcut(QKeySequence(tr("Ctrl+F1")));
1596 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1assign);
1597
1598 act = main_menu->addAction(_("Append to Battle Group 1"));
1599 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F1")));
1600 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1append);
1601
1602 act = main_menu->addAction(_("Select Battle Group 2"));
1603 act->setShortcut(QKeySequence(tr("Shift+F2")));
1604 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2select);
1605
1606 act = main_menu->addAction(_("Assign Battle Group 2"));
1607 act->setShortcut(QKeySequence(tr("Ctrl+F2")));
1608 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2assign);
1609
1610 act = main_menu->addAction(_("Append to Battle Group 2"));
1611 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F2")));
1612 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2append);
1613
1614 act = main_menu->addAction(_("Select Battle Group 3"));
1615 act->setShortcut(QKeySequence(tr("Shift+F3")));
1616 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3select);
1617
1618 act = main_menu->addAction(_("Assign Battle Group 3"));
1619 act->setShortcut(QKeySequence(tr("Ctrl+F3")));
1620 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3assign);
1621
1622 act = main_menu->addAction(_("Append to Battle Group 3"));
1623 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F3")));
1624 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3append);
1625
1626 act = main_menu->addAction(_("Select Battle Group 4"));
1627 act->setShortcut(QKeySequence(tr("Shift+F4")));
1628 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4select);
1629
1630 act = main_menu->addAction(_("Assign Battle Group 4"));
1631 act->setShortcut(QKeySequence(tr("Ctrl+F4")));
1632 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4assign);
1633
1634 act = main_menu->addAction(_("Append to Battle Group 4"));
1635 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F4")));
1636 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4append);
1637
1638 // Help Menu
1639 main_menu = this->addMenu(_("Help"));
1640
1641 act = main_menu->addAction(Q_(HELP_OVERVIEW_ITEM));
1642 QObject::connect(act, &QAction::triggered, [this]() {
1644 });
1645
1646 act = main_menu->addAction(Q_(HELP_PLAYING_ITEM));
1647 QObject::connect(act, &QAction::triggered, [this]() {
1649 });
1650
1651 act = main_menu->addAction(Q_(HELP_TERRAIN_ITEM));
1652 QObject::connect(act, &QAction::triggered, [this]() {
1654 });
1655
1656 act = main_menu->addAction(Q_(HELP_ECONOMY_ITEM));
1657 QObject::connect(act, &QAction::triggered, [this]() {
1659 });
1660
1661 act = main_menu->addAction(Q_(HELP_CITIES_ITEM));
1662 QObject::connect(act, &QAction::triggered, [this]() {
1664 });
1665
1666 act = main_menu->addAction(Q_(HELP_IMPROVEMENTS_ITEM));
1667 QObject::connect(act, &QAction::triggered, [this]() {
1669 });
1670
1671 act = main_menu->addAction(Q_(HELP_WONDERS_ITEM));
1672 QObject::connect(act, &QAction::triggered, [this]() {
1674 });
1675
1676 act = main_menu->addAction(Q_(HELP_UNITS_ITEM));
1677 QObject::connect(act, &QAction::triggered, [this]() {
1679 });
1680
1681 act = main_menu->addAction(Q_(HELP_COMBAT_ITEM));
1682 QObject::connect(act, &QAction::triggered, [this]() {
1684 });
1685
1686 act = main_menu->addAction(Q_(HELP_ZOC_ITEM));
1687 QObject::connect(act, &QAction::triggered, [this]() {
1689 });
1690
1691 act = main_menu->addAction(Q_(HELP_GOVERNMENT_ITEM));
1692 QObject::connect(act, &QAction::triggered, [this]() {
1694 });
1695
1696 act = main_menu->addAction(Q_(HELP_ECONOMY_ITEM));
1697 QObject::connect(act, &QAction::triggered, [this]() {
1699 });
1700
1701 act = main_menu->addAction(Q_(HELP_DIPLOMACY_ITEM));
1702 QObject::connect(act, &QAction::triggered, [this]() {
1704 });
1705
1706 act = main_menu->addAction(Q_(HELP_TECHS_ITEM));
1707 QObject::connect(act, &QAction::triggered, [this]() {
1709 });
1710
1711 act = main_menu->addAction(Q_(HELP_SPACE_RACE_ITEM));
1712 QObject::connect(act, &QAction::triggered, [this]() {
1714 });
1715
1716 act = main_menu->addAction(Q_(HELP_IMPROVEMENTS_ITEM));
1717 QObject::connect(act, &QAction::triggered, [this]() {
1719 });
1720
1721 act = main_menu->addAction(Q_(HELP_RULESET_ITEM));
1722 QObject::connect(act, &QAction::triggered, [this]() {
1724 });
1725
1726 act = main_menu->addAction(Q_(HELP_TILESET_ITEM));
1727 QObject::connect(act, &QAction::triggered, [this]() {
1729 });
1730
1731 act = main_menu->addAction(Q_(HELP_MUSICSET_ITEM));
1732 QObject::connect(act, &QAction::triggered, [this]() {
1734 });
1735
1736 act = main_menu->addAction(Q_(HELP_NATIONS_ITEM));
1737 QObject::connect(act, &QAction::triggered, [this]() {
1739 });
1740
1741 main_menu->addSeparator();
1742
1743 act = main_menu->addAction(Q_(HELP_CONNECTING_ITEM));
1744 QObject::connect(act, &QAction::triggered, [this]() {
1746 });
1747
1748 act = main_menu->addAction(Q_(HELP_CONTROLS_ITEM));
1749 QObject::connect(act, &QAction::triggered, [this]() {
1751 });
1752
1753 act = main_menu->addAction(Q_(HELP_CMA_ITEM));
1754 QObject::connect(act, &QAction::triggered, [this]() {
1756 });
1757
1758 act = main_menu->addAction(Q_(HELP_CHATLINE_ITEM));
1759 QObject::connect(act, &QAction::triggered, [this]() {
1761 });
1762
1763 act = main_menu->addAction(Q_(HELP_WORKLIST_EDITOR_ITEM));
1764 QObject::connect(act, &QAction::triggered, [this]() {
1766 });
1767
1768 main_menu->addSeparator();
1769
1770 act = main_menu->addAction(Q_(HELP_LANGUAGES_ITEM));
1771 QObject::connect(act, &QAction::triggered, [this]() {
1773 });
1774
1775 act = main_menu->addAction(Q_(HELP_COPYING_ITEM));
1776 QObject::connect(act, &QAction::triggered, [this]() {
1778 });
1779
1780 act = main_menu->addAction(Q_(HELP_ABOUT_ITEM));
1781 QObject::connect(act, &QAction::triggered, [this]() {
1783 });
1784
1785 menus = this->findChildren<QMenu*>();
1786 for (i = 0; i < menus.count(); i++) {
1787 menus[i]->setAttribute(Qt::WA_TranslucentBackground);
1788 }
1789
1790 this->setVisible(false);
1791}
1792
1793/**********************************************************************/
1797{
1798 for (int i = 0; i < units_list.nr_units; i++) {
1799 units_list.unit_list.at(units_list.unit_list.count() - i -1)->ptile = ptile;
1800 }
1801}
1802
1803/**********************************************************************/
1809{
1810 foreach (QAction *a, m->actions()) {
1811 if (a->shortcut() == seq && a->isEnabled()) {
1812 a->activate(QAction::Trigger);
1813 return TRUE;
1814 }
1815 }
1816
1817 return FALSE;
1818}
1819
1820/**********************************************************************/
1824{
1828
1829 if (sid == SC_GOTO) {
1830 gui()->mapview_wdg->menu_click = true;
1832 return;
1833 }
1834 fcs = fc_shortcuts::sc()->get_shortcut(static_cast<shortcut_id>(sid));
1836
1838 foreach (const QMenu *m, menus) {
1840 return;
1841 }
1842 }
1843}
1844
1845/**********************************************************************/
1852{
1853 foreach (QAction *a, m->actions()) {
1854 if (a->shortcut() == seq && fcs->mouse == Qt::AllButtons) {
1855 *ret = a->text();
1856
1857 return TRUE;
1858 }
1859 }
1860
1861 return FALSE;
1862}
1863
1864/**********************************************************************/
1868{
1871
1874 foreach (const QMenu *m, menus) {
1875 QString ret;
1876
1877 if (shortcut_exist_inner(m, seq, fcs, &ret)) {
1878 return ret;
1879 }
1880 }
1881
1882 return QString();
1883}
1884
1885/**********************************************************************/
1891 QString *ret)
1892{
1893 foreach (QAction *a, m->actions()) {
1894 if (a->shortcut() == seq) {
1895 *ret = a->text() + " ("
1896 + a->shortcut().toString(QKeySequence::NativeText) + ")";
1897
1898 return TRUE;
1899 }
1900 }
1901
1902 return FALSE;
1903}
1904
1905/**********************************************************************/
1909{
1913
1914 fcs = fc_shortcuts::sc()->get_shortcut(static_cast<shortcut_id>(sid));
1916
1918 foreach (const QMenu *m, menus) {
1919 QString ret;
1920
1922 return ret;
1923 }
1924 }
1925
1926 return QString();
1927}
1928
1929/**********************************************************************/
1933{
1935 QAction *act;
1936 struct player *pplayer;
1937
1938 airlift_menu->clear();
1939 if (client_is_observer()) {
1940 return;
1941 }
1942
1943 pplayer = client_player();
1944 unit_type_iterate(utype) {
1945 utype_id = utype_index(utype);
1946
1947 if (!can_player_build_unit_now(pplayer, utype)
1948 || !utype_can_do_action(utype, ACTION_AIRLIFT)) {
1949 continue;
1950 }
1951 if (!can_player_build_unit_now(pplayer, utype)
1953 continue;
1954 }
1955 // Defeat keyboard shortcut mnemonics
1956 act = airlift_menu->addAction(QString(utype_name_translation(utype))
1957 .replace("&", "&&"));
1958 act->setCheckable(true);
1959 act->setData(utype_id);
1960 if (airlift_type_id == utype_id) {
1961 act->setChecked(true);
1962 }
1963 connect(act, &QAction::triggered, this, &mr_menu::slot_quickairlift_set);
1964 airlift_type->addAction(act);
1966}
1967
1968/****************************************************************************
1969 Updates "build path" menu
1970****************************************************************************/
1972{
1973 QAction *act;
1974 struct unit_list *punits = nullptr;
1975 bool enabled = false;
1976
1977 foreach(act, roads_menu->actions()) {
1978 removeAction(act);
1979 act->deleteLater();
1980 }
1981 roads_menu->clear();
1982 roads_menu->setDisabled(true);
1983 if (client_is_observer()) {
1984 return;
1985 }
1986
1989 if (pextra->buildable) {
1990 int road_id;
1991
1992 // Defeat keyboard shortcut mnemonics
1993 act = roads_menu->addAction(QString(extra_name_translation(pextra))
1994 .replace("&", "&&"));
1995 road_id = pextra->id;
1996 act->setData(road_id);
1997 QObject::connect(act, &QAction::triggered, [this,road_id]() {
1999 });
2001 ACTIVITY_GEN_ROAD, pextra)) {
2002 act->setEnabled(true);
2003 enabled = true;
2004 } else {
2005 act->setDisabled(true);
2006 }
2007 }
2009
2010 if (enabled) {
2011 roads_menu->setEnabled(true);
2012 }
2013}
2014
2015/****************************************************************************
2016 Updates "build bases" menu
2017****************************************************************************/
2019{
2020 QAction *act;
2021 struct unit_list *punits = nullptr;
2022 bool enabled = false;
2023
2024 foreach(act, bases_menu->actions()) {
2025 removeAction(act);
2026 act->deleteLater();
2027 }
2028 bases_menu->clear();
2029 bases_menu->setDisabled(true);
2030
2031 if (client_is_observer()) {
2032 return;
2033 }
2034
2037 if (pextra->buildable) {
2038 int base_id;
2039
2040 // Defeat keyboard shortcut mnemonics
2041 act = bases_menu->addAction(QString(extra_name_translation(pextra))
2042 .replace("&", "&&"));
2043 base_id = pextra->id;
2044 act->setData(base_id);
2045 QObject::connect(act, &QAction::triggered, [this,base_id]() {
2047 });
2049 act->setEnabled(true);
2050 enabled = true;
2051 } else {
2052 act->setDisabled(true);
2053 }
2054 }
2056
2057 if (enabled) {
2058 bases_menu->setEnabled(true);
2059 }
2060}
2061
2062/**********************************************************************/
2066{
2067 QList <QAction * >values;
2069 QMultiHash <munit, QAction *>::iterator i;
2070 struct unit_list *punits = nullptr;
2071 struct road_type *proad;
2072 struct extra_type *tgt;
2073 bool any_cities = false;
2074 bool city_on_tile = false;
2075 bool units_all_same_tile = true;
2076 const struct tile *ptile = nullptr;
2077 const struct unit_type *ptype = nullptr;
2078
2079 players_iterate(pplayer) {
2080 if (city_list_size(pplayer->cities)) {
2081 any_cities = true;
2082 break;
2083 }
2085
2086 // Disable first all sensitive menus
2087 foreach(QAction *a, menu_list) {
2088 a->setEnabled(false);
2089 }
2090
2091 if (client_is_observer()) {
2092 multiplayer_menu->setDisabled(true);
2093 } else {
2094 multiplayer_menu->setDisabled(false);
2095 }
2096
2097 // Non unit menus
2098 keys = menu_list.keys();
2099 foreach (munit key, keys) {
2100 i = menu_list.find(key);
2101 while (i != menu_list.end() && i.key() == key) {
2102 switch (key) {
2103 case SAVE:
2105 i.value()->setEnabled(true);
2106 }
2107 break;
2108 case NOT_4_OBS:
2109 if (!client_is_observer()) {
2110 i.value()->setEnabled(true);
2111 }
2112 break;
2113 case MULTIPLIERS:
2114 if (!client_is_observer() && multiplier_count() > 0) {
2115 i.value()->setEnabled(true);
2116 i.value()->setVisible(true);
2117 } else {
2118 i.value()->setVisible(false);
2119 }
2120 break;
2121 case ENDGAME:
2122 if (gui()->is_repo_dlg_open("END")) {
2123 i.value()->setEnabled(true);
2124 i.value()->setVisible(true);
2125 } else {
2126 i.value()->setVisible(false);
2127 }
2128 break;
2129 case TOP_CITIES:
2130 i.value()->setEnabled(game.info.top_cities_count > 0);
2131 if (game.info.top_cities_count > 0) {
2132 i.value()->setText(QString(PL_("Top %1 City", "Top %1 Cities",
2134 .arg(game.info.top_cities_count));
2135 } else {
2136 i.value()->setText(QString(_("Top Cities")));
2137 }
2138 break;
2139 default:
2140 break;
2141 }
2142 i++;
2143 }
2144 }
2145
2147 return;
2148 }
2149
2152 if (tile_city(unit_tile(punit))) {
2153 city_on_tile = true;
2154 break;
2155 }
2157
2159 const struct unit_type *ntype;
2160
2161 fc_assert((ptile == nullptr) == (ptype == nullptr));
2162
2164
2165 // 'ntype == ptype' is correct check even when ptype is still nullptr
2166 if (ptile != nullptr && ntype == ptype && unit_tile(punit) != ptile) {
2167 units_all_same_tile = false;
2168 }
2169
2170 if (ptype == nullptr || ntype == ptype) {
2171 ptile = unit_tile(punit);
2172 ptype = ntype;
2173 }
2175
2176 keys = menu_list.keys();
2177 foreach(munit key, keys) {
2178 i = menu_list.find(key);
2179 while (i != menu_list.end() && i.key() == key) {
2180 switch (key) {
2181 case STANDARD:
2182 i.value()->setEnabled(true);
2183 break;
2184
2185 case EXPLORE:
2187 i.value()->setEnabled(true);
2188 }
2189 break;
2190
2191 case BOARD:
2192 if (units_can_load(punits)) {
2193 i.value()->setEnabled(true);
2194 }
2195 break;
2196
2197 case DEBOARD:
2198 if (units_can_unload(&(wld.map), punits)) {
2199 i.value()->setEnabled(true);
2200 }
2201 break;
2202
2203 case TRANSPORTER:
2205 i.value()->setEnabled(true);
2206 }
2207 break;
2208
2209 case CONVERT:
2210 if (units_can_convert(&(wld.map), punits)) {
2211 i.value()->setEnabled(true);
2212 }
2213 break;
2214
2215 case MINE:
2217 i.value()->setEnabled(true);
2218 }
2219
2220 if (units_all_same_tile) {
2222 struct extra_type *pextra = nullptr;
2223
2224 /* FIXME: this overloading doesn't work well with multiple focus
2225 * units. */
2229 if (pextra != nullptr) {
2230 break;
2231 }
2233
2234 if (pextra != nullptr) {
2235 i.value()->setText(
2236 // TRANS: Build mine of specific type
2237 QString(_("Build %1"))
2238 .arg(extra_name_translation(pextra))
2239 .replace("&", "&&"));
2240 } else {
2241 i.value()->setText(QString(_("Build Mine")));
2242 }
2243 } else {
2244 i.value()->setText(QString(_("Build Mine")));
2245 }
2246 }
2247 break;
2248
2249 case IRRIGATION:
2251 i.value()->setEnabled(true);
2252 }
2253 if (units_all_same_tile) {
2255 struct extra_type *pextra = nullptr;
2256
2257 /* FIXME: this overloading doesn't work well with multiple focus
2258 * units. */
2262 if (pextra != nullptr) {
2263 break;
2264 }
2266
2267 if (pextra != nullptr) {
2268 i.value()->setText(
2269 // TRANS: Build irrigation of specific type
2270 QString(_("Build %1"))
2271 .arg(extra_name_translation(pextra))
2272 .replace("&", "&&"));
2273 } else {
2274 i.value()->setText(QString(_("Build Irrigation")));
2275 }
2276 } else {
2277 i.value()->setText(QString(_("Build Irrigation")));
2278 }
2279 }
2280 break;
2281
2282 case CULTIVATE:
2284 i.value()->setEnabled(true);
2285 }
2286 if (units_all_same_tile) {
2287 struct unit *punit = unit_list_get(punits, 0);
2288 struct tile *atile = unit_tile(punit);
2289 struct terrain *pterrain = tile_terrain(atile);
2290
2291 if (pterrain->cultivate_result != T_NONE) {
2292 i.value()->setText(
2293 // TRANS: Transform terrain to specific type
2294 QString(_("Cultivate to %1"))
2296 .replace("&", "&&"));
2297 } else {
2298 i.value()->setText(QString(_("Cultivate")));
2299 }
2300 } else {
2301 i.value()->setText(QString(_("Cultivate")));
2302 }
2303 break;
2304
2305 case PLANT:
2307 i.value()->setEnabled(true);
2308 }
2309 if (units_all_same_tile) {
2310 struct unit *punit = unit_list_get(punits, 0);
2311 struct tile *atile = unit_tile(punit);
2312 struct terrain *pterrain = tile_terrain(atile);
2313
2314 if (pterrain->plant_result != T_NONE) {
2315 i.value()->setText(
2316 // TRANS: Transform terrain to specific type
2317 QString(_("Plant to %1"))
2319 .replace("&", "&&"));
2320 } else {
2321 i.value()->setText(QString(_("Plant")));
2322 }
2323 } else {
2324 i.value()->setText(QString(_("Plant")));
2325 }
2326 break;
2327
2328 case TRANSFORM:
2330 i.value()->setEnabled(true);
2331 } else {
2332 break;
2333 }
2334 if (units_all_same_tile) {
2335 struct unit *punit = unit_list_get(punits, 0);
2336 struct tile *atile = unit_tile(punit);
2337 struct terrain *pterrain = tile_terrain(atile);
2338
2339 if (pterrain->transform_result != T_NONE
2340 && pterrain->transform_result != pterrain) {
2341 i.value()->setText(
2342 // TRANS: Transform terrain to specific type
2343 QString(_("Transform to %1"))
2345 .replace("&", "&&"));
2346 } else {
2347 i.value()->setText(_("Transform Terrain"));
2348 }
2349 }
2350 break;
2351
2352 case BUILD:
2355 i.value()->setEnabled(true);
2356 }
2357 if (city_on_tile
2359 i.value()->setText(
2361 .replace("&", "&&"));
2362 } else {
2363 i.value()->setText(
2365 .replace("&", "&&"));
2366 }
2367 break;
2368
2369 case ROAD:
2370 {
2371 struct extra_type *pextra = nullptr;
2372
2374 i.value()->setEnabled(true);
2375 }
2379 if (pextra != nullptr) {
2380 break;
2381 }
2383
2384 if (pextra != nullptr) {
2385 i.value()->setText(
2386 // TRANS: Build road of specific type
2387 QString(_("Build %1"))
2388 .arg(extra_name_translation(pextra))
2389 .replace("&", "&&"));
2390 }
2391 }
2392 break;
2393
2394 case FORTIFY:
2396 i.value()->setEnabled(true);
2397 }
2398 break;
2399
2400 case FORTRESS:
2402 i.value()->setEnabled(true);
2403 }
2404 break;
2405
2406 case AIRBASE:
2408 i.value()->setEnabled(true);
2409 }
2410 break;
2411
2412 case CLEAN:
2414 i.value()->setEnabled(true);
2415 }
2416 break;
2417
2418 case SENTRY:
2420 i.value()->setEnabled(true);
2421 }
2422 break;
2423
2424 case PARADROP:
2426 i.value()->setEnabled(true);
2428 .replace("&", "&&"));
2429 }
2430 break;
2431
2432 case PILLAGE:
2434 i.value()->setEnabled(true);
2435 }
2436 break;
2437
2438 case HOMECITY:
2440 i.value()->setEnabled(true);
2441 }
2442 break;
2443
2444 case WAKEUP:
2446 i.value()->setEnabled(true);
2447 }
2448 break;
2449
2450 case AUTOWORKER:
2452 i.value()->setEnabled(true);
2453 }
2455 i.value()->setText(_("Auto Settler"));
2456 } else {
2457 i.value()->setText(_("Auto Worker"));
2458 }
2459 break;
2460 case CONNECT_ROAD:
2462 if (proad != nullptr) {
2463 tgt = road_extra_get(proad);
2464 } else {
2465 break;
2466 }
2468 i.value()->setEnabled(true);
2469 }
2470 break;
2471
2472 case DISBAND:
2474 i.value()->setEnabled(true);
2475 }
2476 break;
2477
2478 case CONNECT_RAIL:
2480 if (proad != nullptr) {
2481 tgt = road_extra_get(proad);
2482 } else {
2483 break;
2484 }
2486 i.value()->setEnabled(true);
2487 }
2488 break;
2489
2490 case CONNECT_MAGLEV:
2492 if (proad != nullptr) {
2493 tgt = road_extra_get(proad);
2494 } else {
2495 break;
2496 }
2498 i.value()->setEnabled(true);
2499 }
2500 break;
2501
2502 case CONNECT_IRRIGATION:
2503 {
2505
2506 if (extra_type_list_size(extras) > 0) {
2507 struct extra_type *pextra;
2508
2511 i.value()->setEnabled(true);
2512 }
2513 }
2514 }
2515 break;
2516
2517 case GOTO_CITY:
2518 if (any_cities) {
2519 i.value()->setEnabled(true);
2520 }
2521 break;
2522
2523 case AIRLIFT:
2524 if (any_cities) {
2525 i.value()->setEnabled(true);
2526 }
2527 break;
2528
2529 case BUILD_WONDER:
2530 i.value()->setText(
2532 .replace("&", "&&"));
2534 i.value()->setEnabled(true);
2535 }
2536 break;
2537
2538 case AUTOTRADEROUTE:
2540 i.value()->setEnabled(true);
2541 }
2542 break;
2543
2544 case ORDER_TRADE_ROUTE:
2545 i.value()->setText(
2547 .replace("&", "&&"));
2549 i.value()->setEnabled(true);
2550 }
2551 break;
2552
2553 case ORDER_DIPLOMAT_DLG:
2555 i.value()->setEnabled(true);
2556 }
2557 break;
2558
2559 case UPGRADE:
2560 if (units_can_upgrade(&(wld.map), punits)) {
2561 i.value()->setEnabled(true);
2562 }
2563 break;
2564 default:
2565 break;
2566 }
2567
2568 i++;
2569 }
2570 }
2571}
2572
2573/**********************************************************************/
2580
2581/**********************************************************************/
2585{
2586 struct player *pplayer = client_player();
2587
2588 if (pplayer != nullptr) {
2589 popup_spaceship_dialog(pplayer);
2590 }
2591}
2592
2593/**********************************************************************/
2600
2601/**********************************************************************/
2605{
2606 ::gui()->game_tab_widget->setCurrentIndex(0);
2607}
2608
2609/**********************************************************************/
2616
2617/**********************************************************************/
2621{
2622 popup_players_dialog(false);
2623}
2624
2625/**********************************************************************/
2632
2633/**********************************************************************/
2637{
2639 /* FIXME: this can provide different actions for different units...
2640 * not good! */
2641 /* Enable the button for adding to a city in all cases, so we
2642 get an eventual error message from the server if we try. */
2647 }
2649}
2650
2651/**********************************************************************/
2655{
2657 struct extra_type *pextra;
2658
2661
2662 if (pextra != nullptr) {
2664 }
2666}
2667
2668/**********************************************************************/
2683
2684/**********************************************************************/
2688{
2690
2691 if (prail != nullptr) {
2692 struct extra_type *tgt;
2693
2694 tgt = road_extra_get(prail);
2696 }
2697}
2698
2699/**********************************************************************/
2703{
2705
2706 if (pmaglev != nullptr) {
2707 struct extra_type *tgt;
2708
2709 tgt = road_extra_get(pmaglev);
2711 }
2712}
2713
2714/**********************************************************************/
2721
2722/**********************************************************************/
2729
2730/**********************************************************************/
2734{
2736
2737 if (proad != nullptr) {
2738 struct extra_type *tgt;
2739
2740 tgt = road_extra_get(proad);
2742 }
2743}
2744
2745/**********************************************************************/
2752
2753/**********************************************************************/
2764
2765/**********************************************************************/
2769{
2771}
2772
2773/**********************************************************************/
2780
2781/**********************************************************************/
2788
2789/**********************************************************************/
2793{
2795 /* FIXME: this can provide different actions for different units...
2796 * not good! */
2798 EC_ROAD,
2800 punit);
2801 bool building_road = false;
2802
2803 if (tgt != nullptr
2806 building_road = true;
2807 }
2808
2811 }
2813}
2814
2815/**********************************************************************/
2822
2823/**********************************************************************/
2830
2831/**********************************************************************/
2835{
2836 key_unit_mine();
2837}
2838
2839/**********************************************************************/
2843{
2845}
2846
2847/**********************************************************************/
2854
2855/**********************************************************************/
2862
2863/**********************************************************************/
2867{
2869}
2870
2871/**********************************************************************/
2878
2879/**********************************************************************/
2883{
2884 delayed_order = false;
2885 units_list.clear();
2886}
2887
2888/**********************************************************************/
2892{
2893 gui()->rallies.hover_tile = false;
2894 gui()->rallies.hover_city = true;
2895}
2896
2897/**********************************************************************/
2901{
2902 gui()->trade_gen.hover_city = true;
2903}
2904
2905/**********************************************************************/
2909{
2910 gui()->trade_gen.add_all_cities();
2911}
2912
2913/**********************************************************************/
2917{
2918 gui()->trade_gen.calculate();
2919}
2920
2921/**********************************************************************/
2925{
2926 gui()->trade_gen.clear_trade_planing();
2927}
2928
2929/**********************************************************************/
2933{
2934 qtiles gilles;
2935 struct unit *punit;
2936 struct city *homecity;
2937 struct tile *home_tile;
2938 struct tile *dest_tile;
2939 bool sent = false;
2940
2942 homecity = game_city_by_number(punit->homecity);
2943 home_tile = homecity->tile;
2944 foreach(gilles, gui()->trade_gen.lines) {
2945 if ((gilles.t1 == home_tile || gilles.t2 == home_tile)
2946 && gilles.autocaravan == nullptr) {
2947 // Send caravan
2948 if (gilles.t1 == home_tile) {
2949 dest_tile = gilles.t2;
2950 } else {
2951 dest_tile = gilles.t1;
2952 }
2953 if (send_goto_tile(punit, dest_tile)) {
2954 int i;
2955 i = gui()->trade_gen.lines.indexOf(gilles);
2956 gilles = gui()->trade_gen.lines.takeAt(i);
2957 gilles.autocaravan = punit;
2958 gui()->trade_gen.lines.append(gilles);
2959 sent = true;
2960 break;
2961 }
2962 }
2963 }
2964
2965 if (!sent) {
2966 gui()->infotab->chtwdg->append(_("Didn't find any trade route"
2967 " to establish"));
2968 }
2969}
2970
2971/**********************************************************************/
2975{
2976 QVariant v;
2977 QAction *act;
2978
2980 v = act->data();
2981 airlift_type_id = v.toInt();
2982}
2983
2984/**********************************************************************/
2988{
2989 QAction *act;
2990
2992 qdef_act::action()->vs_unit_set(act->data().toInt());
2993}
2994
2995/**********************************************************************/
2999{
3000 QAction *act;
3001
3003 qdef_act::action()->vs_city_set(act->data().toInt());
3004}
3005
3006/**********************************************************************/
3010{
3011 quick_airlifting = true;
3012}
3013
3014/**********************************************************************/
3018{
3020 int i = 0;
3022
3023 delayed_order = true;
3024 dg = D_GOTO;
3025
3026 struct unit_list *punits = get_units_in_focus();
3027 if (unit_list_size(punits) == 0) {
3028 return;
3029 }
3030 if (hover_state != HOVER_GOTO) {
3035 control_mouse_cursor(nullptr);
3036 }
3038 i++;
3043}
3044
3045/**********************************************************************/
3049{
3051 struct unit *punit;
3052 struct tile *last_tile;
3053 struct tile *new_tile;
3054 int i = 0;
3055
3056 foreach (fui, units_list.unit_list) {
3057 i++;
3058 punit = unit_list_find(client_player()->units, fui->id);
3059 if (punit == nullptr) {
3060 continue;
3061 }
3062 last_tile = punit->tile;
3064 if (new_tile != nullptr) {
3065 punit->tile = new_tile;
3066 }
3067 if (is_tiles_adjacent(punit->tile, fui->ptile)) {
3070 punit->tile,
3071 fui->ptile));
3072 } else {
3073 send_attack_tile(punit, fui->ptile);
3074 }
3075 punit->tile = last_tile;
3076 }
3077 units_list.clear();
3078}
3079
3080/**********************************************************************/
3089
3090/**********************************************************************/
3094{
3096}
3097
3098/**********************************************************************/
3107
3108/**********************************************************************/
3112{
3114}
3115
3116/**********************************************************************/
3123
3124/**********************************************************************/
3133
3134/**********************************************************************/
3141
3142/**********************************************************************/
3149
3150/**********************************************************************/
3157
3158/**********************************************************************/
3162{
3163 key_unit_goto();
3164}
3165
3166/**********************************************************************/
3173
3174/**********************************************************************/
3181
3182/**********************************************************************/
3186{
3187 if (gui()->interface_locked) {
3188 enable_interface(false);
3189 } else {
3190 enable_interface(true);
3191 }
3192 gui()->interface_locked = !gui()->interface_locked;
3193}
3194
3195/**********************************************************************/
3199{
3203 int i;
3204
3205 lc = gui()->findChildren<close_widget *>();
3206 lm = gui()->findChildren<move_widget *>();
3207 lr = gui()->findChildren<resize_widget *>();
3208
3209 for (i = 0; i < lc.size(); ++i) {
3210 lc.at(i)->setVisible(!enable);
3211 }
3212 for (i = 0; i < lm.size(); ++i) {
3213 lm.at(i)->setVisible(!enable);
3214 }
3215 for (i = 0; i < lr.size(); ++i) {
3216 lr.at(i)->setVisible(!enable);
3217 }
3218}
3219
3220/**********************************************************************/
3224{
3226
3227 gui()->apply_fullscreen();
3228}
3229
3230/**********************************************************************/
3234{
3235 if (minimap_status->isChecked()) {
3236 ::gui()->minimapview_wdg->show();
3237 } else {
3238 ::gui()->minimapview_wdg->hide();
3239 }
3240}
3241
3242/**********************************************************************/
3246{
3247 if (osd_status->isChecked()) {
3248 gui()->qt_settings.show_new_turn_text = true;
3249 } else {
3250 gui()->qt_settings.show_new_turn_text = false;
3251 }
3252}
3253
3254/**********************************************************************/
3258{
3259 if (btlog_status->isChecked()) {
3260 gui()->qt_settings.show_battle_log = true;
3261 } else {
3262 gui()->qt_settings.show_battle_log = false;
3263 }
3264}
3265
3266/**********************************************************************/
3273
3274/**********************************************************************/
3281
3282/**********************************************************************/
3289
3290/**********************************************************************/
3297
3298/**********************************************************************/
3302{
3303 gui()->map_scale = gui()->map_scale * 1.2f;
3304 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3305}
3306
3307/**********************************************************************/
3311{
3312 QFont *qf;
3313
3314 gui()->map_scale = 1.0f;
3316 qf->setPointSize(fc_font::instance()->city_fontsize);
3318 qf->setPointSize(fc_font::instance()->prod_fontsize);
3319 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3320}
3321
3322/**********************************************************************/
3326{
3327 QFont *qf;
3328
3329 if (scale_fonts_status->isChecked()) {
3330 gui()->map_font_scale = true;
3331 } else {
3333 qf->setPointSize(fc_font::instance()->city_fontsize);
3335 qf->setPointSize(fc_font::instance()->prod_fontsize);
3336 gui()->map_font_scale = false;
3337 }
3339}
3340
3341/**********************************************************************/
3345{
3346 gui()->map_scale = gui()->map_scale / 1.2f;
3347 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3348}
3349
3350/**********************************************************************/
3357
3358/**********************************************************************/
3365
3366/**********************************************************************/
3373
3374/**********************************************************************/
3381
3382/**********************************************************************/
3389
3390/**********************************************************************/
3397
3398/**********************************************************************/
3405
3406/**********************************************************************/
3413
3414/**********************************************************************/
3418{
3419 key_unit_done();
3420}
3421
3422/**********************************************************************/
3429
3430/**********************************************************************/
3437
3438/**********************************************************************/
3447
3448/**********************************************************************/
3457
3458/**********************************************************************/
3465
3466/**********************************************************************/
3470{
3471 key_unit_wait();
3472}
3473
3474/**********************************************************************/
3478{
3480
3481 uhs = new unit_hud_selector(gui()->central_wdg);
3482 uhs->show_me();
3483}
3484
3485/**********************************************************************/
3492
3493/**********************************************************************/
3500
3501/**********************************************************************/
3508
3509/**********************************************************************/
3516
3517/**********************************************************************/
3524
3525/**********************************************************************/
3532
3533/**********************************************************************/
3540
3541/**********************************************************************/
3548
3549/**********************************************************************/
3556
3557/**********************************************************************/
3564
3565/**********************************************************************/
3572
3573/**********************************************************************/
3580
3581/**********************************************************************/
3588
3589/**********************************************************************/
3596
3597/**********************************************************************/
3604
3605/**********************************************************************/
3612
3613/**********************************************************************/
3620
3621/**********************************************************************/
3625{
3626 QDialog *dialog = new QDialog(this);
3627 QLabel *label;
3628 QPushButton *but;
3630 const struct strvec *tlset_list;
3631 const struct option *poption;
3633 QString s;
3634
3635 sl << "default_tileset_overhead_name" << "default_tileset_iso_name"
3636 << "default_tileset_hex_name" << "default_tileset_isohex_name";
3637 layout = new QVBoxLayout;
3638 dialog->setWindowTitle(_("Available tilesets"));
3639 label = new QLabel;
3640 label->setText(_("Some tilesets might not be compatible with current"
3641 " map topology!"));
3642 layout->addWidget(label);
3643
3644 foreach (s, sl) {
3646
3647 on_bytes = s.toUtf8();
3650 strvec_iterate(tlset_list, value) {
3651 but = new QPushButton(value);
3652 connect(but, &QAbstractButton::clicked, this, &mr_menu::load_new_tileset);
3653 layout->addWidget(but);
3655 }
3656 dialog->setSizeGripEnabled(true);
3657 dialog->setLayout(layout);
3658 dialog->show();
3659}
3660
3661/**********************************************************************/
3665{
3666 QPushButton *but;
3668
3670 tn_bytes = but->text().toUtf8();
3671 tilespec_reread(tn_bytes.data(), true, 1.0f);
3672 gui()->map_scale = 1.0f;
3673 but->parentWidget()->close();
3674}
3675
3676/**********************************************************************/
3680{
3681 gui()->trade_gen.calculate();
3682}
3683
3684/**********************************************************************/
3691
3692/**********************************************************************/
3699
3700/**********************************************************************/
3703void mr_menu::slot_help(const QString &topic)
3704{
3705 popup_help_dialog_typed(Q_(topic.toStdString().c_str()), HELP_ANY);
3706}
3707
3708/****************************************************************
3709 Actions "BUILD_PATH_*"
3710*****************************************************************/
3723
3724/****************************************************************
3725 Actions "BUILD_BASE_*"
3726*****************************************************************/
3728{
3731 if (pextra->buildable && pextra->id == id
3733 pextra)) {
3735 }
3738}
3739
3740
3741
3742/**********************************************************************/
3746{
3747 gui()->popup_client_options();
3748}
3749
3750/**********************************************************************/
3757
3758/**********************************************************************/
3762{
3763 gui()->pr_options->popup_server_options();
3764}
3765
3766/**********************************************************************/
3773
3774/**********************************************************************/
3778{
3779 options_save(nullptr);
3780}
3781
3782/**********************************************************************/
3786{
3788}
3789
3790/**********************************************************************/
3794{
3797 QString path, storage_path;
3798 hud_message_box *saved = new hud_message_box(gui()->central_wdg);
3799 bool map_saved;
3801
3804 current_width = gui()->mapview_wdg->width();
3805 current_height = gui()->mapview_wdg->height();
3806 if (tileset_hex_width(tileset) > 0) {
3807 full_size_y = full_size_y * 11 / 20;
3808 } else if (tileset_is_isometric(tileset)) {
3810 }
3812 img_name = QString("Freeciv-Turn%1").arg(game.info.turn);
3813 if (client_has_player()) {
3814 img_name = img_name + "-"
3816 }
3818 path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
3819 if (!storage_path.isEmpty() && QDir(storage_path).isReadable()) {
3821 } else if (!path.isEmpty()) {
3822 img_name = path + DIR_SEPARATOR + img_name;
3823 } else {
3824 img_name = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
3826 }
3827 map_saved = mapview.store->map_pixmap.save(img_name, "png");
3829 saved->setStandardButtons(QMessageBox::Ok);
3830 saved->setDefaultButton(QMessageBox::Cancel);
3831 saved->setAttribute(Qt::WA_DeleteOnClose);
3832 if (map_saved) {
3833 saved->set_text_title("Image saved as:\n" + img_name, _("Success"));
3834 } else {
3835 saved->set_text_title(_("Failed to save image of the map"), _("Error"));
3836 }
3837 saved->show();
3838}
3839
3840/**********************************************************************/
3844{
3845 send_save_game(nullptr);
3846}
3847
3848/**********************************************************************/
3852{
3853 QString str;
3854 QString current_file;
3855 QString location;
3856
3858 location = dirname;
3859 // choose last location
3861
3862 str = QString(_("Save Games"))
3863 + QString(" (*.sav *.sav.bz2 *.sav.gz *.sav.xz)");
3864 current_file = QFileDialog::getSaveFileName(gui()->central_wdg,
3865 _("Save Game As..."),
3866 location, str);
3867 if (!current_file.isEmpty()) {
3869
3870 cf_bytes = current_file.toUtf8();
3871 send_save_game(cf_bytes.data());
3872 }
3873}
3874
3875/**********************************************************************/
3879{
3881
3882 if (is_server_running()) {
3883 ask = new hud_message_box(gui()->central_wdg);
3884 ask->set_text_title(_("Leaving a local game will end it!"), "Leave game");
3885 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
3886 ask->setDefaultButton(QMessageBox::Cancel);
3887 ask->setAttribute(Qt::WA_DeleteOnClose);
3888
3889 connect(ask, &hud_message_box::accepted, [=]() {
3890 if (client.conn.used) {
3891 disconnect_from_server(TRUE);
3892 }
3893 });
3894 ask->show();
3895 } else {
3897 }
3898}
3899
3900/**********************************************************************/
3904{
3905 hud_message_box* ask = new hud_message_box(gui()->central_wdg);
3906
3907 ask->setIcon(QMessageBox::Warning);
3908 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
3909 ask->setDefaultButton(QMessageBox::Cancel);
3910 ask->setAttribute(Qt::WA_DeleteOnClose);
3911 return (ask->set_text_title(_("Selection will cancel current assignments!"),
3912 _("Confirm Disruptive Selection"), true)
3913 == QMessageBox::Ok);
3914}
3915
3916/**********************************************************************/
3920{
3921 struct tile *ptile;
3922
3924 if (get_city_bonus(pcity, EFT_AIRLIFT) > 0) {
3925 ptile = city_tile(pcity);
3926 unit_list_iterate(ptile->units, punit) {
3927 if (punit->utype == utype_by_number(ut)) {
3929 break;
3930 }
3932 }
3934}
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1250
const char * action_name_translation(const struct action *paction)
Definition actions.c:1230
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1119
bool actions_are_ready(void)
Definition actions.c:942
#define action_noninternal_iterate_end
Definition actions.h:236
static struct action * action_by_number(action_id act_id)
Definition actions.h:396
#define action_id_get_actor_kind(act_id)
Definition actions.h:409
#define ACTION_ANY
Definition actions.h:52
#define action_noninternal_iterate(_act_)
Definition actions.h:231
#define action_id_get_target_kind(act_id)
Definition actions.h:413
#define action_id_has_complex_target(act_id)
Definition actions.h:431
#define ACTION_NONE
Definition actions.h:55
bool actres_removes_extra(enum action_result result, const struct extra_type *pextra)
Definition actres.c:810
bool actres_creates_extra(enum action_result result, const struct extra_type *pextra)
Definition actres.c:789
#define str
Definition astring.c:76
#define n
Definition astring.c:77
void output_window_append(const struct ft_color color, const char *featured_text)
struct city * create_city_virtual(struct player *pplayer, struct tile *ptile, const char *name)
Definition city.c:3455
void destroy_city_virtual(struct city *pcity)
Definition city.c:3541
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:767
#define city_list_iterate(citylist, pcity)
Definition city.h:505
#define city_tile(_pcity_)
Definition city.h:561
#define city_list_iterate_end
Definition city.h:507
static fc_font * instance()
Definition fonts.cpp:41
QFont * get_font(QString name)
Definition fonts.cpp:63
static fc_shortcuts * sc()
fc_shortcut * get_shortcut(shortcut_id id)
static void update_all()
Definition menu.cpp:897
virtual ~go_act_menu()
Definition menu.cpp:709
void start_go_act(int act_id, int sub_tgt_id)
Definition menu.cpp:874
void reset()
Definition menu.cpp:718
static QSet< go_act_menu * > instances
Definition menu.h:237
void update()
Definition menu.cpp:834
go_act_menu(QWidget *parent=nullptr)
Definition menu.cpp:699
static void reset_all()
Definition menu.cpp:887
void create()
Definition menu.cpp:730
QMap< QAction *, int > items
Definition menu.h:239
static QSet< gov_menu * > instances
Definition menu.h:212
virtual ~gov_menu()
Definition menu.cpp:580
static void create_all()
Definition menu.cpp:679
void revolution()
Definition menu.cpp:658
QVector< QAction * > actions
Definition menu.h:214
static void update_all()
Definition menu.cpp:689
void change_gov(int target_gov)
Definition menu.cpp:666
gov_menu(QWidget *parent=0)
Definition menu.cpp:569
void create()
Definition menu.cpp:589
void update()
Definition menu.cpp:630
bool shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq, QString *ret)
Definition menu.cpp:1890
void slot_unit_sentry()
Definition menu.cpp:2858
QActionGroup * action_vs_city
Definition menu.h:267
void slot_bg3select()
Definition menu.cpp:3576
void slot_auto_worker()
Definition menu.cpp:2784
void slot_traveler()
Definition menu.cpp:3520
bool execute_shortcut_inner(const QMenu *m, QKeySequence seq)
Definition menu.cpp:1808
void slot_delayed_goto()
Definition menu.cpp:3017
void zoom_in()
Definition menu.cpp:3301
void slot_autocaravan()
Definition menu.cpp:2932
QMenu * multiplayer_menu
Definition menu.h:264
void slot_build_irrigation()
Definition menu.cpp:2818
void slot_execute_orders()
Definition menu.cpp:3048
void update_bases_menu()
Definition menu.cpp:2018
QString shortcut_exist(fc_shortcut *fcs)
Definition menu.cpp:1867
void tileset_custom_load()
Definition menu.cpp:3624
void update_roads_menu()
Definition menu.cpp:1971
void slot_calculate()
Definition menu.cpp:2916
void slot_conn_road()
Definition menu.cpp:2733
void slot_conn_irrigation()
Definition menu.cpp:2671
QMenu * bases_menu
Definition menu.h:263
QActionGroup * airlift_type
Definition menu.h:266
void slot_quickairlift_set()
Definition menu.cpp:2974
void slot_battlelog()
Definition menu.cpp:3257
QMultiHash< munit, QAction * > menu_list
Definition menu.h:271
void slot_trade_add_all()
Definition menu.cpp:2908
void update_airlift_menu()
Definition menu.cpp:1932
void slot_show_cities()
Definition menu.cpp:2628
void slot_transform()
Definition menu.cpp:2748
void slot_top_cities()
Definition menu.cpp:3512
void slot_action_vs_unit()
Definition menu.cpp:2987
void slot_achievements()
Definition menu.cpp:3496
void slot_show_research_tab()
Definition menu.cpp:2576
void shortcut_options()
Definition menu.cpp:3753
void slot_city_output()
Definition menu.cpp:3369
void slot_show_eco_report()
Definition menu.cpp:2596
QMenu * airlift_menu
Definition menu.h:262
QAction * osd_status
Definition menu.h:287
void slot_bg1select()
Definition menu.cpp:3528
void slot_unload_all()
Definition menu.cpp:3137
void slot_airlift()
Definition menu.cpp:3111
void slot_select_same_continent()
Definition menu.cpp:3441
void slot_city_production()
Definition menu.cpp:3377
void slot_set_home()
Definition menu.cpp:3119
QAction * lock_status
Definition menu.h:286
void slot_native_tiles()
Definition menu.cpp:3277
void slot_unit_explore()
Definition menu.cpp:3169
void slot_bg4assign()
Definition menu.cpp:3608
void slot_bg1append()
Definition menu.cpp:3544
void slot_upgrade()
Definition menu.cpp:3153
void execute_shortcut(int sid)
Definition menu.cpp:1823
void slot_popup_mult_rates()
Definition menu.cpp:3695
void slot_select_same_everywhere()
Definition menu.cpp:3451
void slot_map_grid()
Definition menu.cpp:3409
void slot_unit_filter()
Definition menu.cpp:3477
void slot_bg2select()
Definition menu.cpp:3552
void slot_done_moving()
Definition menu.cpp:3417
void calc_trade_routes()
Definition menu.cpp:3679
void slot_city_buycost()
Definition menu.cpp:3285
void slot_action()
Definition menu.cpp:2776
void slot_bg4append()
Definition menu.cpp:3616
QMenu * roads_menu
Definition menu.h:265
QAction * minimap_status
Definition menu.h:284
bool shortcut_exist_inner(const QMenu *m, QKeySequence seq, fc_shortcut *fcs, QString *ret)
Definition menu.cpp:1850
void slot_select_all_tile()
Definition menu.cpp:3425
void save_game()
Definition menu.cpp:3843
struct tile * find_last_unit_pos(struct unit *punit, int pos)
Definition menu.cpp:907
void save_image()
Definition menu.cpp:3793
void slot_pillage()
Definition menu.cpp:2768
void slot_clean()
Definition menu.cpp:2654
void zoom_reset()
Definition menu.cpp:3310
void slot_board()
Definition menu.cpp:3083
void slot_center_view()
Definition menu.cpp:3177
void slot_build_mine()
Definition menu.cpp:2834
void server_options()
Definition menu.cpp:3761
void load_new_tileset()
Definition menu.cpp:3664
void set_tile_for_order(struct tile *ptile)
Definition menu.cpp:1796
void slot_fullscreen()
Definition menu.cpp:3223
void slot_bg4select()
Definition menu.cpp:3600
void slot_show_nations()
Definition menu.cpp:2620
void slot_build_road()
Definition menu.cpp:2792
void slot_unsentry()
Definition menu.cpp:3145
void slot_show_new_turn_text()
Definition menu.cpp:3245
void local_options()
Definition menu.cpp:3745
bool delayed_order
Definition menu.h:291
void slot_borders()
Definition menu.cpp:3269
void slot_clear_trade()
Definition menu.cpp:2924
void zoom_scale_fonts()
Definition menu.cpp:3325
void slot_conn_rail()
Definition menu.cpp:2687
void slot_select_same_tile()
Definition menu.cpp:3461
void slot_convert()
Definition menu.cpp:2866
QMenu * action_unit_menu
Definition menu.h:269
QActionGroup * action_vs_unit
Definition menu.h:268
void slot_endgame()
Definition menu.cpp:3504
void slot_bg2assign()
Definition menu.cpp:3560
void slot_select_one()
Definition menu.cpp:3433
void menus_sensitive()
Definition menu.cpp:2065
void messages_options()
Definition menu.cpp:3769
void slot_unit_goto()
Definition menu.cpp:3161
void slot_cultivate()
Definition menu.cpp:2826
void slot_stack_size()
Definition menu.cpp:3393
void slot_conn_maglev()
Definition menu.cpp:2702
void slot_patrol()
Definition menu.cpp:3093
void slot_unit_fortress()
Definition menu.cpp:2717
void slot_wait()
Definition menu.cpp:3469
void slot_demographics()
Definition menu.cpp:3488
void slot_build_city()
Definition menu.cpp:2636
void slot_city_growth()
Definition menu.cpp:3293
void slot_city_trade_routes()
Definition menu.cpp:3385
void slot_rally()
Definition menu.cpp:2891
void slot_plant()
Definition menu.cpp:2842
void slot_paradrop()
Definition menu.cpp:2756
void slot_build_path(int id)
Definition menu.cpp:3711
void slot_bg1assign()
Definition menu.cpp:3536
void slot_return_to_city()
Definition menu.cpp:3101
Unit_type_id airlift_type_id
Definition menu.h:293
void slot_show_map()
Definition menu.cpp:2604
void slot_bg3assign()
Definition menu.cpp:3584
QAction * scale_fonts_status
Definition menu.h:285
void slot_minimap_view()
Definition menu.cpp:3233
void slot_trade_city()
Definition menu.cpp:2900
void quit_game()
Definition menu.cpp:3785
void slot_help(const QString &topic)
Definition menu.cpp:3703
void save_game_as()
Definition menu.cpp:3851
void slot_bg2append()
Definition menu.cpp:3568
bool quick_airlifting
Definition menu.h:292
void slot_spaceship()
Definition menu.cpp:2584
void slot_city_names()
Definition menu.cpp:3353
QMenu * action_city_menu
Definition menu.h:270
void save_options_now()
Definition menu.cpp:3777
QAction * btlog_status
Definition menu.h:288
void slot_unit_fortify()
Definition menu.cpp:2850
void slot_show_units_report()
Definition menu.cpp:2612
void slot_quickairlift()
Definition menu.cpp:3009
QString shortcut_2_menustring(int sid)
Definition menu.cpp:1908
void slot_lock()
Definition menu.cpp:3185
void back_to_menu()
Definition menu.cpp:3878
void slot_deboard()
Definition menu.cpp:3127
void slot_popup_tax_rates()
Definition menu.cpp:3687
void slot_build_base(int id)
Definition menu.cpp:3727
qfc_units_list units_list
Definition menu.h:272
void setup_menus()
Definition menu.cpp:958
mr_menu()
Definition menu.cpp:949
void slot_bg3append()
Definition menu.cpp:3592
void slot_action_vs_city()
Definition menu.cpp:2998
void zoom_out()
Definition menu.cpp:3344
void slot_disband()
Definition menu.cpp:2874
void slot_unit_airbase()
Definition menu.cpp:2725
void slot_fullbar()
Definition menu.cpp:3401
void slot_city_outlines()
Definition menu.cpp:3361
bool confirm_disruptive_selection()
Definition menu.cpp:3903
void slot_orders_clear()
Definition menu.cpp:2882
static qdef_act * action()
Definition dialogs.cpp:1043
void vs_city_set(int i)
Definition dialogs.cpp:1065
void vs_unit_set(int i)
Definition dialogs.cpp:1073
QList< qfc_delayed_unit_item * > unit_list
Definition menu.h:131
void add(qfc_delayed_unit_item *fui)
Definition menu.cpp:495
int nr_units
Definition menu.h:132
void clear()
Definition menu.cpp:503
bool done
Definition menu.h:143
unsigned trade_num
Definition menu.h:146
int poss_trade_num
Definition menu.h:145
QList< struct city * > pos_cities
Definition menu.h:149
QList< struct city * > new_tr_cities
Definition menu.h:148
int over_max
Definition menu.h:144
trade_city(struct city *pcity)
Definition menu.cpp:68
QList< struct city * > curr_tr_cities
Definition menu.h:147
struct city * city
Definition menu.h:150
void calculate_inner(trade_city *tc)
Definition menu.cpp:216
bool discard_one(trade_city *tc)
Definition menu.cpp:378
void add_city(struct city *pcity)
Definition menu.cpp:127
void find_certain_routes()
Definition menu.cpp:460
QList< trade_city * > cities
Definition menu.h:182
void find_certain_routes_inner(trade_city *tc)
Definition menu.cpp:425
trade_city * find_most_free()
Definition menu.cpp:327
void discard_trade(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:364
void add_tile(struct tile *ptile)
Definition menu.cpp:139
void remove_virtual_city(struct tile *ptile)
Definition menu.cpp:190
bool hover_city
Definition menu.h:179
void add_all_cities()
Definition menu.cpp:87
void clear_trade_planing()
Definition menu.cpp:107
void discard()
Definition menu.cpp:345
void remove_city(struct city *pcity)
Definition menu.cpp:172
QList< qtiles > lines
Definition menu.h:180
bool discard_any(trade_city *tc, int freeroutes)
Definition menu.cpp:404
void check_if_done(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:475
QList< struct city * > virtual_cities
Definition menu.h:181
int find_over_max(struct city *pcity)
Definition menu.cpp:311
void calculate()
Definition menu.cpp:234
bool client_is_observer(void)
struct civclient client
enum client_states client_state(void)
bool is_waiting_turn_change(void)
void send_report_request(enum report_type type)
bool can_client_issue_orders(void)
bool client_has_player(void)
#define client_player()
@ C_S_RUNNING
Definition client_main.h:47
bool can_units_do_connect(struct unit_list *punits, enum unit_activity activity, struct extra_type *tgt)
Definition climisc.c:1242
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
char * incite_cost
Definition comments.c:76
@ REPORT_DEMOGRAPHIC
Definition conn_types.h:53
@ REPORT_WONDERS_OF_THE_WORLD_LONG
Definition conn_types.h:51
@ REPORT_ACHIEVEMENTS
Definition conn_types.h:54
@ REPORT_TOP_CITIES
Definition conn_types.h:52
void send_save_game(const char *filename)
bool is_server_running(void)
bool can_client_access_hack(void)
void key_unit_sentry(void)
Definition control.c:3756
void request_unit_airlift(struct unit *punit, struct city *pcity)
Definition control.c:1543
void key_city_output_toggle(void)
Definition control.c:3853
void request_unit_return(struct unit *punit)
Definition control.c:1552
void request_unit_caravan_action(struct unit *punit, action_id action)
Definition control.c:2223
void key_unit_auto_explore(void)
Definition control.c:3577
void key_unit_connect(enum unit_activity activity, struct extra_type *tgt)
Definition control.c:3375
void key_city_full_bar_toggle(void)
Definition control.c:3885
void key_map_native_toggle(void)
Definition control.c:3877
void request_unit_goto(enum unit_orders last_order, action_id act_id, int sub_tgt_id)
Definition control.c:1130
void key_unit_paradrop(void)
Definition control.c:3479
struct unit_list * get_units_in_focus(void)
Definition control.c:177
void request_center_focus_unit(void)
Definition control.c:2750
void key_city_productions_toggle(void)
Definition control.c:3919
void key_unit_plant(void)
Definition control.c:3696
void key_unit_fortress(void)
Definition control.c:3624
void key_unit_mine(void)
Definition control.c:3688
void key_unit_pillage(void)
Definition control.c:3708
void request_unit_unload(struct unit *pcargo)
Definition control.c:2194
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Definition control.c:1938
void key_unit_irrigate(void)
Definition control.c:3668
void request_unit_build_city(struct unit *punit)
Definition control.c:1817
void key_unit_unload_all(void)
Definition control.c:3517
void key_city_outlines_toggle(void)
Definition control.c:3845
void key_unit_homecity(void)
Definition control.c:3641
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)
Definition control.c:290
void key_unit_patrol(void)
Definition control.c:3487
void key_unit_wakeup_others(void)
Definition control.c:3550
enum cursor_hover_state hover_state
Definition control.c:89
void key_unit_stack_size_toggle(void)
Definition control.c:3936
void key_unit_wait(void)
Definition control.c:3542
void key_unit_select_battlegroup(int battlegroup, bool append)
Definition control.c:3819
void key_map_grid_toggle(void)
Definition control.c:3861
struct unit * head_of_units_in_focus(void)
Definition control.c:410
void key_city_growth_toggle(void)
Definition control.c:3902
void key_unit_action_select_tgt(void)
Definition control.c:3406
void key_city_buycost_toggle(void)
Definition control.c:3911
int get_num_units_in_focus(void)
Definition control.c:185
void key_unit_transform(void)
Definition control.c:3768
void request_move_unit_direction(struct unit *punit, int dir)
Definition control.c:1879
void key_unit_done(void)
Definition control.c:3463
void key_city_trade_routes_toggle(void)
Definition control.c:3928
void key_city_names_toggle(void)
Definition control.c:3893
void request_unit_select(struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
Definition control.c:1621
void key_unit_auto_work(void)
Definition control.c:3590
void key_unit_airbase(void)
Definition control.c:3560
void key_unit_goto(void)
Definition control.c:3471
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1215
void key_unit_convert(void)
Definition control.c:3602
void key_unit_fortify(void)
Definition control.c:3612
void key_unit_assign_battlegroup(int battlegroup, bool append)
Definition control.c:3780
void key_unit_cultivate(void)
Definition control.c:3676
void key_map_borders_toggle(void)
Definition control.c:3869
#define can_unit_do_activity_targeted_client(_punit_, _act_, _tgt_)
Definition control.h:43
#define can_units_do_activity_targeted_client(_punits_, _act_, _tgt_)
Definition control.h:47
@ HOVER_GOTO
Definition control.h:27
#define can_units_do_activity_client(_punits_, _act_)
Definition control.h:45
bool qtg_request_transport(struct unit *pcargo, struct tile *ptile)
Definition dialogs.cpp:4938
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit * punit
Definition dialogs_g.h:74
struct unit struct city struct unit struct tile struct extra_type const struct act_prob *act_probs int actor_unit_id struct unit struct unit int const struct action *paction struct unit struct city * pcity
Definition dialogs_g.h:78
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:842
struct extra_type * next_extra_for_tile(const struct tile *ptile, enum extra_cause cause, const struct player *pplayer, const struct unit *punit)
Definition extras.c:779
int extra_number(const struct extra_type *pextra)
Definition extras.c:161
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:249
struct extra_type * prev_extra_in_tile(const struct tile *ptile, enum extra_rmcause rmcause, const struct player *pplayer, const struct unit *punit)
Definition extras.c:804
static struct extra_type extras[MAX_EXTRA_TYPES]
Definition extras.c:31
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:194
#define extra_type_iterate(_p)
Definition extras.h:315
#define extra_type_iterate_end
Definition extras.h:321
#define extra_type_by_cause_iterate_end
Definition extras.h:339
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:333
#define NO_TARGET
Definition fc_types.h:213
int Unit_type_id
Definition fc_types.h:241
#define Q_(String)
Definition fcintl.h:70
#define PL_(String1, String2, n)
Definition fcintl.h:71
#define _(String)
Definition fcintl.h:67
const struct ft_color ftc_client
const char * city_link(const struct city *pcity)
struct civ_game game
Definition game.c:61
struct world wld
Definition game.c:62
struct city * game_city_by_number(int id)
Definition game.c:106
struct tile * tile_before_end_path(struct unit *punit, struct tile *ptile)
Definition goto.c:2036
bool send_attack_tile(struct unit *punit, struct tile *ptile)
Definition goto.c:1639
bool send_goto_tile(struct unit *punit, struct tile *ptile)
Definition goto.c:1569
void enter_goto_state(struct unit_list *punits)
Definition goto.c:1011
const char * government_name_translation(const struct government *pgovern)
Definition government.c:143
bool untargeted_revolution_allowed(void)
Definition government.c:566
Government_type_id government_count(void)
Definition government.c:71
struct government * government_by_number(const Government_type_id gov)
Definition government.c:103
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:166
static PangoLayout * layout
Definition canvas.c:325
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1435
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1473
static struct tile * pos
Definition finddlg.c:53
void popup_multiplier_dialog(void)
Definition gamedlgs.c:383
void popup_rates_dialog(void)
Definition gamedlgs.c:533
void popup_goto_dialog(void)
Definition gotodlg.c:258
void popup_quit_dialog(void)
Definition gui_main.c:2350
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
Definition helpdlg.c:196
void create_line_at_mouse_pos(void)
Definition mapctrl.c:355
void update_city_descriptions(void)
Definition mapview.c:488
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2338
#define CREATE_SUB_ITEM(_sub_target_, _sub_target_key_, _sub_target_name_)
void popup_messageopt_dialog(void)
Definition messagedlg.c:51
void popup_players_dialog(bool raise)
Definition plrdlg.c:91
void economy_report_dialog_popup(bool raise)
Definition repodlgs.c:1243
void popup_spaceship_dialog(struct player *pplayer)
delay_order
Definition menu.h:82
@ D_GOTO
Definition menu.h:83
munit
Definition menu.h:39
@ AIRLIFT
Definition menu.h:69
@ CONNECT_RAIL
Definition menu.h:65
@ TRANSFORM
Definition menu.h:51
@ FORTIFY
Definition menu.h:56
@ GOTO_CITY
Definition menu.h:68
@ TRANSPORTER
Definition menu.h:44
@ BUILD
Definition menu.h:54
@ IRRIGATION
Definition menu.h:49
@ CONNECT_IRRIGATION
Definition menu.h:67
@ CONNECT_ROAD
Definition menu.h:64
@ HOMECITY
Definition menu.h:61
@ CONVERT
Definition menu.h:46
@ PILLAGE
Definition menu.h:53
@ TOP_CITIES
Definition menu.h:79
@ BUILD_WONDER
Definition menu.h:70
@ DISBAND
Definition menu.h:45
@ DEBOARD
Definition menu.h:43
@ CLEAN
Definition menu.h:59
@ NOT_4_OBS
Definition menu.h:75
@ UPGRADE
Definition menu.h:74
@ SAVE
Definition menu.h:78
@ MULTIPLIERS
Definition menu.h:76
@ PLANT
Definition menu.h:48
@ ORDER_TRADE_ROUTE
Definition menu.h:72
@ WAKEUP
Definition menu.h:62
@ MINE
Definition menu.h:47
@ SENTRY
Definition menu.h:60
@ ORDER_DIPLOMAT_DLG
Definition menu.h:73
@ EXPLORE
Definition menu.h:41
@ STANDARD
Definition menu.h:40
@ AUTOWORKER
Definition menu.h:63
@ ROAD
Definition menu.h:55
@ CONNECT_MAGLEV
Definition menu.h:66
@ CULTIVATE
Definition menu.h:50
@ PARADROP
Definition menu.h:52
@ BOARD
Definition menu.h:42
@ FORTRESS
Definition menu.h:57
@ ENDGAME
Definition menu.h:77
@ AUTOTRADEROUTE
Definition menu.h:71
@ AIRBASE
Definition menu.h:58
#define enable(id)
Definition widget.h:223
void popup_revolution_dialog(void)
Definition dialogs.c:112
#define HELP_MUSICSET_ITEM
#define HELP_CITIES_ITEM
#define HELP_TERRAIN_ITEM
#define HELP_LANGUAGES_ITEM
#define HELP_CONNECTING_ITEM
#define HELP_TILESET_ITEM
#define HELP_CHATLINE_ITEM
#define HELP_RULESET_ITEM
#define HELP_GOVERNMENT_ITEM
#define HELP_ABOUT_ITEM
#define HELP_PLAYING_ITEM
#define HELP_IMPROVEMENTS_ITEM
#define HELP_UNITS_ITEM
#define HELP_ZOC_ITEM
#define HELP_WORKLIST_EDITOR_ITEM
#define HELP_WONDERS_ITEM
#define HELP_COMBAT_ITEM
#define HELP_SPACE_RACE_ITEM
#define HELP_COPYING_ITEM
#define HELP_OVERVIEW_ITEM
#define HELP_NATIONS_ITEM
#define HELP_TECHS_ITEM
#define HELP_DIPLOMACY_ITEM
#define HELP_ECONOMY_ITEM
@ HELP_ANY
Definition helpdlg_g.h:20
#define HELP_CMA_ITEM
#define HELP_CONTROLS_ITEM
bool has_player_unit_type(Unit_type_id utype)
Definition hudwidget.cpp:60
Impr_type_id improvement_number(const struct impr_type *pimprove)
const char * improvement_name_translation(const struct impr_type *pimprove)
#define improvement_iterate_end
#define improvement_iterate(_p)
#define fc_assert(condition)
Definition log.h:177
int get_direction_for_step(const struct civ_map *nmap, const struct tile *start_tile, const struct tile *end_tile)
Definition map.c:1488
bool is_tiles_adjacent(const struct tile *tile0, const struct tile *tile1)
Definition map.c:1067
struct terrain_misc terrain_control
Definition map.c:68
struct view mapview
bool map_canvas_resized(int width, int height)
#define fc_malloc(sz)
Definition mem.h:34
#define ADD_OLD_SHORTCUT(wanted_action_id, sc_id)
static void enable_interface(bool enable)
Definition menu.cpp:3198
void multiairlift(struct city *acity, Unit_type_id ut)
Definition menu.cpp:3919
void real_menus_init(void)
Definition menu.cpp:512
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.cpp:553
void real_menus_update(void)
Definition menu.cpp:530
static mpgui * gui
Definition mpgui_qt.cpp:52
Multiplier_type_id multiplier_count(void)
Definition multipliers.c:88
const char *const city_productions
Definition fonts.h:33
const char *const city_names
Definition fonts.h:32
const char * nation_plural_for_player(const struct player *pplayer)
Definition nation.c:178
const struct option_set * client_optset
Definition options.c:1316
void options_save(option_save_log_callback log_cb)
Definition options.c:6340
struct client_options gui_options
Definition options.c:71
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Definition options.c:467
struct city_list * cities
Definition packhand.c:119
void popup_shortcuts_dialog()
void toggle_units_report(bool)
#define players_iterate_end
Definition player.h:542
#define players_iterate(_pplayer)
Definition player.h:537
void qtg_science_report_dialog_popup(bool raise)
void popup_endgame_report()
struct extra_type * road_extra_get(const struct road_type *proad)
Definition road.c:42
struct road_type * road_by_gui_type(enum road_gui_type gui_type)
Definition road.c:180
const struct strvec * get_save_dirs(void)
Definition shared.c:934
void array_shuffle(int *array, int n)
Definition shared.c:2011
char * freeciv_storage_dir(void)
Definition shared.c:671
#define DIR_SEPARATOR
Definition shared.h:127
QString shortcut_to_string(fc_shortcut *sc)
shortcut_id
Definition shortcuts.h:33
@ SC_PARADROP
Definition shortcuts.h:95
@ SC_UPGRADE_UNIT
Definition shortcuts.h:63
@ SC_BUILDIRRIGATION
Definition shortcuts.h:67
@ SC_BUILDCITY
Definition shortcuts.h:70
@ SC_DONE_MOVING
Definition shortcuts.h:57
@ SC_BUILDROAD
Definition shortcuts.h:69
@ SC_UNSENTRY_TILE
Definition shortcuts.h:61
@ SC_CULTIVATE
Definition shortcuts.h:68
@ SC_DO
Definition shortcuts.h:62
@ SC_CENTER_VIEW
Definition shortcuts.h:36
@ SC_SENTRY
Definition shortcuts.h:71
@ SC_GOBUILDCITY
Definition shortcuts.h:92
@ SC_NUKE
Definition shortcuts.h:76
@ SC_AUTOEXPLORE
Definition shortcuts.h:59
@ SC_SETHOME
Definition shortcuts.h:64
@ SC_PLANT
Definition shortcuts.h:66
@ SC_BUILDMINE
Definition shortcuts.h:65
@ SC_FULLSCREEN
Definition shortcuts.h:37
@ SC_TRADE_ROUTES
Definition shortcuts.h:54
@ SC_CITY_OUTPUT
Definition shortcuts.h:39
@ SC_TRANSFORM
Definition shortcuts.h:75
@ SC_STACK_SIZE
Definition shortcuts.h:94
@ SC_FORTIFY
Definition shortcuts.h:72
@ SC_ZOOM_IN
Definition shortcuts.h:87
@ SC_GOJOINCITY
Definition shortcuts.h:93
@ SC_MAP_GRID
Definition shortcuts.h:40
@ SC_MINIMAP
Definition shortcuts.h:38
@ SC_CITY_PROD
Definition shortcuts.h:55
@ SC_PATROL
Definition shortcuts.h:60
@ SC_GOTO
Definition shortcuts.h:73
@ SC_GOTOAIRLIFT
Definition shortcuts.h:58
@ SC_WAIT
Definition shortcuts.h:74
@ SC_IFACE_LOCK
Definition shortcuts.h:80
@ SC_DEBOARD
Definition shortcuts.h:78
@ SC_ZOOM_RESET
Definition shortcuts.h:91
@ SC_ZOOM_OUT
Definition shortcuts.h:88
@ SC_AUTOMATE
Definition shortcuts.h:81
@ SC_CITY_NAMES
Definition shortcuts.h:56
@ SC_BOARD
Definition shortcuts.h:77
@ SC_CLEAN
Definition shortcuts.h:82
@ SC_NAT_BORDERS
Definition shortcuts.h:41
@ SC_SHOW_FULLBAR
Definition shortcuts.h:86
#define strvec_iterate(psv, str)
#define strvec_iterate_end
QPixmap map_pixmap
Definition canvas.h:25
Definition city.h:317
char * name
Definition city.h:318
struct tile * tile
Definition city.h:319
struct civ_game::@32::@35 client
struct packet_game_info info
Definition game.h:89
bool ruleset_ready
Definition game.h:119
struct government * government_during_revolution
Definition game.h:94
struct connection conn
Definition client_main.h:96
bool gui_qt_fullscreen
Definition options.h:442
bool draw_native
Definition options.h:216
bool draw_city_output
Definition options.h:195
bool draw_city_names
Definition options.h:197
bool draw_city_productions
Definition options.h:199
bool draw_borders
Definition options.h:215
bool draw_city_buycost
Definition options.h:200
bool draw_unit_stack_size
Definition options.h:219
bool draw_city_trade_routes
Definition options.h:201
bool unit_selection_clears_orders
Definition options.h:176
bool save_options_on_exit
Definition options.h:125
bool draw_map_grid
Definition options.h:196
bool draw_city_growth
Definition options.h:198
bool draw_city_outlines
Definition options.h:194
bool draw_full_citybar
Definition options.h:217
Definition climisc.h:82
struct city_list * cities
Definition player.h:281
Definition menu.h:160
QPixmap * pm
Definition sprite.h:25
struct terrain * cultivate_result
Definition terrain.h:108
struct terrain * plant_result
Definition terrain.h:111
struct terrain * transform_result
Definition terrain.h:122
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition unit.h:140
int id
Definition unit.h:147
struct tile * tile
Definition unit.h:142
int homecity
Definition unit.h:148
const struct unit_type * utype
Definition unit.h:141
struct canvas * store
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:960
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:300
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define advance_iterate(_p)
Definition tech.h:271
#define advance_iterate_end
Definition tech.h:272
#define T_NONE
Definition terrain.h:61
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1035
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Definition tile.c:681
struct tile * tile_virtual_new(const struct tile *ptile)
Definition tile.c:981
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:771
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_terrain(_tile)
Definition tile.h:111
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:7017
int tileset_hex_width(const struct tileset *t)
Definition tilespec.c:747
const struct strvec * get_tileset_list(const struct option *poption)
Definition tilespec.c:1150
bool tileset_is_isometric(const struct tileset *t)
Definition tilespec.c:738
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:730
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:791
int tileset_tile_width(const struct tileset *t)
Definition tilespec.c:779
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1401
int city_num_trade_routes(const struct city *pcity)
unsigned max_trade_routes(const struct city *pcity)
Definition traderoutes.c:48
bool can_establish_trade_route(const struct city *pc1, const struct city *pc2, int priority)
bool have_cities_trade_route(const struct city *pc1, const struct city *pc2)
#define GOODS_HIGH_PRIORITY
bool unit_can_est_trade_route_here(const struct unit *punit)
Definition unit.c:284
bool unit_can_add_or_build_city(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:472
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:505
bool unit_contained_in(const struct unit *pcargo, const struct unit *ptrans)
Definition unit.c:2597
bool can_unit_do_autoworker(const struct unit *punit)
Definition unit.c:630
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:846
bool unit_can_help_build_wonder_here(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:258
#define unit_tile(_pu)
Definition unit.h:404
@ ORDER_LAST
Definition unit.h:50
@ ORDER_PERFORM_ACTION
Definition unit.h:48
#define unit_owner(_pu)
Definition unit.h:403
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:350
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:273
bool units_can_unload(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:301
bool can_units_do_base_gui(const struct unit_list *punits, enum base_gui_type base_gui)
Definition unitlist.c:180
bool units_contain_cityfounder(const struct unit_list *punits)
Definition unitlist.c:217
bool can_units_do_any_road(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:161
struct unit * unit_list_find(const struct unit_list *punitlist, int unit_id)
Definition unitlist.c:30
bool units_can_upgrade(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:335
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:319
bool units_have_type_flag(const struct unit_list *punits, enum unit_type_flag_id flag, bool has_flag)
Definition unitlist.c:202
bool can_units_do(const struct unit_list *punits, bool(can_fn)(const struct unit *punit))
Definition unitlist.c:95
bool units_can_do_action(const struct unit_list *punits, action_id act_id, bool can_do)
Definition unitlist.c:239
bool units_can_load(const struct unit_list *punits)
Definition unitlist.c:287
bool can_units_do_on_map(const struct civ_map *nmap, const struct unit_list *punits, bool(can_fn)(const struct civ_map *nmap, const struct unit *punit))
Definition unitlist.c:111
#define unit_list_iterate(unitlist, punit)
Definition unitlist.h:31
#define unit_list_iterate_end
Definition unitlist.h:33
const struct unit_type * unit_type_get(const struct unit *punit)
Definition unittype.c:123
struct unit_type * utype_by_number(const Unit_type_id id)
Definition unittype.c:112
Unit_type_id utype_index(const struct unit_type *punittype)
Definition unittype.c:91
bool can_player_build_unit_now(const struct player *p, const struct unit_type *punittype)
Definition unittype.c:2084
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1566
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:377
#define unit_type_iterate(_p)
Definition unittype.h:862
#define unit_type_iterate_end
Definition unittype.h:869
#define MAP_NATIVE_WIDTH
#define MAP_NATIVE_HEIGHT