Freeciv-3.2
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;
93 if (s == 0) {
94 return;
95 }
96 for (i = 0; i < s; i++) {
98 add_city(pcity);
99 }
100}
101
102/**********************************************************************/
106{
107 struct city *pcity;
108 trade_city *tc;
109
110 foreach(pcity, virtual_cities) {
112 }
113 virtual_cities.clear();
114 foreach(tc, cities) {
115 delete tc;
116 }
117 cities.clear();
118 lines.clear();
119 gui()->mapview_wdg->repaint();
120}
121
122/**********************************************************************/
126{
127 trade_city *tc = new trade_city(pcity);
128
129 cities.append(tc);
130 gui()->infotab->chtwdg->append(QString(_("Adding city %1 to trade planning"))
131 .arg(tc->city->name));
132}
133
134/**********************************************************************/
138{
139 struct city *pcity;
140 trade_city *tc;
141
142 pcity = tile_city(ptile);
143
144 foreach (tc, cities) {
145 if (pcity != nullptr) {
146 if (tc->city == pcity) {
147 remove_city(pcity);
148 return;
149 }
150 }
151 if (tc->city->tile == ptile) {
152 remove_virtual_city(ptile);
153 return;
154 }
155 }
156
157 if (pcity != nullptr) {
158 add_city(pcity);
159 return;
160 }
161
162 pcity = create_city_virtual(client_player(), ptile, "Virtual");
163 add_city(pcity);
164 virtual_cities.append(pcity);
165}
166
167/**********************************************************************/
171{
172 trade_city *tc;
173
174 foreach (tc, cities) {
175 if (tc->city->tile == pcity->tile) {
176 cities.removeAll(tc);
177 gui()->infotab->chtwdg->append(
178 QString(_("Removing city %1 from trade planning"))
179 .arg(tc->city->name));
180 return;
181 }
182 }
183}
184
185/**********************************************************************/
189{
190 struct city *c;
191 trade_city *tc;
192
193 foreach (c, virtual_cities) {
194 if (c->tile == ptile) {
195 virtual_cities.removeAll(c);
196 gui()->infotab->chtwdg->append(
197 QString(_("Removing city %1 from trade planning")).arg(c->name));
198 }
199 }
200
201 foreach (tc, cities) {
202 if (tc->city->tile == ptile) {
203 cities.removeAll(tc);
204 return;
205 }
206 }
207}
208
209/**********************************************************************/
215{
217
218 foreach (ttc, cities) {
219 if (!have_cities_trade_route(tc->city, ttc->city)
220 && can_establish_trade_route(tc->city, ttc->city)) {
221 tc->poss_trade_num++;
222 tc->pos_cities.append(ttc->city);
223 }
224 tc->over_max = tc->trade_num + tc->poss_trade_num
225 - max_trade_routes(tc->city);
226 }
227}
228
229/**********************************************************************/
233{
234 trade_city *tc;
235 int i;
236 bool tdone;
237 int count = cities.size();
238 int *cities_ids = (int *)fc_malloc(sizeof(int) * count);
239 trade_city **cities_order = (trade_city **)fc_malloc(sizeof(trade_city *) * count);
240
241 for (i = 0; i < 100; i++) {
242 int n;
243
244 tdone = true;
245
246 for (n = 0; n < count; n++) {
247 cities_ids[n] = n;
249 }
251
252 cities.clear();
253 for (n = 0; n < count; n++) {
255 }
256
257 lines.clear();
258 foreach (tc, cities) {
259 tc->pos_cities.clear();
260 tc->new_tr_cities.clear();
261 tc->curr_tr_cities.clear();
262 }
263 foreach (tc, cities) {
265 tc->poss_trade_num = 0;
266 tc->pos_cities.clear();
267 tc->new_tr_cities.clear();
268 tc->curr_tr_cities.clear();
269 tc->done = false;
270 calculate_inner(tc);
271 }
272
274 discard();
276
277 foreach (tc, cities) {
278 if (!tc->done) {
279 tdone = false;
280 }
281 }
282 if (tdone) {
283 break;
284 }
285 }
286 foreach (tc, cities) {
287 if (!tc->done) {
288 char text[1024];
289 fc_snprintf(text, sizeof(text),
290 PL_("City %s - 1 free trade route.",
291 "City %s - %d free trade routes.",
292 max_trade_routes(tc->city) - tc->trade_num),
293 city_link(tc->city),
294 max_trade_routes(tc->city) - tc->trade_num);
296 }
297 }
298
301
302 gui()->mapview_wdg->repaint();
303}
304
305/**********************************************************************/
309int trade_generator::find_over_max(struct city *pcity = nullptr)
310{
311 trade_city *tc;
312 int max = 0;
313
314 foreach (tc, cities) {
315 if (pcity != tc->city) {
316 max = qMax(max, tc->over_max);
317 }
318 }
319 return max;
320}
321
322/**********************************************************************/
326{
327 trade_city *tc;
328 trade_city *rc = nullptr;
329 int max = 0;
330
331 foreach (tc, cities) {
332 if (max < tc->over_max) {
333 max = tc->over_max;
334 rc = tc;
335 }
336 }
337 return rc;
338}
339
340/**********************************************************************/
344{
345 trade_city *tc;
346 int j = 5;
347
348 for (int i = j; i > -j; i--) {
349 while ((tc = find_most_free())) {
350 if (!discard_one(tc)) {
351 if (!discard_any(tc, i)) {
352 break;
353 }
354 }
355 }
356 }
357}
358
359/**********************************************************************/
363{
364 tc->pos_cities.removeOne(ttc->city);
365 ttc->pos_cities.removeOne(tc->city);
366 tc->poss_trade_num--;
367 ttc->poss_trade_num--;
368 tc->over_max--;
369 ttc->over_max--;
370 check_if_done(tc, ttc);
371}
372
373/**********************************************************************/
377{
378 int best = 0;
379 int current_candidate = 0;
380 int best_id;
382
383 for (int i = cities.size() - 1 ; i >= 0; i--) {
384 ttc = cities.at(i);
386 if (current_candidate > best) {
387 best_id = i;
388 }
389 }
390 if (best == 0) {
391 return false;
392 }
393
394 ttc = cities.at(best_id);
395 discard_trade(tc, ttc);
396 return true;
397}
398
399/**********************************************************************/
403{
405
406 for (int i = cities.size() - 1 ; i >= 0; i--) {
407 ttc = cities.at(i);
408 if (tc->pos_cities.contains(ttc->city)
409 && ttc->pos_cities.contains(tc->city)
410 && ttc->over_max > freeroutes) {
411 discard_trade(tc, ttc);
412 return true;
413 }
414 }
415 return false;
416}
417
418/**********************************************************************/
424{
426
427 foreach (ttc, cities) {
428 if (ttc->done || ttc->over_max > 0
429 || tc == ttc || tc->done || tc->over_max > 0) {
430 continue;
431 }
432 if (tc->pos_cities.contains(ttc->city)
433 && ttc->pos_cities.contains(tc->city)) {
434 struct qtiles gilles;
435
436 tc->pos_cities.removeOne(ttc->city);
437 ttc->pos_cities.removeOne(tc->city);
438 tc->poss_trade_num--;
439 ttc->poss_trade_num--;
440 tc->new_tr_cities.append(ttc->city);
441 ttc->new_tr_cities.append(ttc->city);
442 tc->trade_num++;
443 ttc->trade_num++;
444 tc->over_max--;
445 ttc->over_max--;
446 check_if_done(tc, ttc);
447 gilles.t1 = tc->city->tile;
448 gilles.t2 = ttc->city->tile;
449 gilles.autocaravan = nullptr;
450 lines.append(gilles);
451 }
452 }
453}
454
455/**********************************************************************/
459{
460 trade_city *tc;
461
462 foreach (tc, cities) {
463 if (tc->done || tc->over_max > 0) {
464 continue;
465 }
467 }
468}
469
470/**********************************************************************/
474{
475 if (tc1->trade_num == max_trade_routes(tc1->city)) {
476 tc1->done = true;
477 }
478 if (tc2->trade_num == max_trade_routes(tc2->city)) {
479 tc2->done = true;
480 }
481}
482
483/**********************************************************************/
489
490/**********************************************************************/
497
498/**********************************************************************/
502{
503 unit_list.clear();
504}
505
506/**********************************************************************/
511{
513 return;
514 }
515 gui()->menu_bar->clear();
516 gui()->menu_bar->setup_menus();
517
519
520 // A new ruleset may have been loaded.
522}
523
524/**********************************************************************/
529{
530 if (C_S_RUNNING <= client_state()) {
531 gui()->menuBar()->setVisible(true);
532 if (!is_waiting_turn_change()) {
533 gui()->menu_bar->menus_sensitive();
534 gui()->menu_bar->update_airlift_menu();
535 gui()->menu_bar->update_roads_menu();
536 gui()->menu_bar->update_bases_menu();
539 gui()->unitinfo_wdg->update_actions(nullptr);
540 }
541 } else {
542 gui()->menuBar()->setVisible(false);
543 }
544}
545
546/**********************************************************************/
551static const char *get_tile_change_menu_text(struct tile *ptile,
552 enum unit_activity activity)
553{
554 struct tile *newtile = tile_virtual_new(ptile);
555 const char *text;
556
557 tile_apply_activity(newtile, activity, NULL);
558 text = tile_get_info_text(newtile, FALSE, 0);
560
561 return text;
562}
563
564/**********************************************************************/
568 QMenu(_("Government"), parent)
569{
570 // Register ourselves to get updates for free.
571 instances << this;
572 setAttribute(Qt::WA_TranslucentBackground);
573}
574
575/**********************************************************************/
579{
581 instances.remove(this);
582}
583
584/**********************************************************************/
589 struct government *gov, *revol_gov;
590 int gov_count, i;
591
592 // Clear any content
593 foreach(action, QWidget::actions()) {
595 action->deleteLater();
596 }
597 actions.clear();
598
600 actions.reserve(gov_count + 1);
601 action = addAction(_("Revolution..."));
602 connect(action, &QAction::triggered, this, &gov_menu::revolution);
603 actions.append(action);
604
605 addSeparator();
606
607 // Add an action for each government. There is no icon yet.
609 for (i = 0; i < gov_count; ++i) {
610 gov = government_by_number(i);
611 if (gov != revol_gov) { // Skip revolution government
612 // Defeat keyboard shortcut mnemonics
614 .replace("&", "&&"));
615 // We need to keep track of the gov <-> action mapping to be able to
616 // set enabled/disabled depending on available govs.
617 actions.append(action);
618 QObject::connect(action, &QAction::triggered, [this,i]() {
619 change_gov(i);
620 });
621 }
622 }
623}
624
625/**********************************************************************/
629{
630 struct government *gov, *revol_gov;
631 struct sprite *sprite;
632 int gov_count, i, j;
633
636 for (i = 0, j = 0; i < gov_count; i++) {
637 gov = government_by_number(i);
638 if (gov != revol_gov) { // Skip revolution government
640 if (sprite != NULL) {
641 actions[j + 1]->setIcon(QIcon(*(sprite->pm)));
642 }
643 actions[j + 1]->setEnabled(
645 j++;
646 } else {
647 actions[0]->setEnabled(!client_is_observer()
649 }
650 }
651}
652
653/**********************************************************************/
660
661/**********************************************************************/
668
669/**************************************************************************
670 Keeps track of all gov_menu instances.
671**************************************************************************/
673
674/**********************************************************************/
678{
679 foreach (gov_menu *m, instances) {
680 m->create();
681 }
682}
683
684/**********************************************************************/
688{
689 foreach (gov_menu *m, instances) {
690 m->update();
691 }
692}
693
694/**********************************************************************/
698 : QMenu(_("Go to and..."), parent)
699{
700 // Will need auto updates etc.
701 instances << this;
702}
703
704/**********************************************************************/
708{
709 // Updates are no longer needed.
710 instances.remove(this);
711}
712
713/**********************************************************************/
717{
718 // Clear menu item to action ID mapping.
719 items.clear();
720
721 // Remove the menu items
722 clear();
723}
724
725/**********************************************************************/
729{
730 QAction *item;
731 int tgt_kind_group;
732
733 // Group goto and perform action menu items by target kind.
735 action_iterate(act_id) {
736 struct action *paction = action_by_number(act_id);
738 .replace("&", "&&"));
739
740 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
741 // This action isn't performed by an unit.
742 continue;
743 }
744
746 // Wrong group.
747 continue;
748 }
749
750 if (action_id_has_complex_target(act_id)) {
752 items.insert(sub_target_menu->menuAction(), act_id);
753
754#define CREATE_SUB_ITEM(_menu_, _act_id_, _sub_tgt_id_, _sub_tgt_name_) \
755 { \
756 QAction *_sub_item_ = _menu_->addAction(_sub_tgt_name_); \
757 int _sub_target_id_ = _sub_tgt_id_; \
758 QObject::connect(_sub_item_, &QAction::triggered, \
759 [this, _act_id_, _sub_target_id_]() { \
760 start_go_act(_act_id_, _sub_target_id_); \
761 }); \
762 }
763
765 case ASTK_BUILDING:
771 break;
772 case ASTK_TECH:
778 break;
779 case ASTK_EXTRA:
781 extra_type_iterate(pextra) {
782 if (!actres_creates_extra(paction->result, pextra)
783 && !actres_removes_extra(paction->result, pextra)) {
784 // Not relevant
785 continue;
786 }
787
789 extra_number(pextra),
790 extra_name_translation(pextra));
792 break;
793 case ASTK_NONE:
794 // Should not be here.
796 break;
797 case ASTK_COUNT:
798 // Should not exits
800 break;
801 }
802 continue;
803 }
804
805#define ADD_OLD_SHORTCUT(wanted_action_id, sc_id) \
806 if (act_id == wanted_action_id) { \
807 item->setShortcut(QKeySequence(shortcut_to_string( \
808 fc_shortcuts::sc()->get_shortcut(sc_id)))); \
809 }
810
811 /* Create and add the menu item. It will be hidden or shown based on
812 * unit type. */
814 items.insert(item, act_id);
815
816 /* Add the keyboard shortcuts for "Go to and..." menu items that
817 * existed independently before the "Go to and..." menu arrived. */
821
822 QObject::connect(item, &QAction::triggered, [this,act_id]() {
823 start_go_act(act_id, NO_TARGET);
824 });
826 }
827}
828
829/**********************************************************************/
833{
834 bool can_do_something = false;
835
836 if (!actions_are_ready()) {
837 // Nothing to do.
838 return;
839 }
840
841 if (items.isEmpty()) {
842 // The goto and act menu needs menu items.
843 create();
844 }
845
846 /* Enable a menu item if it is theoretically possible that one of the
847 * selected units can perform it. Checking if the action can be performed
848 * at the current tile is pointless since it should be performed at the
849 * target tile. */
850 foreach(QAction *item, items.keys()) {
852 items.value(item), TRUE)) {
853 item->setVisible(true);
854 can_do_something = true;
855 } else {
856 item->setVisible(false);
857 }
858 }
859
860 if (can_do_something) {
861 // At least one menu item is enabled for one of the selected units.
862 setEnabled(true);
863 } else {
864 // No menu item is enabled any of the selected units.
865 setEnabled(false);
866 }
867}
868
869/**********************************************************************/
872void go_act_menu::start_go_act(int act_id, int sub_tgt_id)
873{
874 request_unit_goto(ORDER_PERFORM_ACTION, act_id, sub_tgt_id);
875}
876
877/**************************************************************************
878 Store all goto and act menu items so they can be updated etc
879**************************************************************************/
881
882/**********************************************************************/
886{
887 foreach (go_act_menu *m, instances) {
888 m->reset();
889 }
890}
891
892/**********************************************************************/
896{
897 foreach (go_act_menu *m, instances) {
898 m->update();
899 }
900}
901
902/**********************************************************************/
906{
908 struct tile *ptile = nullptr;
909 struct unit *zunit;
910 struct unit *qunit;
911
912 int i = 0;
913 qunit = punit;
914 foreach (fui, units_list.unit_list) {
915 zunit = unit_list_find(client_player()->units, fui->id);
916 i++;
917 if (i >= pos) {
918 punit = qunit;
919 return ptile;
920 }
921 if (zunit == nullptr) {
922 continue;
923 }
924
925 if (punit == zunit) { // Unit found
926 /* Unit was ordered to attack city so it might stay in
927 front of that city */
929 ptile = tile_before_end_path(punit, fui->ptile);
930 if (ptile == nullptr) {
931 ptile = fui->ptile;
932 }
933 } else {
934 ptile = fui->ptile;
935 }
936 // Unit found in transport
937 } else if (unit_contained_in(punit, zunit)) {
938 ptile = fui->ptile;
939 }
940 }
941 return nullptr;
942}
943
944/**********************************************************************/
947mr_menu::mr_menu() : QMenuBar()
948{
949}
950
951/**********************************************************************/
957{
958 QAction *act;
959 QMenu *sub_menu;
960 QMenu *main_menu;
962 int i;
963
964 delayed_order = false;
965 airlift_type_id = 0;
966 quick_airlifting = false;
967
968 // Game Menu
969 main_menu = this->addMenu(_("Game"));
970
971#ifdef __APPLE__
972 // On Mac, Qt would try to move menu entry named just "Options" to
973 // application menu, but as this is submenu and not an action
974 // 1) It would fail to appear in the destination
975 // 2) It's impossible to override the behavior with QAction::menuRule()
976 // We add an invisible character for the string comparison to fail.
977 sub_menu = main_menu->addMenu(QString("\u200B") + _("Options"));
978#else // __APPLE__
979 sub_menu = main_menu->addMenu(_("Options"));
980#endif // __APPLE__
981
982 act = sub_menu->addAction(_("Set local options"));
983 connect(act, &QAction::triggered, this, &mr_menu::local_options);
984 act = sub_menu->addAction(_("Server Options"));
985 connect(act, &QAction::triggered, this, &mr_menu::server_options);
986 act = sub_menu->addAction(_("Messages"));
987 connect(act, &QAction::triggered, this, &mr_menu::messages_options);
988 act = sub_menu->addAction(_("Shortcuts"));
989 connect(act, &QAction::triggered, this, &mr_menu::shortcut_options);
990 act = sub_menu->addAction(_("Load another tileset"));
991 connect(act, &QAction::triggered, this, &mr_menu::tileset_custom_load);
992 act = sub_menu->addAction(_("Save Options Now"));
993 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
994 connect(act, &QAction::triggered, this, &mr_menu::save_options_now);
995 act = sub_menu->addAction(_("Save Options on Exit"));
996 act->setCheckable(true);
997 act->setChecked(gui_options.save_options_on_exit);
998 main_menu->addSeparator();
999 act = main_menu->addAction(_("Save Game"));
1000 act->setShortcut(QKeySequence(tr("Ctrl+s")));
1001 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
1002 menu_list.insert(SAVE, act);
1003 connect(act, &QAction::triggered, this, &mr_menu::save_game);
1004 act = main_menu->addAction(_("Save Game As..."));
1005 menu_list.insert(SAVE, act);
1006 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
1007 connect(act, &QAction::triggered, this, &mr_menu::save_game_as);
1008 act = main_menu->addAction(_("Save Map to Image"));
1009 connect(act, &QAction::triggered, this, &mr_menu::save_image);
1010 main_menu->addSeparator();
1011 act = main_menu->addAction(_("Leave game"));
1012 act->setIcon(style()->standardIcon(QStyle::SP_DialogDiscardButton));
1013 connect(act, &QAction::triggered, this, &mr_menu::back_to_menu);
1014 act = main_menu->addAction(_("Quit"));
1015 act->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
1016 connect(act, &QAction::triggered, this, &mr_menu::quit_game);
1017
1018 // View Menu
1019 main_menu = this->addMenu(Q_("?verb:View"));
1020 act = main_menu->addAction(_("Center View"));
1021 act->setShortcut(QKeySequence(shortcut_to_string(
1022 fc_shortcuts::sc()->get_shortcut(SC_CENTER_VIEW))));
1023 connect(act, &QAction::triggered, this, &mr_menu::slot_center_view);
1024 main_menu->addSeparator();
1025 act = main_menu->addAction(_("Fullscreen"));
1026 act->setShortcut(QKeySequence(shortcut_to_string(
1027 fc_shortcuts::sc()->get_shortcut(SC_FULLSCREEN))));
1028 act->setCheckable(true);
1029 act->setChecked(gui_options.gui_qt_fullscreen);
1030 connect(act, &QAction::triggered, this, &mr_menu::slot_fullscreen);
1031 main_menu->addSeparator();
1032 minimap_status = main_menu->addAction(_("Minimap"));
1033 minimap_status->setCheckable(true);
1035 fc_shortcuts::sc()->get_shortcut(SC_MINIMAP))));
1036 minimap_status->setChecked(true);
1037 connect(minimap_status, &QAction::triggered, this,
1039 osd_status = main_menu->addAction(_("Show new turn information"));
1040 osd_status->setCheckable(true);
1041 osd_status->setChecked(gui()->qt_settings.show_new_turn_text);
1042 connect(osd_status, &QAction::triggered, this,
1044 btlog_status = main_menu->addAction(_("Show combat detailed information"));
1045 btlog_status->setCheckable(true);
1046 btlog_status->setChecked(gui()->qt_settings.show_battle_log);
1047 connect(btlog_status, &QAction::triggered, this, &mr_menu::slot_battlelog);
1048 lock_status = main_menu->addAction(_("Lock interface"));
1049 lock_status->setCheckable(true);
1051 fc_shortcuts::sc()->get_shortcut(SC_IFACE_LOCK))));
1052 lock_status->setChecked(false);
1053 connect(lock_status, &QAction::triggered, this, &mr_menu::slot_lock);
1054 connect(minimap_status, &QAction::triggered, this, &mr_menu::slot_lock);
1055 main_menu->addSeparator();
1056 act = main_menu->addAction(_("Zoom in"));
1057 act->setShortcut(QKeySequence(shortcut_to_string(
1058 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_IN))));
1059 connect(act, &QAction::triggered, this, &mr_menu::zoom_in);
1060 act = main_menu->addAction(_("Zoom default"));
1061 act->setShortcut(QKeySequence(shortcut_to_string(
1062 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_RESET))));
1063 connect(act, &QAction::triggered, this, &mr_menu::zoom_reset);
1064 act = main_menu->addAction(_("Zoom out"));
1065 act->setShortcut(QKeySequence(shortcut_to_string(
1066 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_OUT))));
1067 connect(act, &QAction::triggered, this, &mr_menu::zoom_out);
1068 scale_fonts_status = main_menu->addAction(_("Scale fonts"));
1069 connect(scale_fonts_status, &QAction::triggered, this,
1071 scale_fonts_status->setCheckable(true);
1072 scale_fonts_status->setChecked(true);
1073 main_menu->addSeparator();
1074 act = main_menu->addAction(_("City Outlines"));
1075 act->setCheckable(true);
1076 act->setChecked(gui_options.draw_city_outlines);
1077 connect(act, &QAction::triggered, this, &mr_menu::slot_city_outlines);
1078 act = main_menu->addAction(_("City Output"));
1079 act->setCheckable(true);
1080 act->setChecked(gui_options.draw_city_output);
1081 act->setShortcut(QKeySequence(shortcut_to_string(
1082 fc_shortcuts::sc()->get_shortcut(SC_CITY_OUTPUT))));
1083 connect(act, &QAction::triggered, this, &mr_menu::slot_city_output);
1084 act = main_menu->addAction(_("Map Grid"));
1085 act->setShortcut(QKeySequence(shortcut_to_string(
1086 fc_shortcuts::sc()->get_shortcut(SC_MAP_GRID))));
1087 act->setCheckable(true);
1088 act->setChecked(gui_options.draw_map_grid);
1089 connect(act, &QAction::triggered, this, &mr_menu::slot_map_grid);
1090 act = main_menu->addAction(_("National Borders"));
1091 act->setCheckable(true);
1092 act->setChecked(gui_options.draw_borders);
1093 act->setShortcut(QKeySequence(shortcut_to_string(
1094 fc_shortcuts::sc()->get_shortcut(SC_NAT_BORDERS))));
1095 connect(act, &QAction::triggered, this, &mr_menu::slot_borders);
1096 act = main_menu->addAction(_("Native Tiles"));
1097 act->setCheckable(true);
1098 act->setChecked(gui_options.draw_native);
1099 act->setShortcut(QKeySequence(tr("ctrl+shift+n")));
1100 connect(act, &QAction::triggered, this, &mr_menu::slot_native_tiles);
1101 act = main_menu->addAction(_("City Full Bar"));
1102 act->setCheckable(true);
1103 act->setShortcut(QKeySequence(shortcut_to_string(
1104 fc_shortcuts::sc()->get_shortcut(SC_SHOW_FULLBAR))));
1105 act->setChecked(gui_options.draw_full_citybar);
1106 connect(act, &QAction::triggered, this, &mr_menu::slot_fullbar);
1107 act = main_menu->addAction(_("City Names"));
1108 act->setCheckable(true);
1109 act->setChecked(gui_options.draw_city_names);
1110 act->setShortcut(QKeySequence(shortcut_to_string(
1111 fc_shortcuts::sc()->get_shortcut(SC_CITY_NAMES))));
1112 connect(act, &QAction::triggered, this, &mr_menu::slot_city_names);
1113 act = main_menu->addAction(_("City Growth"));
1114 act->setCheckable(true);
1115 act->setChecked(gui_options.draw_city_growth);
1116 act->setShortcut(QKeySequence(tr("ctrl+o")));
1117 connect(act, &QAction::triggered, this, &mr_menu::slot_city_growth);
1118 act = main_menu->addAction(_("City Production"));
1119 act->setCheckable(true);
1120 act->setChecked(gui_options.draw_city_productions);
1121 act->setShortcut(QKeySequence(shortcut_to_string(
1122 fc_shortcuts::sc()->get_shortcut(SC_CITY_PROD))));
1123 connect(act, &QAction::triggered, this, &mr_menu::slot_city_production);
1124 act = main_menu->addAction(_("City Buy Cost"));
1125 act->setCheckable(true);
1126 act->setChecked(gui_options.draw_city_buycost);
1127 connect(act, &QAction::triggered, this, &mr_menu::slot_city_buycost);
1128 act = main_menu->addAction(_("City Trade Routes"));
1129 act->setCheckable(true);
1130 act->setChecked(gui_options.draw_city_trade_routes);
1131 act->setShortcut(QKeySequence(shortcut_to_string(
1132 fc_shortcuts::sc()->get_shortcut(SC_TRADE_ROUTES))));
1133 connect(act, &QAction::triggered, this, &mr_menu::slot_city_trade_routes);
1134 act = main_menu->addAction(_("Unit Stack Size"));
1135 act->setCheckable(true);
1136 act->setChecked(gui_options.draw_unit_stack_size);
1137 act->setShortcut(QKeySequence(shortcut_to_string(
1138 fc_shortcuts::sc()->get_shortcut(SC_STACK_SIZE))));
1139 connect(act, &QAction::triggered, this, &mr_menu::slot_stack_size);
1140
1141 // Select Menu
1142 main_menu = this->addMenu(_("Select"));
1143 act = main_menu->addAction(_("Single Unit (Unselect Others)"));
1144 act->setShortcut(QKeySequence(tr("shift+z")));
1145 menu_list.insert(STANDARD, act);
1146 connect(act, &QAction::triggered, this, &mr_menu::slot_select_one);
1147 act = main_menu->addAction(_("All On Tile"));
1148 act->setShortcut(QKeySequence(tr("v")));
1149 menu_list.insert(STANDARD, act);
1150 connect(act, &QAction::triggered, this, &mr_menu::slot_select_all_tile);
1151 main_menu->addSeparator();
1152 act = main_menu->addAction(_("Same Type on Tile"));
1153 act->setShortcut(QKeySequence(tr("shift+v")));
1154 menu_list.insert(STANDARD, act);
1155 connect(act, &QAction::triggered, this, &mr_menu::slot_select_same_tile);
1156 act = main_menu->addAction(_("Same Type on Continent"));
1157 act->setShortcut(QKeySequence(tr("shift+c")));
1158 menu_list.insert(STANDARD, act);
1159 connect(act, &QAction::triggered, this,
1161 act = main_menu->addAction(_("Same Type Everywhere"));
1162 act->setShortcut(QKeySequence(tr("shift+x")));
1163 menu_list.insert(STANDARD, act);
1164 connect(act, &QAction::triggered, this,
1166 main_menu->addSeparator();
1167 act = main_menu->addAction(_("Wait"));
1168 act->setShortcut(QKeySequence(shortcut_to_string(
1169 fc_shortcuts::sc()->get_shortcut(SC_WAIT))));
1170 menu_list.insert(STANDARD, act);
1171 connect(act, &QAction::triggered, this, &mr_menu::slot_wait);
1172 act = main_menu->addAction(_("Done"));
1173 act->setShortcut(QKeySequence(shortcut_to_string(
1174 fc_shortcuts::sc()->get_shortcut(SC_DONE_MOVING))));
1175 menu_list.insert(STANDARD, act);
1176 connect(act, &QAction::triggered, this, &mr_menu::slot_done_moving);
1177
1178 act = main_menu->addAction(_("Advanced unit selection"));
1179 act->setShortcut(QKeySequence(tr("ctrl+e")));
1180 menu_list.insert(NOT_4_OBS, act);
1181 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_filter);
1182
1183 // Unit Menu
1184 main_menu = this->addMenu(_("Unit"));
1185 act = main_menu->addAction(_("Go to Tile"));
1186 act->setShortcut(QKeySequence(shortcut_to_string(
1187 fc_shortcuts::sc()->get_shortcut(SC_GOTO))));
1188 menu_list.insert(STANDARD, act);
1189 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_goto);
1190
1191 // The goto and act sub menu is handled as a separate object.
1192 main_menu->addMenu(new go_act_menu(this));
1193
1194 act = main_menu->addAction(_("Go to Nearest City"));
1195 act->setShortcut(QKeySequence(tr("shift+g")));
1196 menu_list.insert(GOTO_CITY, act);
1197 connect(act, &QAction::triggered, this, &mr_menu::slot_return_to_city);
1198 act = main_menu->addAction(_("Go to/Airlift to City..."));
1199 act->setShortcut(QKeySequence(shortcut_to_string(
1200 fc_shortcuts::sc()->get_shortcut(SC_GOTOAIRLIFT))));
1201 menu_list.insert(AIRLIFT, act);
1202 connect(act, &QAction::triggered, this, &mr_menu::slot_airlift);
1203 main_menu->addSeparator();
1204 act = main_menu->addAction(_("Auto Explore"));
1205 menu_list.insert(EXPLORE, act);
1206 act->setShortcut(QKeySequence(shortcut_to_string(
1207 fc_shortcuts::sc()->get_shortcut(SC_AUTOEXPLORE))));
1208 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_explore);
1209 act = main_menu->addAction(_("Patrol"));
1210 menu_list.insert(STANDARD, act);
1211 act->setEnabled(false);
1212 act->setShortcut(QKeySequence(shortcut_to_string(
1213 fc_shortcuts::sc()->get_shortcut(SC_PATROL))));
1214 connect(act, &QAction::triggered, this, &mr_menu::slot_patrol);
1215 main_menu->addSeparator();
1216 act = main_menu->addAction(_("Sentry"));
1217 act->setShortcut(QKeySequence(shortcut_to_string(
1218 fc_shortcuts::sc()->get_shortcut(SC_SENTRY))));
1219 menu_list.insert(SENTRY, act);
1220 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_sentry);
1221 act = main_menu->addAction(_("Unsentry All On Tile"));
1222 act->setShortcut(QKeySequence(shortcut_to_string(
1223 fc_shortcuts::sc()->get_shortcut(SC_UNSENTRY_TILE))));
1224 menu_list.insert(WAKEUP, act);
1225 connect(act, &QAction::triggered, this, &mr_menu::slot_unsentry);
1226 main_menu->addSeparator();
1227 act = main_menu->addAction(_("Load"));
1228 act->setShortcut(QKeySequence(shortcut_to_string(
1229 fc_shortcuts::sc()->get_shortcut(SC_BOARD))));
1230 menu_list.insert(BOARD, act);
1231 connect(act, &QAction::triggered, this, &mr_menu::slot_board);
1232 act = main_menu->addAction(_("Unload"));
1233 act->setShortcut(QKeySequence(shortcut_to_string(
1234 fc_shortcuts::sc()->get_shortcut(SC_DEBOARD))));
1235 menu_list.insert(DEBOARD, act);
1236 connect(act, &QAction::triggered, this, &mr_menu::slot_deboard);
1237 act = main_menu->addAction(_("Unload All From Transporter"));
1238 act->setShortcut(QKeySequence(tr("shift+t")));
1239 menu_list.insert(TRANSPORTER, act);
1240 connect(act, &QAction::triggered, this, &mr_menu::slot_unload_all);
1241 main_menu->addSeparator();
1242
1243 // Defeat keyboard shortcut mnemonics
1245 .replace("&", "&&"));
1246 menu_list.insert(HOMECITY, act);
1247 act->setShortcut(QKeySequence(shortcut_to_string(
1248 fc_shortcuts::sc()->get_shortcut(SC_SETHOME))));
1249 connect(act, &QAction::triggered, this, &mr_menu::slot_set_home);
1250 act = main_menu->addAction(_("Upgrade"));
1251 act->setShortcut(QKeySequence(shortcut_to_string(
1252 fc_shortcuts::sc()->get_shortcut(SC_UPGRADE_UNIT))));
1253 menu_list.insert(UPGRADE, act);
1254 connect(act, &QAction::triggered, this, &mr_menu::slot_upgrade);
1255 act = main_menu->addAction(_("Convert"));
1256 act->setShortcut(QKeySequence(tr("shift+o")));
1257 menu_list.insert(CONVERT, act);
1258 connect(act, &QAction::triggered, this, &mr_menu::slot_convert);
1259 act = main_menu->addAction(_("Disband"));
1260 act->setShortcut(QKeySequence(tr("shift+d")));
1261 menu_list.insert(DISBAND, act);
1262 connect(act, &QAction::triggered, this, &mr_menu::slot_disband);
1263
1264 // Combat Menu
1265 main_menu = this->addMenu(_("Combat"));
1266 act = main_menu->addAction(_("Fortify Unit"));
1267 menu_list.insert(FORTIFY, act);
1268 act->setShortcut(QKeySequence(shortcut_to_string(
1269 fc_shortcuts::sc()->get_shortcut(SC_FORTIFY))));
1270 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_fortify);
1271 act = main_menu->addAction(QString(Q_(terrain_control.gui_type_base0))
1272 .replace("&", "&&"));
1273 menu_list.insert(FORTRESS, act);
1274 act->setShortcut(QKeySequence(tr("shift+f")));
1275 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_fortress);
1276 act = main_menu->addAction(QString(Q_(terrain_control.gui_type_base1))
1277 .replace("&", "&&"));
1278 menu_list.insert(AIRBASE, act);
1279 act->setShortcut(QKeySequence(tr("shift+e")));
1280 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_airbase);
1281 bases_menu = main_menu->addMenu(_("Build Base"));
1282 main_menu->addSeparator();
1283 act = main_menu->addAction(_("Paradrop"));
1284 menu_list.insert(PARADROP, act);
1285 act->setShortcut(QKeySequence(shortcut_to_string(
1286 fc_shortcuts::sc()->get_shortcut(SC_PARADROP))));
1287 connect(act, &QAction::triggered, this, &mr_menu::slot_paradrop);
1288 act = main_menu->addAction(_("Pillage"));
1289 menu_list.insert(PILLAGE, act);
1290 act->setShortcut(QKeySequence(tr("shift+p")));
1291 connect(act, &QAction::triggered, this, &mr_menu::slot_pillage);
1292 // TRANS: Menu item to bring up the action selection dialog.
1293 act = main_menu->addAction(_("Do..."));
1294 menu_list.insert(ORDER_DIPLOMAT_DLG, act);
1295 act->setShortcut(QKeySequence(shortcut_to_string(
1296 fc_shortcuts::sc()->get_shortcut(SC_DO))));
1297 connect(act, &QAction::triggered, this, &mr_menu::slot_action);
1298
1299 // Work Menu
1300 main_menu = this->addMenu(_("Work"));
1302 .replace("&", "&&"));
1303 act->setShortcut(QKeySequence(shortcut_to_string(
1304 fc_shortcuts::sc()->get_shortcut(SC_BUILDCITY))));
1305 menu_list.insert(BUILD, act);
1306 connect(act, &QAction::triggered, this, &mr_menu::slot_build_city);
1307 act = main_menu->addAction(_("Auto Settler"));
1308 act->setShortcut(QKeySequence(shortcut_to_string(
1309 fc_shortcuts::sc()->get_shortcut(SC_AUTOMATE))));
1310 menu_list.insert(AUTOSETTLER, act);
1311 connect(act, &QAction::triggered, this, &mr_menu::slot_auto_settler);
1312 main_menu->addSeparator();
1313 act = main_menu->addAction(_("Build Road"));
1314 menu_list.insert(ROAD, act);
1315 act->setShortcut(QKeySequence(shortcut_to_string(
1316 fc_shortcuts::sc()->get_shortcut(SC_BUILDROAD))));
1317 connect(act, &QAction::triggered, this, &mr_menu::slot_build_road);
1318 roads_menu = main_menu->addMenu(_("Build Path"));
1319 act = main_menu->addAction(_("Build Irrigation"));
1320 act->setShortcut(QKeySequence(shortcut_to_string(
1321 fc_shortcuts::sc()->get_shortcut(SC_BUILDIRRIGATION))));
1322 menu_list.insert(IRRIGATION, act);
1323 connect(act, &QAction::triggered, this, &mr_menu::slot_build_irrigation);
1324 act = main_menu->addAction(_("Cultivate"));
1325 act->setShortcut(QKeySequence(shortcut_to_string(
1326 fc_shortcuts::sc()->get_shortcut(SC_CULTIVATE))));
1327 menu_list.insert(CULTIVATE, act);
1328 connect(act, &QAction::triggered, this, &mr_menu::slot_cultivate);
1329 act = main_menu->addAction(_("Build Mine"));
1330 act->setShortcut(QKeySequence(shortcut_to_string(
1331 fc_shortcuts::sc()->get_shortcut(SC_BUILDMINE))));
1332 menu_list.insert(MINE, act);
1333 connect(act, &QAction::triggered, this, &mr_menu::slot_build_mine);
1334 act = main_menu->addAction(_("Plant"));
1335 act->setShortcut(QKeySequence(shortcut_to_string(
1336 fc_shortcuts::sc()->get_shortcut(SC_PLANT))));
1337 menu_list.insert(PLANT, act);
1338 connect(act, &QAction::triggered, this, &mr_menu::slot_plant);
1339 main_menu->addSeparator();
1340 act = main_menu->addAction(_("Connect With Road"));
1341 act->setShortcut(QKeySequence(tr("ctrl+r")));
1342 menu_list.insert(CONNECT_ROAD, act);
1343 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_road);
1344 act = main_menu->addAction(_("Connect With Railroad"));
1345 menu_list.insert(CONNECT_RAIL, act);
1346 act->setShortcut(QKeySequence(tr("ctrl+l")));
1347 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_rail);
1348 act = main_menu->addAction(_("Connect With Maglev"));
1349 menu_list.insert(CONNECT_MAGLEV, act);
1350 act->setShortcut(QKeySequence(tr("ctrl+m")));
1351 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_maglev);
1352 act = main_menu->addAction(_("Connect With Irrigation"));
1353 menu_list.insert(CONNECT_IRRIGATION, act);
1354 act->setShortcut(QKeySequence(tr("ctrl+i")));
1355 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_irrigation);
1356 main_menu->addSeparator();
1357 act = main_menu->addAction(_("Transform Terrain"));
1358 menu_list.insert(TRANSFORM, act);
1359 act->setShortcut(QKeySequence(shortcut_to_string(
1360 fc_shortcuts::sc()->get_shortcut(SC_TRANSFORM))));
1361 connect(act, &QAction::triggered, this, &mr_menu::slot_transform);
1362 act = main_menu->addAction(_("Clean"));
1363 menu_list.insert(CLEAN, act);
1364 act->setShortcut(QKeySequence(shortcut_to_string(
1365 fc_shortcuts::sc()->get_shortcut(SC_CLEAN))));
1366 connect(act, &QAction::triggered, this, &mr_menu::slot_clean);
1368 .replace("&", "&&"));
1369 act->setShortcut(QKeySequence(tr("b")));
1370 menu_list.insert(BUILD_WONDER, act);
1371 connect(act, &QAction::triggered, this, &mr_menu::slot_build_city);
1373 .replace("&", "&&"));
1374 act->setShortcut(QKeySequence(tr("r")));
1375 menu_list.insert(ORDER_TRADE_ROUTE, act);
1376 connect(act, &QAction::triggered, this, &mr_menu::slot_build_road);
1377
1378 // Multiplayer Menu
1379 multiplayer_menu = this->addMenu(_("Multiplayer"));
1380 act = multiplayer_menu->addAction(_("Delayed Goto"));
1381 act->setShortcut(QKeySequence(tr("z")));
1382 connect(act, &QAction::triggered, this, &mr_menu::slot_delayed_goto);
1383 act = multiplayer_menu->addAction(_("Delayed Orders Execute"));
1384 act->setShortcut(QKeySequence(tr("ctrl+z")));
1385 connect(act, &QAction::triggered, this, &mr_menu::slot_execute_orders);
1386 act = multiplayer_menu->addAction(_("Clear Orders"));
1387 act->setShortcut(QKeySequence(tr("ctrl+shift+c")));
1388 connect(act, &QAction::triggered, this, &mr_menu::slot_orders_clear);
1389 act = multiplayer_menu->addAction(_("Add all cities to trade planning"));
1390 connect(act, &QAction::triggered, this, &mr_menu::slot_trade_add_all);
1391 act = multiplayer_menu->addAction(_("Calculate trade planning"));
1392 connect(act, &QAction::triggered, this, &mr_menu::slot_calculate);
1393 act = multiplayer_menu->addAction(_("Add/Remove City"));
1394 act->setShortcut(QKeySequence(tr("ctrl+t")));
1395 connect(act, &QAction::triggered, this, &mr_menu::slot_trade_city);
1396 act = multiplayer_menu->addAction(_("Clear Trade Planning"));
1397 connect(act, &QAction::triggered, this, &mr_menu::slot_clear_trade);
1398 act = multiplayer_menu->addAction(_("Automatic caravan"));
1399 menu_list.insert(AUTOTRADEROUTE, act);
1400 connect(act, &QAction::triggered, this, &mr_menu::slot_autocaravan);
1401 act->setShortcut(QKeySequence(tr("ctrl+j")));
1402 act = multiplayer_menu->addAction(_("Set/Unset rally point"));
1403 act->setShortcut(QKeySequence(tr("shift+s")));
1404 connect(act, &QAction::triggered, this, &mr_menu::slot_rally);
1405 act = multiplayer_menu->addAction(_("Quick Airlift"));
1406 act->setShortcut(QKeySequence(tr("ctrl+y")));
1407 connect(act, &QAction::triggered, this, &mr_menu::slot_quickairlift);
1408 airlift_type = new QActionGroup(this);
1409 airlift_menu = multiplayer_menu->addMenu(_("Unit type for quickairlifting"));
1410
1411 // Default diplo
1412 action_vs_city = new QActionGroup(this);
1413 action_vs_unit = new QActionGroup(this);
1414 action_unit_menu = multiplayer_menu->addMenu(_("Default action vs unit"));
1415
1416 act = action_unit_menu->addAction(_("Ask"));
1417 act->setCheckable(true);
1418 act->setChecked(true);
1419 act->setData(-1);
1420 action_vs_unit->addAction(act);
1421 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1422
1423 act = action_unit_menu->addAction(_("Bribe"));
1424 act->setCheckable(true);
1425 act->setChecked(false);
1426 act->setData(ACTION_SPY_BRIBE_UNIT);
1427 action_vs_unit->addAction(act);
1428 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1429
1430 act = action_unit_menu->addAction(_("Sabotage"));
1431 act->setCheckable(true);
1432 act->setChecked(false);
1433 act->setData(ACTION_SPY_SABOTAGE_UNIT);
1434 action_vs_unit->addAction(act);
1435 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1436
1437 act = action_unit_menu->addAction(_("Sabotage Unit Escape"));
1438 act->setCheckable(true);
1439 act->setChecked(false);
1440 act->setData(ACTION_SPY_SABOTAGE_UNIT_ESC);
1441 action_vs_unit->addAction(act);
1442 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_unit);
1443
1444 action_city_menu = multiplayer_menu->addMenu(_("Default action vs city"));
1445 act = action_city_menu->addAction(_("Ask"));
1446 act->setCheckable(true);
1447 act->setChecked(true);
1448 act->setData(-1);
1449 action_vs_city->addAction(act);
1450 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1451
1452 act = action_city_menu->addAction(_("Investigate city"));
1453 act->setCheckable(true);
1454 act->setChecked(false);
1455 act->setData(ACTION_SPY_INVESTIGATE_CITY);
1456 action_vs_city->addAction(act);
1457 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1458
1459 act = action_city_menu->addAction(_("Investigate city (spends the unit)"));
1460 act->setCheckable(true);
1461 act->setChecked(false);
1462 act->setData(ACTION_INV_CITY_SPEND);
1463 action_vs_city->addAction(act);
1464 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1465
1466 act = action_city_menu->addAction(_("Establish embassy"));
1467 act->setCheckable(true);
1468 act->setChecked(false);
1469 act->setData(ACTION_ESTABLISH_EMBASSY);
1470 action_vs_city->addAction(act);
1471 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1472
1473 act = action_city_menu->addAction(_("Become Ambassador"));
1474 act->setCheckable(true);
1475 act->setChecked(false);
1476 act->setData(ACTION_ESTABLISH_EMBASSY_STAY);
1477 action_vs_city->addAction(act);
1478 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1479
1480 act = action_city_menu->addAction(_("Steal technology"));
1481 act->setCheckable(true);
1482 act->setChecked(false);
1483 act->setData(ACTION_SPY_STEAL_TECH);
1484 action_vs_city->addAction(act);
1485 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1486
1487 act = action_city_menu->addAction(_("Steal technology and escape"));
1488 act->setCheckable(true);
1489 act->setChecked(false);
1490 act->setData(ACTION_SPY_STEAL_TECH_ESC);
1491 action_vs_city->addAction(act);
1492 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1493
1494 act = action_city_menu->addAction(_("Incite a revolt"));
1495 act->setCheckable(true);
1496 act->setChecked(false);
1497 act->setData(ACTION_SPY_INCITE_CITY);
1498 action_vs_city->addAction(act);
1499 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1500
1501 act = action_city_menu->addAction(_("Incite a Revolt and Escape"));
1502 act->setCheckable(true);
1503 act->setChecked(false);
1504 act->setData(ACTION_SPY_INCITE_CITY_ESC);
1505 action_vs_city->addAction(act);
1506 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1507
1508 act = action_city_menu->addAction(_("Poison city"));
1509 act->setCheckable(true);
1510 act->setChecked(false);
1511 act->setData(ACTION_SPY_POISON);
1512 action_vs_city->addAction(act);
1513 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1514
1515 act = action_city_menu->addAction(_("Poison City Escape"));
1516 act->setCheckable(true);
1517 act->setChecked(false);
1518 act->setData(ACTION_SPY_POISON_ESC);
1519 action_vs_city->addAction(act);
1520 connect(act, &QAction::triggered, this, &mr_menu::slot_action_vs_city);
1521
1522 // Civilization menu
1523 main_menu = this->addMenu(_("Civilization"));
1524 act = main_menu->addAction(_("Tax Rates..."));
1525 menu_list.insert(NOT_4_OBS, act);
1526 connect(act, &QAction::triggered, this, &mr_menu::slot_popup_tax_rates);
1527 main_menu->addSeparator();
1528
1529 act = main_menu->addAction(_("Policies..."));
1530 menu_list.insert(MULTIPLIERS, act);
1531 connect(act, &QAction::triggered, this, &mr_menu::slot_popup_mult_rates);
1532 main_menu->addSeparator();
1533
1534 main_menu->addMenu(new class gov_menu(this));
1535 main_menu->addSeparator();
1536
1537 act = main_menu->addAction(Q_("?noun:View"));
1538 act->setShortcut(QKeySequence(tr("F1")));
1539 connect(act, &QAction::triggered, this, &mr_menu::slot_show_map);
1540
1541 act = main_menu->addAction(_("Units"));
1542 act->setShortcut(QKeySequence(tr("F2")));
1543 connect(act, &QAction::triggered, this, &mr_menu::slot_show_units_report);
1544
1545 act = main_menu->addAction(_("Nations"));
1546 act->setShortcut(QKeySequence(tr("F3")));
1547 connect(act, &QAction::triggered, this, &mr_menu::slot_show_nations);
1548
1549 act = main_menu->addAction(_("Cities"));
1550 act->setShortcut(QKeySequence(tr("F4")));
1551 connect(act, &QAction::triggered, this, &mr_menu::slot_show_cities);
1552
1553 act = main_menu->addAction(_("Economy"));
1554 act->setShortcut(QKeySequence(tr("F5")));
1555 connect(act, &QAction::triggered, this, &mr_menu::slot_show_eco_report);
1556
1557 act = main_menu->addAction(_("Research"));
1558 act->setShortcut(QKeySequence(tr("F6")));
1559 connect(act, &QAction::triggered, this, &mr_menu::slot_show_research_tab);
1560
1561 act = main_menu->addAction(_("Wonders of the World"));
1562 act->setShortcut(QKeySequence(tr("F7")));
1563 connect(act, &QAction::triggered, this, &mr_menu::slot_traveler);
1564
1565 act = main_menu->addAction(_("Top Cities"));
1566 act->setShortcut(QKeySequence(tr("F8")));
1567 menu_list.insert(TOP_CITIES, act);
1568 connect(act, &QAction::triggered, this, &mr_menu::slot_top_cities);
1569
1570 act = main_menu->addAction(_("Demographics"));
1571 act->setShortcut(QKeySequence(tr("F11")));
1572 connect(act, &QAction::triggered, this, &mr_menu::slot_demographics);
1573
1574 act = main_menu->addAction(_("Spaceship"));
1575 act->setShortcut(QKeySequence(tr("F12")));
1576 connect(act, &QAction::triggered, this, &mr_menu::slot_spaceship);
1577
1578 act = main_menu->addAction(_("Achievements"));
1579 connect(act, &QAction::triggered, this, &mr_menu::slot_achievements);
1580
1581 act = main_menu->addAction(_("Endgame report"));
1582 menu_list.insert(ENDGAME, act);
1583 connect(act, &QAction::triggered, this, &mr_menu::slot_endgame);
1584
1585 // Battle Groups Menu
1586 main_menu = this->addMenu(_("Battle Groups"));
1587
1588 act = main_menu->addAction(_("Select Battle Group 1"));
1589 act->setShortcut(QKeySequence(tr("Shift+F1")));
1590 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1select);
1591
1592 act = main_menu->addAction(_("Assign Battle Group 1"));
1593 act->setShortcut(QKeySequence(tr("Ctrl+F1")));
1594 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1assign);
1595
1596 act = main_menu->addAction(_("Append to Battle Group 1"));
1597 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F1")));
1598 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1append);
1599
1600 act = main_menu->addAction(_("Select Battle Group 2"));
1601 act->setShortcut(QKeySequence(tr("Shift+F2")));
1602 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2select);
1603
1604 act = main_menu->addAction(_("Assign Battle Group 2"));
1605 act->setShortcut(QKeySequence(tr("Ctrl+F2")));
1606 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2assign);
1607
1608 act = main_menu->addAction(_("Append to Battle Group 2"));
1609 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F2")));
1610 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2append);
1611
1612 act = main_menu->addAction(_("Select Battle Group 3"));
1613 act->setShortcut(QKeySequence(tr("Shift+F3")));
1614 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3select);
1615
1616 act = main_menu->addAction(_("Assign Battle Group 3"));
1617 act->setShortcut(QKeySequence(tr("Ctrl+F3")));
1618 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3assign);
1619
1620 act = main_menu->addAction(_("Append to Battle Group 3"));
1621 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F3")));
1622 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3append);
1623
1624 act = main_menu->addAction(_("Select Battle Group 4"));
1625 act->setShortcut(QKeySequence(tr("Shift+F4")));
1626 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4select);
1627
1628 act = main_menu->addAction(_("Assign Battle Group 4"));
1629 act->setShortcut(QKeySequence(tr("Ctrl+F4")));
1630 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4assign);
1631
1632 act = main_menu->addAction(_("Append to Battle Group 4"));
1633 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F4")));
1634 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4append);
1635
1636 // Help Menu
1637 main_menu = this->addMenu(_("Help"));
1638
1639 act = main_menu->addAction(Q_(HELP_OVERVIEW_ITEM));
1640 QObject::connect(act, &QAction::triggered, [this]() {
1642 });
1643
1644 act = main_menu->addAction(Q_(HELP_PLAYING_ITEM));
1645 QObject::connect(act, &QAction::triggered, [this]() {
1647 });
1648
1649 act = main_menu->addAction(Q_(HELP_TERRAIN_ITEM));
1650 QObject::connect(act, &QAction::triggered, [this]() {
1652 });
1653
1654 act = main_menu->addAction(Q_(HELP_ECONOMY_ITEM));
1655 QObject::connect(act, &QAction::triggered, [this]() {
1657 });
1658
1659 act = main_menu->addAction(Q_(HELP_CITIES_ITEM));
1660 QObject::connect(act, &QAction::triggered, [this]() {
1662 });
1663
1664 act = main_menu->addAction(Q_(HELP_IMPROVEMENTS_ITEM));
1665 QObject::connect(act, &QAction::triggered, [this]() {
1667 });
1668
1669 act = main_menu->addAction(Q_(HELP_WONDERS_ITEM));
1670 QObject::connect(act, &QAction::triggered, [this]() {
1672 });
1673
1674 act = main_menu->addAction(Q_(HELP_UNITS_ITEM));
1675 QObject::connect(act, &QAction::triggered, [this]() {
1677 });
1678
1679 act = main_menu->addAction(Q_(HELP_COMBAT_ITEM));
1680 QObject::connect(act, &QAction::triggered, [this]() {
1682 });
1683
1684 act = main_menu->addAction(Q_(HELP_ZOC_ITEM));
1685 QObject::connect(act, &QAction::triggered, [this]() {
1687 });
1688
1689 act = main_menu->addAction(Q_(HELP_GOVERNMENT_ITEM));
1690 QObject::connect(act, &QAction::triggered, [this]() {
1692 });
1693
1694 act = main_menu->addAction(Q_(HELP_ECONOMY_ITEM));
1695 QObject::connect(act, &QAction::triggered, [this]() {
1697 });
1698
1699 act = main_menu->addAction(Q_(HELP_DIPLOMACY_ITEM));
1700 QObject::connect(act, &QAction::triggered, [this]() {
1702 });
1703
1704 act = main_menu->addAction(Q_(HELP_TECHS_ITEM));
1705 QObject::connect(act, &QAction::triggered, [this]() {
1707 });
1708
1709 act = main_menu->addAction(Q_(HELP_SPACE_RACE_ITEM));
1710 QObject::connect(act, &QAction::triggered, [this]() {
1712 });
1713
1714 act = main_menu->addAction(Q_(HELP_IMPROVEMENTS_ITEM));
1715 QObject::connect(act, &QAction::triggered, [this]() {
1717 });
1718
1719 act = main_menu->addAction(Q_(HELP_RULESET_ITEM));
1720 QObject::connect(act, &QAction::triggered, [this]() {
1722 });
1723
1724 act = main_menu->addAction(Q_(HELP_TILESET_ITEM));
1725 QObject::connect(act, &QAction::triggered, [this]() {
1727 });
1728
1729 act = main_menu->addAction(Q_(HELP_MUSICSET_ITEM));
1730 QObject::connect(act, &QAction::triggered, [this]() {
1732 });
1733
1734 act = main_menu->addAction(Q_(HELP_NATIONS_ITEM));
1735 QObject::connect(act, &QAction::triggered, [this]() {
1737 });
1738
1739 main_menu->addSeparator();
1740
1741 act = main_menu->addAction(Q_(HELP_CONNECTING_ITEM));
1742 QObject::connect(act, &QAction::triggered, [this]() {
1744 });
1745
1746 act = main_menu->addAction(Q_(HELP_CONTROLS_ITEM));
1747 QObject::connect(act, &QAction::triggered, [this]() {
1749 });
1750
1751 act = main_menu->addAction(Q_(HELP_CMA_ITEM));
1752 QObject::connect(act, &QAction::triggered, [this]() {
1754 });
1755
1756 act = main_menu->addAction(Q_(HELP_CHATLINE_ITEM));
1757 QObject::connect(act, &QAction::triggered, [this]() {
1759 });
1760
1761 act = main_menu->addAction(Q_(HELP_WORKLIST_EDITOR_ITEM));
1762 QObject::connect(act, &QAction::triggered, [this]() {
1764 });
1765
1766 main_menu->addSeparator();
1767
1768 act = main_menu->addAction(Q_(HELP_LANGUAGES_ITEM));
1769 QObject::connect(act, &QAction::triggered, [this]() {
1771 });
1772
1773 act = main_menu->addAction(Q_(HELP_COPYING_ITEM));
1774 QObject::connect(act, &QAction::triggered, [this]() {
1776 });
1777
1778 act = main_menu->addAction(Q_(HELP_ABOUT_ITEM));
1779 QObject::connect(act, &QAction::triggered, [this]() {
1781 });
1782
1783 menus = this->findChildren<QMenu*>();
1784 for (i = 0; i < menus.count(); i++) {
1785 menus[i]->setAttribute(Qt::WA_TranslucentBackground);
1786 }
1787
1788 this->setVisible(false);
1789}
1790
1791/**********************************************************************/
1795{
1796 for (int i = 0; i < units_list.nr_units; i++) {
1797 units_list.unit_list.at(units_list.unit_list.count() - i -1)->ptile = ptile;
1798 }
1799}
1800
1801/**********************************************************************/
1807{
1808 foreach (QAction *a, m->actions()) {
1809 if (a->shortcut() == seq && a->isEnabled()) {
1810 a->activate(QAction::Trigger);
1811 return TRUE;
1812 }
1813 }
1814
1815 return FALSE;
1816}
1817
1818/**********************************************************************/
1822{
1826
1827 if (sid == SC_GOTO) {
1828 gui()->mapview_wdg->menu_click = true;
1830 return;
1831 }
1832 fcs = fc_shortcuts::sc()->get_shortcut(static_cast<shortcut_id>(sid));
1834
1836 foreach (const QMenu *m, menus) {
1838 return;
1839 }
1840 }
1841}
1842
1843/**********************************************************************/
1850{
1851 foreach (QAction *a, m->actions()) {
1852 if (a->shortcut() == seq && fcs->mouse == Qt::AllButtons) {
1853 *ret = a->text();
1854
1855 return TRUE;
1856 }
1857 }
1858
1859 return FALSE;
1860}
1861
1862/**********************************************************************/
1866{
1869
1872 foreach (const QMenu *m, menus) {
1873 QString ret;
1874
1875 if (shortcut_exist_inner(m, seq, fcs, &ret)) {
1876 return ret;
1877 }
1878 }
1879
1880 return QString();
1881}
1882
1883/**********************************************************************/
1889 QString *ret)
1890{
1891 foreach (QAction *a, m->actions()) {
1892 if (a->shortcut() == seq) {
1893 *ret = a->text() + " ("
1894 + a->shortcut().toString(QKeySequence::NativeText) + ")";
1895
1896 return TRUE;
1897 }
1898 }
1899
1900 return FALSE;
1901}
1902
1903/**********************************************************************/
1907{
1911
1912 fcs = fc_shortcuts::sc()->get_shortcut(static_cast<shortcut_id>(sid));
1914
1916 foreach (const QMenu *m, menus) {
1917 QString ret;
1918
1920 return ret;
1921 }
1922 }
1923
1924 return QString();
1925}
1926
1927/**********************************************************************/
1931{
1933 QAction *act;
1934
1935 airlift_menu->clear();
1936 if (client_is_observer()) {
1937 return;
1938 }
1939 unit_type_iterate(utype) {
1940 utype_id = utype_index(utype);
1941
1943 || !utype_can_do_action(utype, ACTION_AIRLIFT)) {
1944 continue;
1945 }
1948 continue;
1949 }
1950 // Defeat keyboard shortcut mnemonics
1951 act = airlift_menu->addAction(QString(utype_name_translation(utype))
1952 .replace("&", "&&"));
1953 act->setCheckable(true);
1954 act->setData(utype_id);
1955 if (airlift_type_id == utype_id) {
1956 act->setChecked(true);
1957 }
1958 connect(act, &QAction::triggered, this, &mr_menu::slot_quickairlift_set);
1959 airlift_type->addAction(act);
1961}
1962
1963/****************************************************************************
1964 Updates "build path" menu
1965****************************************************************************/
1967{
1968 QAction *act;
1969 struct unit_list *punits = nullptr;
1970 bool enabled = false;
1971
1972 foreach(act, roads_menu->actions()) {
1973 removeAction(act);
1974 act->deleteLater();
1975 }
1976 roads_menu->clear();
1977 roads_menu->setDisabled(true);
1978 if (client_is_observer()) {
1979 return;
1980 }
1981
1984 if (pextra->buildable) {
1985 int road_id;
1986
1987 // Defeat keyboard shortcut mnemonics
1988 act = roads_menu->addAction(QString(extra_name_translation(pextra))
1989 .replace("&", "&&"));
1990 road_id = pextra->id;
1991 act->setData(road_id);
1992 QObject::connect(act, &QAction::triggered, [this,road_id]() {
1994 });
1996 ACTIVITY_GEN_ROAD, pextra)) {
1997 act->setEnabled(true);
1998 enabled = true;
1999 } else {
2000 act->setDisabled(true);
2001 }
2002 }
2004
2005 if (enabled) {
2006 roads_menu->setEnabled(true);
2007 }
2008}
2009
2010/****************************************************************************
2011 Updates "build bases" menu
2012****************************************************************************/
2014{
2015 QAction *act;
2016 struct unit_list *punits = nullptr;
2017 bool enabled = false;
2018
2019 foreach(act, bases_menu->actions()) {
2020 removeAction(act);
2021 act->deleteLater();
2022 }
2023 bases_menu->clear();
2024 bases_menu->setDisabled(true);
2025
2026 if (client_is_observer()) {
2027 return;
2028 }
2029
2032 if (pextra->buildable) {
2033 int base_id;
2034
2035 // Defeat keyboard shortcut mnemonics
2036 act = bases_menu->addAction(QString(extra_name_translation(pextra))
2037 .replace("&", "&&"));
2038 base_id = pextra->id;
2039 act->setData(base_id);
2040 QObject::connect(act, &QAction::triggered, [this,base_id]() {
2042 });
2044 act->setEnabled(true);
2045 enabled = true;
2046 } else {
2047 act->setDisabled(true);
2048 }
2049 }
2051
2052 if (enabled) {
2053 bases_menu->setEnabled(true);
2054 }
2055}
2056
2057/**********************************************************************/
2061{
2062 QList <QAction * >values;
2064 QMultiHash <munit, QAction *>::iterator i;
2065 struct unit_list *punits = nullptr;
2066 struct road_type *proad;
2067 struct extra_type *tgt;
2068 bool any_cities = false;
2069 bool city_on_tile = false;
2070 bool units_all_same_tile = true;
2071 const struct tile *ptile = NULL;
2072 const struct unit_type *ptype = NULL;
2073
2074 players_iterate(pplayer) {
2075 if (city_list_size(pplayer->cities)) {
2076 any_cities = true;
2077 break;
2078 }
2080
2081 // Disable first all sensitive menus
2082 foreach(QAction *a, menu_list) {
2083 a->setEnabled(false);
2084 }
2085
2086 if (client_is_observer()) {
2087 multiplayer_menu->setDisabled(true);
2088 } else {
2089 multiplayer_menu->setDisabled(false);
2090 }
2091
2092 // Non unit menus
2093 keys = menu_list.keys();
2094 foreach (munit key, keys) {
2095 i = menu_list.find(key);
2096 while (i != menu_list.end() && i.key() == key) {
2097 switch (key) {
2098 case SAVE:
2100 i.value()->setEnabled(true);
2101 }
2102 break;
2103 case NOT_4_OBS:
2104 if (!client_is_observer()) {
2105 i.value()->setEnabled(true);
2106 }
2107 break;
2108 case MULTIPLIERS:
2109 if (!client_is_observer() && multiplier_count() > 0) {
2110 i.value()->setEnabled(true);
2111 i.value()->setVisible(true);
2112 } else {
2113 i.value()->setVisible(false);
2114 }
2115 break;
2116 case ENDGAME:
2117 if (gui()->is_repo_dlg_open("END")) {
2118 i.value()->setEnabled(true);
2119 i.value()->setVisible(true);
2120 } else {
2121 i.value()->setVisible(false);
2122 }
2123 break;
2124 case TOP_CITIES:
2125 i.value()->setEnabled(game.info.top_cities_count > 0);
2126 if (game.info.top_cities_count > 0) {
2127 i.value()->setText(QString(PL_("Top %1 City", "Top %1 Cities",
2129 .arg(game.info.top_cities_count));
2130 } else {
2131 i.value()->setText(QString(_("Top Cities")));
2132 }
2133 break;
2134 default:
2135 break;
2136 }
2137 i++;
2138 }
2139 }
2140
2142 return;
2143 }
2144
2147 if (tile_city(unit_tile(punit))) {
2148 city_on_tile = true;
2149 break;
2150 }
2152
2154 const struct unit_type *ntype;
2155
2156 fc_assert((ptile == NULL) == (ptype == NULL));
2157
2159
2160 // 'ntype == ptype' is correct check even when ptype is still nullptr
2161 if (ptile != nullptr && ntype == ptype && unit_tile(punit) != ptile) {
2162 units_all_same_tile = false;
2163 }
2164
2165 if (ptype == nullptr || ntype == ptype) {
2166 ptile = unit_tile(punit);
2167 ptype = ntype;
2168 }
2170
2171 keys = menu_list.keys();
2172 foreach(munit key, keys) {
2173 i = menu_list.find(key);
2174 while (i != menu_list.end() && i.key() == key) {
2175 switch (key) {
2176 case STANDARD:
2177 i.value()->setEnabled(true);
2178 break;
2179
2180 case EXPLORE:
2182 i.value()->setEnabled(true);
2183 }
2184 break;
2185
2186 case BOARD:
2187 if (units_can_load(punits)) {
2188 i.value()->setEnabled(true);
2189 }
2190 break;
2191
2192 case DEBOARD:
2193 if (units_can_unload(punits)) {
2194 i.value()->setEnabled(true);
2195 }
2196 break;
2197
2198 case TRANSPORTER:
2200 i.value()->setEnabled(true);
2201 }
2202 break;
2203
2204 case CONVERT:
2205 if (units_can_convert(&(wld.map), punits)) {
2206 i.value()->setEnabled(true);
2207 }
2208 break;
2209
2210 case MINE:
2212 i.value()->setEnabled(true);
2213 }
2214
2215 if (units_all_same_tile) {
2217 struct extra_type *pextra = NULL;
2218
2219 /* FIXME: this overloading doesn't work well with multiple focus
2220 * units. */
2224 if (pextra != NULL) {
2225 break;
2226 }
2228
2229 if (pextra != NULL) {
2230 i.value()->setText(
2231 // TRANS: Build mine of specific type
2232 QString(_("Build %1"))
2233 .arg(extra_name_translation(pextra))
2234 .replace("&", "&&"));
2235 } else {
2236 i.value()->setText(QString(_("Build Mine")));
2237 }
2238 } else {
2239 i.value()->setText(QString(_("Build Mine")));
2240 }
2241 }
2242 break;
2243
2244 case IRRIGATION:
2246 i.value()->setEnabled(true);
2247 }
2248 if (units_all_same_tile) {
2250 struct extra_type *pextra = NULL;
2251
2252 /* FIXME: this overloading doesn't work well with multiple focus
2253 * units. */
2257 if (pextra != NULL) {
2258 break;
2259 }
2261
2262 if (pextra != NULL) {
2263 i.value()->setText(
2264 // TRANS: Build irrigation of specific type
2265 QString(_("Build %1"))
2266 .arg(extra_name_translation(pextra))
2267 .replace("&", "&&"));
2268 } else {
2269 i.value()->setText(QString(_("Build Irrigation")));
2270 }
2271 } else {
2272 i.value()->setText(QString(_("Build Irrigation")));
2273 }
2274 }
2275 break;
2276
2277 case CULTIVATE:
2279 i.value()->setEnabled(true);
2280 }
2281 if (units_all_same_tile) {
2282 struct unit *punit = unit_list_get(punits, 0);
2283 struct tile *atile = unit_tile(punit);
2284 struct terrain *pterrain = tile_terrain(atile);
2285
2286 if (pterrain->cultivate_result != T_NONE) {
2287 i.value()->setText(
2288 // TRANS: Transform terrain to specific type
2289 QString(_("Cultivate to %1"))
2291 .replace("&", "&&"));
2292 } else {
2293 i.value()->setText(QString(_("Cultivate")));
2294 }
2295 } else {
2296 i.value()->setText(QString(_("Cultivate")));
2297 }
2298 break;
2299
2300 case PLANT:
2302 i.value()->setEnabled(true);
2303 }
2304 if (units_all_same_tile) {
2305 struct unit *punit = unit_list_get(punits, 0);
2306 struct tile *atile = unit_tile(punit);
2307 struct terrain *pterrain = tile_terrain(atile);
2308
2309 if (pterrain->plant_result != T_NONE) {
2310 i.value()->setText(
2311 // TRANS: Transform terrain to specific type
2312 QString(_("Plant to %1"))
2314 .replace("&", "&&"));
2315 } else {
2316 i.value()->setText(QString(_("Plant")));
2317 }
2318 } else {
2319 i.value()->setText(QString(_("Plant")));
2320 }
2321 break;
2322
2323 case TRANSFORM:
2325 i.value()->setEnabled(true);
2326 } else {
2327 break;
2328 }
2329 if (units_all_same_tile) {
2330 struct unit *punit = unit_list_get(punits, 0);
2331 struct tile *atile = unit_tile(punit);
2332 struct terrain *pterrain = tile_terrain(atile);
2333
2334 if (pterrain->transform_result != T_NONE
2335 && pterrain->transform_result != pterrain) {
2336 i.value()->setText(
2337 // TRANS: Transform terrain to specific type
2338 QString(_("Transform to %1"))
2340 .replace("&", "&&"));
2341 } else {
2342 i.value()->setText(_("Transform Terrain"));
2343 }
2344 }
2345 break;
2346
2347 case BUILD:
2350 i.value()->setEnabled(true);
2351 }
2352 if (city_on_tile
2354 i.value()->setText(
2356 .replace("&", "&&"));
2357 } else {
2358 i.value()->setText(
2360 .replace("&", "&&"));
2361 }
2362 break;
2363
2364 case ROAD:
2365 {
2366 struct extra_type *pextra = nullptr;
2367
2369 i.value()->setEnabled(true);
2370 }
2374 if (pextra != nullptr) {
2375 break;
2376 }
2378
2379 if (pextra != nullptr) {
2380 i.value()->setText(
2381 // TRANS: Build road of specific type
2382 QString(_("Build %1"))
2383 .arg(extra_name_translation(pextra))
2384 .replace("&", "&&"));
2385 }
2386 }
2387 break;
2388
2389 case FORTIFY:
2391 i.value()->setEnabled(true);
2392 }
2393 break;
2394
2395 case FORTRESS:
2397 i.value()->setEnabled(true);
2398 }
2399 break;
2400
2401 case AIRBASE:
2403 i.value()->setEnabled(true);
2404 }
2405 break;
2406
2407 case CLEAN:
2409 i.value()->setEnabled(true);
2410 }
2411 break;
2412
2413 case SENTRY:
2415 i.value()->setEnabled(true);
2416 }
2417 break;
2418
2419 case PARADROP:
2421 i.value()->setEnabled(true);
2423 .replace("&", "&&"));
2424 }
2425 break;
2426
2427 case PILLAGE:
2429 i.value()->setEnabled(true);
2430 }
2431 break;
2432
2433 case HOMECITY:
2435 i.value()->setEnabled(true);
2436 }
2437 break;
2438
2439 case WAKEUP:
2441 i.value()->setEnabled(true);
2442 }
2443 break;
2444
2445 case AUTOSETTLER:
2447 i.value()->setEnabled(true);
2448 }
2450 i.value()->setText(_("Auto Settler"));
2451 } else {
2452 i.value()->setText(_("Auto Worker"));
2453 }
2454 break;
2455 case CONNECT_ROAD:
2457 if (proad != NULL) {
2458 tgt = road_extra_get(proad);
2459 } else {
2460 break;
2461 }
2463 i.value()->setEnabled(true);
2464 }
2465 break;
2466
2467 case DISBAND:
2469 i.value()->setEnabled(true);
2470 }
2471 break;
2472
2473 case CONNECT_RAIL:
2475 if (proad != NULL) {
2476 tgt = road_extra_get(proad);
2477 } else {
2478 break;
2479 }
2481 i.value()->setEnabled(true);
2482 }
2483 break;
2484
2485 case CONNECT_MAGLEV:
2487 if (proad != NULL) {
2488 tgt = road_extra_get(proad);
2489 } else {
2490 break;
2491 }
2493 i.value()->setEnabled(true);
2494 }
2495 break;
2496
2497 case CONNECT_IRRIGATION:
2498 {
2500
2501 if (extra_type_list_size(extras) > 0) {
2502 struct extra_type *pextra;
2503
2506 i.value()->setEnabled(true);
2507 }
2508 }
2509 }
2510 break;
2511
2512 case GOTO_CITY:
2513 if (any_cities) {
2514 i.value()->setEnabled(true);
2515 }
2516 break;
2517
2518 case AIRLIFT:
2519 if (any_cities) {
2520 i.value()->setEnabled(true);
2521 }
2522 break;
2523
2524 case BUILD_WONDER:
2525 i.value()->setText(
2527 .replace("&", "&&"));
2529 i.value()->setEnabled(true);
2530 }
2531 break;
2532
2533 case AUTOTRADEROUTE:
2535 i.value()->setEnabled(true);
2536 }
2537 break;
2538
2539 case ORDER_TRADE_ROUTE:
2540 i.value()->setText(
2542 .replace("&", "&&"));
2544 i.value()->setEnabled(true);
2545 }
2546 break;
2547
2548 case ORDER_DIPLOMAT_DLG:
2550 i.value()->setEnabled(true);
2551 }
2552 break;
2553
2554 case UPGRADE:
2555 if (units_can_upgrade(&(wld.map), punits)) {
2556 i.value()->setEnabled(true);
2557 }
2558 break;
2559 default:
2560 break;
2561 }
2562
2563 i++;
2564 }
2565 }
2566}
2567
2568/**********************************************************************/
2575
2576/**********************************************************************/
2585
2586/**********************************************************************/
2593
2594/**********************************************************************/
2598{
2599 ::gui()->game_tab_widget->setCurrentIndex(0);
2600}
2601
2602/**********************************************************************/
2609
2610/**********************************************************************/
2614{
2615 popup_players_dialog(false);
2616}
2617
2618/**********************************************************************/
2625
2626/**********************************************************************/
2630{
2632 /* FIXME: this can provide different actions for different units...
2633 * not good! */
2634 /* Enable the button for adding to a city in all cases, so we
2635 get an eventual error message from the server if we try. */
2640 }
2642}
2643
2644/**********************************************************************/
2648{
2650 struct extra_type *pextra;
2651
2654
2655 if (pextra != NULL) {
2657 }
2659}
2660
2661/**********************************************************************/
2676
2677/**********************************************************************/
2681{
2683
2684 if (prail != NULL) {
2685 struct extra_type *tgt;
2686
2687 tgt = road_extra_get(prail);
2689 }
2690}
2691
2692/**********************************************************************/
2696{
2698
2699 if (pmaglev != NULL) {
2700 struct extra_type *tgt;
2701
2702 tgt = road_extra_get(pmaglev);
2704 }
2705}
2706
2707/**********************************************************************/
2714
2715/**********************************************************************/
2722
2723/**********************************************************************/
2727{
2729
2730 if (proad != NULL) {
2731 struct extra_type *tgt;
2732
2733 tgt = road_extra_get(proad);
2735 }
2736}
2737
2738/**********************************************************************/
2745
2746/**********************************************************************/
2757
2758/**********************************************************************/
2762{
2764}
2765
2766/**********************************************************************/
2773
2774/**********************************************************************/
2781
2782/**********************************************************************/
2786{
2788 /* FIXME: this can provide different actions for different units...
2789 * not good! */
2791 EC_ROAD,
2793 punit);
2794 bool building_road = false;
2795
2796 if (tgt != NULL
2799 building_road = true;
2800 }
2801
2804 }
2806}
2807
2808/**********************************************************************/
2815
2816/**********************************************************************/
2823
2824/**********************************************************************/
2828{
2829 key_unit_mine();
2830}
2831
2832/**********************************************************************/
2836{
2838}
2839
2840/**********************************************************************/
2847
2848/**********************************************************************/
2855
2856/**********************************************************************/
2860{
2862}
2863
2864/**********************************************************************/
2871
2872/**********************************************************************/
2876{
2877 delayed_order = false;
2878 units_list.clear();
2879}
2880
2881/**********************************************************************/
2885{
2886 gui()->rallies.hover_tile = false;
2887 gui()->rallies.hover_city = true;
2888}
2889
2890/**********************************************************************/
2894{
2895 gui()->trade_gen.hover_city = true;
2896}
2897
2898/**********************************************************************/
2902{
2903 gui()->trade_gen.add_all_cities();
2904}
2905
2906/**********************************************************************/
2910{
2911 gui()->trade_gen.calculate();
2912}
2913
2914/**********************************************************************/
2918{
2919 gui()->trade_gen.clear_trade_planing();
2920}
2921
2922/**********************************************************************/
2926{
2927 qtiles gilles;
2928 struct unit *punit;
2929 struct city *homecity;
2930 struct tile *home_tile;
2931 struct tile *dest_tile;
2932 bool sent = false;
2933
2935 homecity = game_city_by_number(punit->homecity);
2936 home_tile = homecity->tile;
2937 foreach(gilles, gui()->trade_gen.lines) {
2938 if ((gilles.t1 == home_tile || gilles.t2 == home_tile)
2939 && gilles.autocaravan == nullptr) {
2940 // Send caravan
2941 if (gilles.t1 == home_tile) {
2942 dest_tile = gilles.t2;
2943 } else {
2944 dest_tile = gilles.t1;
2945 }
2946 if (send_goto_tile(punit, dest_tile)) {
2947 int i;
2948 i = gui()->trade_gen.lines.indexOf(gilles);
2949 gilles = gui()->trade_gen.lines.takeAt(i);
2950 gilles.autocaravan = punit;
2951 gui()->trade_gen.lines.append(gilles);
2952 sent = true;
2953 break;
2954 }
2955 }
2956 }
2957
2958 if (!sent) {
2959 gui()->infotab->chtwdg->append(_("Didn't find any trade route"
2960 " to establish"));
2961 }
2962}
2963
2964/**********************************************************************/
2968{
2969 QVariant v;
2970 QAction *act;
2971
2973 v = act->data();
2974 airlift_type_id = v.toInt();
2975}
2976
2977/**********************************************************************/
2981{
2982 QAction *act;
2983
2985 qdef_act::action()->vs_unit_set(act->data().toInt());
2986}
2987
2988/**********************************************************************/
2992{
2993 QAction *act;
2994
2996 qdef_act::action()->vs_city_set(act->data().toInt());
2997}
2998
2999/**********************************************************************/
3003{
3004 quick_airlifting = true;
3005}
3006
3007/**********************************************************************/
3011{
3013 int i = 0;
3015
3016 delayed_order = true;
3017 dg = D_GOTO;
3018
3019 struct unit_list *punits = get_units_in_focus();
3020 if (unit_list_size(punits) == 0) {
3021 return;
3022 }
3023 if (hover_state != HOVER_GOTO) {
3029 }
3031 i++;
3036}
3037
3038/**********************************************************************/
3042{
3044 struct unit *punit;
3045 struct tile *last_tile;
3046 struct tile *new_tile;
3047 int i = 0;
3048
3049 foreach (fui, units_list.unit_list) {
3050 i++;
3051 punit = unit_list_find(client_player()->units, fui->id);
3052 if (punit == nullptr) {
3053 continue;
3054 }
3055 last_tile = punit->tile;
3057 if (new_tile != nullptr) {
3058 punit->tile = new_tile;
3059 }
3060 if (is_tiles_adjacent(punit->tile, fui->ptile)) {
3063 punit->tile,
3064 fui->ptile));
3065 } else {
3066 send_attack_tile(punit, fui->ptile);
3067 }
3068 punit->tile = last_tile;
3069 }
3070 units_list.clear();
3071}
3072
3073/**********************************************************************/
3082
3083/**********************************************************************/
3087{
3089}
3090
3091/**********************************************************************/
3100
3101/**********************************************************************/
3105{
3107}
3108
3109/**********************************************************************/
3116
3117/**********************************************************************/
3126
3127/**********************************************************************/
3134
3135/**********************************************************************/
3142
3143/**********************************************************************/
3150
3151/**********************************************************************/
3155{
3156 key_unit_goto();
3157}
3158
3159/**********************************************************************/
3166
3167/**********************************************************************/
3174
3175/**********************************************************************/
3179{
3180 if (gui()->interface_locked) {
3181 enable_interface(false);
3182 } else {
3183 enable_interface(true);
3184 }
3185 gui()->interface_locked = !gui()->interface_locked;
3186}
3187
3188/**********************************************************************/
3192{
3196 int i;
3197
3198 lc = gui()->findChildren<close_widget *>();
3199 lm = gui()->findChildren<move_widget *>();
3200 lr = gui()->findChildren<resize_widget *>();
3201
3202 for (i = 0; i < lc.size(); ++i) {
3203 lc.at(i)->setVisible(!enable);
3204 }
3205 for (i = 0; i < lm.size(); ++i) {
3206 lm.at(i)->setVisible(!enable);
3207 }
3208 for (i = 0; i < lr.size(); ++i) {
3209 lr.at(i)->setVisible(!enable);
3210 }
3211}
3212
3213/**********************************************************************/
3217{
3219
3220 gui()->apply_fullscreen();
3221}
3222
3223/**********************************************************************/
3227{
3228 if (minimap_status->isChecked()) {
3229 ::gui()->minimapview_wdg->show();
3230 } else {
3231 ::gui()->minimapview_wdg->hide();
3232 }
3233}
3234
3235/**********************************************************************/
3239{
3240 if (osd_status->isChecked()) {
3241 gui()->qt_settings.show_new_turn_text = true;
3242 } else {
3243 gui()->qt_settings.show_new_turn_text = false;
3244 }
3245}
3246
3247/**********************************************************************/
3251{
3252 if (btlog_status->isChecked()) {
3253 gui()->qt_settings.show_battle_log = true;
3254 } else {
3255 gui()->qt_settings.show_battle_log = false;
3256 }
3257}
3258
3259/**********************************************************************/
3266
3267/**********************************************************************/
3274
3275/**********************************************************************/
3282
3283/**********************************************************************/
3290
3291/**********************************************************************/
3295{
3296 gui()->map_scale = gui()->map_scale * 1.2f;
3297 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3298}
3299
3300/**********************************************************************/
3304{
3305 QFont *qf;
3306
3307 gui()->map_scale = 1.0f;
3309 qf->setPointSize(fc_font::instance()->city_fontsize);
3311 qf->setPointSize(fc_font::instance()->prod_fontsize);
3312 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3313}
3314
3315/**********************************************************************/
3319{
3320 QFont *qf;
3321
3322 if (scale_fonts_status->isChecked()) {
3323 gui()->map_font_scale = true;
3324 } else {
3326 qf->setPointSize(fc_font::instance()->city_fontsize);
3328 qf->setPointSize(fc_font::instance()->prod_fontsize);
3329 gui()->map_font_scale = false;
3330 }
3332}
3333
3334/**********************************************************************/
3338{
3339 gui()->map_scale = gui()->map_scale / 1.2f;
3340 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3341}
3342
3343/**********************************************************************/
3350
3351/**********************************************************************/
3358
3359/**********************************************************************/
3366
3367/**********************************************************************/
3374
3375/**********************************************************************/
3382
3383/**********************************************************************/
3390
3391/**********************************************************************/
3398
3399/**********************************************************************/
3406
3407/**********************************************************************/
3411{
3412 key_unit_done();
3413}
3414
3415/**********************************************************************/
3422
3423/**********************************************************************/
3430
3431/**********************************************************************/
3440
3441/**********************************************************************/
3450
3451/**********************************************************************/
3458
3459/**********************************************************************/
3463{
3464 key_unit_wait();
3465}
3466
3467/**********************************************************************/
3471{
3473
3474 uhs = new unit_hud_selector(gui()->central_wdg);
3475 uhs->show_me();
3476}
3477
3478/**********************************************************************/
3485
3486/**********************************************************************/
3493
3494/**********************************************************************/
3501
3502/**********************************************************************/
3509
3510/**********************************************************************/
3517
3518/**********************************************************************/
3525
3526/**********************************************************************/
3533
3534/**********************************************************************/
3541
3542/**********************************************************************/
3549
3550/**********************************************************************/
3557
3558/**********************************************************************/
3565
3566/**********************************************************************/
3573
3574/**********************************************************************/
3581
3582/**********************************************************************/
3589
3590/**********************************************************************/
3597
3598/**********************************************************************/
3605
3606/**********************************************************************/
3613
3614/**********************************************************************/
3618{
3619 QDialog *dialog = new QDialog(this);
3620 QLabel *label;
3621 QPushButton *but;
3623 const struct strvec *tlset_list;
3624 const struct option *poption;
3626 QString s;
3627
3628 sl << "default_tileset_overhead_name" << "default_tileset_iso_name"
3629 << "default_tileset_hex_name" << "default_tileset_isohex_name";
3630 layout = new QVBoxLayout;
3631 dialog->setWindowTitle(_("Available tilesets"));
3632 label = new QLabel;
3633 label->setText(_("Some tilesets might not be compatible with current"
3634 " map topology!"));
3635 layout->addWidget(label);
3636
3637 foreach (s, sl) {
3639
3640 on_bytes = s.toUtf8();
3643 strvec_iterate(tlset_list, value) {
3644 but = new QPushButton(value);
3645 connect(but, &QAbstractButton::clicked, this, &mr_menu::load_new_tileset);
3646 layout->addWidget(but);
3648 }
3649 dialog->setSizeGripEnabled(true);
3650 dialog->setLayout(layout);
3651 dialog->show();
3652}
3653
3654/**********************************************************************/
3658{
3659 QPushButton *but;
3661
3663 tn_bytes = but->text().toUtf8();
3664 tilespec_reread(tn_bytes.data(), true, 1.0f);
3665 gui()->map_scale = 1.0f;
3666 but->parentWidget()->close();
3667}
3668
3669/**********************************************************************/
3673{
3674 gui()->trade_gen.calculate();
3675}
3676
3677/**********************************************************************/
3684
3685/**********************************************************************/
3692
3693/**********************************************************************/
3696void mr_menu::slot_help(const QString &topic)
3697{
3698 popup_help_dialog_typed(Q_(topic.toStdString().c_str()), HELP_ANY);
3699}
3700
3701/****************************************************************
3702 Actions "BUILD_PATH_*"
3703*****************************************************************/
3716
3717/****************************************************************
3718 Actions "BUILD_BASE_*"
3719*****************************************************************/
3721{
3724 if (pextra->buildable && pextra->id == id
3726 pextra)) {
3728 }
3731}
3732
3733
3734
3735/**********************************************************************/
3739{
3740 gui()->popup_client_options();
3741}
3742
3743/**********************************************************************/
3750
3751/**********************************************************************/
3755{
3756 gui()->pr_options->popup_server_options();
3757}
3758
3759/**********************************************************************/
3766
3767/**********************************************************************/
3774
3775/**********************************************************************/
3779{
3781}
3782
3783/**********************************************************************/
3787{
3790 QString path, storage_path;
3791 hud_message_box *saved = new hud_message_box(gui()->central_wdg);
3792 bool map_saved;
3794
3797 current_width = gui()->mapview_wdg->width();
3798 current_height = gui()->mapview_wdg->height();
3799 if (tileset_hex_width(tileset) > 0) {
3800 full_size_y = full_size_y * 11 / 20;
3801 } else if (tileset_is_isometric(tileset)) {
3803 }
3805 img_name = QString("Freeciv-Turn%1").arg(game.info.turn);
3806 if (client_has_player()) {
3807 img_name = img_name + "-"
3809 }
3811 path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
3812 if (!storage_path.isEmpty() && QDir(storage_path).isReadable()) {
3814 } else if (!path.isEmpty()) {
3815 img_name = path + DIR_SEPARATOR + img_name;
3816 } else {
3817 img_name = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
3819 }
3820 map_saved = mapview.store->map_pixmap.save(img_name, "png");
3822 saved->setStandardButtons(QMessageBox::Ok);
3823 saved->setDefaultButton(QMessageBox::Cancel);
3824 saved->setAttribute(Qt::WA_DeleteOnClose);
3825 if (map_saved) {
3826 saved->set_text_title("Image saved as:\n" + img_name, _("Success"));
3827 } else {
3828 saved->set_text_title(_("Failed to save image of the map"), _("Error"));
3829 }
3830 saved->show();
3831}
3832
3833/**********************************************************************/
3837{
3839}
3840
3841/**********************************************************************/
3845{
3846 QString str;
3847 QString current_file;
3848 QString location;
3849
3851 location = dirname;
3852 // choose last location
3854
3855 str = QString(_("Save Games"))
3856 + QString(" (*.sav *.sav.bz2 *.sav.gz *.sav.xz)");
3857 current_file = QFileDialog::getSaveFileName(gui()->central_wdg,
3858 _("Save Game As..."),
3859 location, str);
3860 if (!current_file.isEmpty()) {
3862
3863 cf_bytes = current_file.toUtf8();
3864 send_save_game(cf_bytes.data());
3865 }
3866}
3867
3868/**********************************************************************/
3872{
3874
3875 if (is_server_running()) {
3876 ask = new hud_message_box(gui()->central_wdg);
3877 ask->set_text_title(_("Leaving a local game will end it!"), "Leave game");
3878 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
3879 ask->setDefaultButton(QMessageBox::Cancel);
3880 ask->setAttribute(Qt::WA_DeleteOnClose);
3881
3882 connect(ask, &hud_message_box::accepted, [=]() {
3883 if (client.conn.used) {
3884 disconnect_from_server(TRUE);
3885 }
3886 });
3887 ask->show();
3888 } else {
3890 }
3891}
3892
3893/**********************************************************************/
3897{
3898 hud_message_box* ask = new hud_message_box(gui()->central_wdg);
3899
3900 ask->setIcon(QMessageBox::Warning);
3901 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
3902 ask->setDefaultButton(QMessageBox::Cancel);
3903 ask->setAttribute(Qt::WA_DeleteOnClose);
3904 return (ask->set_text_title(_("Selection will cancel current assignments!"),
3905 _("Confirm Disruptive Selection"), true)
3906 == QMessageBox::Ok);
3907}
3908
3909/**********************************************************************/
3913{
3914 struct tile *ptile;
3916 if (get_city_bonus(pcity, EFT_AIRLIFT) > 0) {
3917 ptile = city_tile(pcity);
3918 unit_list_iterate(ptile->units, punit) {
3919 if (punit->utype == utype_by_number(ut)) {
3921 break;
3922 }
3924 }
3926}
const char * action_name_translation(const struct action *action)
Definition actions.c:1991
const char * action_id_name_translation(action_id act_id)
Definition actions.c:2011
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1880
bool actions_are_ready(void)
Definition actions.c:1717
static struct action * action_by_number(action_id act_id)
Definition actions.h:635
#define action_iterate_end
Definition actions.h:465
#define action_id_get_actor_kind(act_id)
Definition actions.h:648
#define action_iterate(_act_)
Definition actions.h:461
#define ACTION_ANY
Definition actions.h:308
#define action_id_get_target_kind(act_id)
Definition actions.h:652
#define action_id_has_complex_target(act_id)
Definition actions.h:670
#define ACTION_NONE
Definition actions.h:311
bool actres_removes_extra(enum action_result result, const struct extra_type *pextra)
Definition actres.c:803
bool actres_creates_extra(enum action_result result, const struct extra_type *pextra)
Definition actres.c:782
#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:3430
void destroy_city_virtual(struct city *pcity)
Definition city.c:3516
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:770
#define city_list_iterate(citylist, pcity)
Definition city.h:508
#define city_tile(_pcity_)
Definition city.h:564
#define city_list_iterate_end
Definition city.h:510
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:895
virtual ~go_act_menu()
Definition menu.cpp:707
void start_go_act(int act_id, int sub_tgt_id)
Definition menu.cpp:872
void reset()
Definition menu.cpp:716
static QSet< go_act_menu * > instances
Definition menu.h:237
void update()
Definition menu.cpp:832
go_act_menu(QWidget *parent=nullptr)
Definition menu.cpp:697
static void reset_all()
Definition menu.cpp:885
void create()
Definition menu.cpp:728
QMap< QAction *, int > items
Definition menu.h:239
static QSet< gov_menu * > instances
Definition menu.h:212
virtual ~gov_menu()
Definition menu.cpp:578
static void create_all()
Definition menu.cpp:677
void revolution()
Definition menu.cpp:656
QVector< QAction * > actions
Definition menu.h:214
static void update_all()
Definition menu.cpp:687
void change_gov(int target_gov)
Definition menu.cpp:664
gov_menu(QWidget *parent=0)
Definition menu.cpp:567
void create()
Definition menu.cpp:587
void update()
Definition menu.cpp:628
bool shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq, QString *ret)
Definition menu.cpp:1888
void slot_unit_sentry()
Definition menu.cpp:2851
QActionGroup * action_vs_city
Definition menu.h:267
void slot_bg3select()
Definition menu.cpp:3569
void slot_traveler()
Definition menu.cpp:3513
bool execute_shortcut_inner(const QMenu *m, QKeySequence seq)
Definition menu.cpp:1806
void slot_delayed_goto()
Definition menu.cpp:3010
void zoom_in()
Definition menu.cpp:3294
void slot_autocaravan()
Definition menu.cpp:2925
QMenu * multiplayer_menu
Definition menu.h:264
void slot_build_irrigation()
Definition menu.cpp:2811
void slot_execute_orders()
Definition menu.cpp:3041
void update_bases_menu()
Definition menu.cpp:2013
QString shortcut_exist(fc_shortcut *fcs)
Definition menu.cpp:1865
void tileset_custom_load()
Definition menu.cpp:3617
void update_roads_menu()
Definition menu.cpp:1966
void slot_calculate()
Definition menu.cpp:2909
void slot_conn_road()
Definition menu.cpp:2726
void slot_conn_irrigation()
Definition menu.cpp:2664
QMenu * bases_menu
Definition menu.h:263
QActionGroup * airlift_type
Definition menu.h:266
void slot_quickairlift_set()
Definition menu.cpp:2967
void slot_battlelog()
Definition menu.cpp:3250
QMultiHash< munit, QAction * > menu_list
Definition menu.h:271
void slot_trade_add_all()
Definition menu.cpp:2901
void update_airlift_menu()
Definition menu.cpp:1930
void slot_show_cities()
Definition menu.cpp:2621
void slot_transform()
Definition menu.cpp:2741
void slot_top_cities()
Definition menu.cpp:3505
void slot_action_vs_unit()
Definition menu.cpp:2980
void slot_achievements()
Definition menu.cpp:3489
void slot_show_research_tab()
Definition menu.cpp:2571
void shortcut_options()
Definition menu.cpp:3746
void slot_city_output()
Definition menu.cpp:3362
void slot_show_eco_report()
Definition menu.cpp:2589
QMenu * airlift_menu
Definition menu.h:262
QAction * osd_status
Definition menu.h:287
void slot_bg1select()
Definition menu.cpp:3521
void slot_unload_all()
Definition menu.cpp:3130
void slot_airlift()
Definition menu.cpp:3104
void slot_select_same_continent()
Definition menu.cpp:3434
void slot_city_production()
Definition menu.cpp:3370
void slot_set_home()
Definition menu.cpp:3112
QAction * lock_status
Definition menu.h:286
void slot_native_tiles()
Definition menu.cpp:3270
void slot_unit_explore()
Definition menu.cpp:3162
void slot_bg4assign()
Definition menu.cpp:3601
void slot_bg1append()
Definition menu.cpp:3537
void slot_upgrade()
Definition menu.cpp:3146
void execute_shortcut(int sid)
Definition menu.cpp:1821
void slot_popup_mult_rates()
Definition menu.cpp:3688
void slot_select_same_everywhere()
Definition menu.cpp:3444
void slot_map_grid()
Definition menu.cpp:3402
void slot_unit_filter()
Definition menu.cpp:3470
void slot_bg2select()
Definition menu.cpp:3545
void slot_done_moving()
Definition menu.cpp:3410
void calc_trade_routes()
Definition menu.cpp:3672
void slot_city_buycost()
Definition menu.cpp:3278
void slot_action()
Definition menu.cpp:2769
void slot_bg4append()
Definition menu.cpp:3609
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:1848
void slot_select_all_tile()
Definition menu.cpp:3418
void save_game()
Definition menu.cpp:3836
struct tile * find_last_unit_pos(struct unit *punit, int pos)
Definition menu.cpp:905
void save_image()
Definition menu.cpp:3786
void slot_pillage()
Definition menu.cpp:2761
void slot_clean()
Definition menu.cpp:2647
void zoom_reset()
Definition menu.cpp:3303
void slot_board()
Definition menu.cpp:3076
void slot_center_view()
Definition menu.cpp:3170
void slot_build_mine()
Definition menu.cpp:2827
void server_options()
Definition menu.cpp:3754
void load_new_tileset()
Definition menu.cpp:3657
void set_tile_for_order(struct tile *ptile)
Definition menu.cpp:1794
void slot_fullscreen()
Definition menu.cpp:3216
void slot_bg4select()
Definition menu.cpp:3593
void slot_show_nations()
Definition menu.cpp:2613
void slot_build_road()
Definition menu.cpp:2785
void slot_unsentry()
Definition menu.cpp:3138
void slot_show_new_turn_text()
Definition menu.cpp:3238
void local_options()
Definition menu.cpp:3738
bool delayed_order
Definition menu.h:291
void slot_borders()
Definition menu.cpp:3262
void slot_clear_trade()
Definition menu.cpp:2917
void zoom_scale_fonts()
Definition menu.cpp:3318
void slot_conn_rail()
Definition menu.cpp:2680
void slot_select_same_tile()
Definition menu.cpp:3454
void slot_convert()
Definition menu.cpp:2859
QMenu * action_unit_menu
Definition menu.h:269
QActionGroup * action_vs_unit
Definition menu.h:268
void slot_endgame()
Definition menu.cpp:3497
void slot_bg2assign()
Definition menu.cpp:3553
void slot_select_one()
Definition menu.cpp:3426
void menus_sensitive()
Definition menu.cpp:2060
void messages_options()
Definition menu.cpp:3762
void slot_unit_goto()
Definition menu.cpp:3154
void slot_cultivate()
Definition menu.cpp:2819
void slot_stack_size()
Definition menu.cpp:3386
void slot_conn_maglev()
Definition menu.cpp:2695
void slot_patrol()
Definition menu.cpp:3086
void slot_unit_fortress()
Definition menu.cpp:2710
void slot_wait()
Definition menu.cpp:3462
void slot_demographics()
Definition menu.cpp:3481
void slot_build_city()
Definition menu.cpp:2629
void slot_city_growth()
Definition menu.cpp:3286
void slot_city_trade_routes()
Definition menu.cpp:3378
void slot_rally()
Definition menu.cpp:2884
void slot_plant()
Definition menu.cpp:2835
void slot_paradrop()
Definition menu.cpp:2749
void slot_build_path(int id)
Definition menu.cpp:3704
void slot_bg1assign()
Definition menu.cpp:3529
void slot_return_to_city()
Definition menu.cpp:3094
Unit_type_id airlift_type_id
Definition menu.h:293
void slot_show_map()
Definition menu.cpp:2597
void slot_bg3assign()
Definition menu.cpp:3577
QAction * scale_fonts_status
Definition menu.h:285
void slot_minimap_view()
Definition menu.cpp:3226
void slot_trade_city()
Definition menu.cpp:2893
void quit_game()
Definition menu.cpp:3778
void slot_help(const QString &topic)
Definition menu.cpp:3696
void save_game_as()
Definition menu.cpp:3844
void slot_bg2append()
Definition menu.cpp:3561
bool quick_airlifting
Definition menu.h:292
void slot_spaceship()
Definition menu.cpp:2579
void slot_city_names()
Definition menu.cpp:3346
QMenu * action_city_menu
Definition menu.h:270
void save_options_now()
Definition menu.cpp:3770
QAction * btlog_status
Definition menu.h:288
void slot_unit_fortify()
Definition menu.cpp:2843
void slot_show_units_report()
Definition menu.cpp:2605
void slot_quickairlift()
Definition menu.cpp:3002
QString shortcut_2_menustring(int sid)
Definition menu.cpp:1906
void slot_lock()
Definition menu.cpp:3178
void back_to_menu()
Definition menu.cpp:3871
void slot_deboard()
Definition menu.cpp:3120
void slot_popup_tax_rates()
Definition menu.cpp:3680
void slot_auto_settler()
Definition menu.cpp:2777
void slot_build_base(int id)
Definition menu.cpp:3720
qfc_units_list units_list
Definition menu.h:272
void setup_menus()
Definition menu.cpp:956
mr_menu()
Definition menu.cpp:947
void slot_bg3append()
Definition menu.cpp:3585
void slot_action_vs_city()
Definition menu.cpp:2991
void zoom_out()
Definition menu.cpp:3337
void slot_disband()
Definition menu.cpp:2867
void slot_unit_airbase()
Definition menu.cpp:2718
void slot_fullbar()
Definition menu.cpp:3394
void slot_city_outlines()
Definition menu.cpp:3354
bool confirm_disruptive_selection()
Definition menu.cpp:3896
void slot_orders_clear()
Definition menu.cpp:2875
static qdef_act * action()
Definition dialogs.cpp:1041
void vs_city_set(int i)
Definition dialogs.cpp:1063
void vs_unit_set(int i)
Definition dialogs.cpp:1071
QList< qfc_delayed_unit_item * > unit_list
Definition menu.h:131
void add(qfc_delayed_unit_item *fui)
Definition menu.cpp:493
int nr_units
Definition menu.h:132
void clear()
Definition menu.cpp:501
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:214
bool discard_one(trade_city *tc)
Definition menu.cpp:376
void add_city(struct city *pcity)
Definition menu.cpp:125
void find_certain_routes()
Definition menu.cpp:458
QList< trade_city * > cities
Definition menu.h:182
void find_certain_routes_inner(trade_city *tc)
Definition menu.cpp:423
trade_city * find_most_free()
Definition menu.cpp:325
void discard_trade(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:362
void add_tile(struct tile *ptile)
Definition menu.cpp:137
void remove_virtual_city(struct tile *ptile)
Definition menu.cpp:188
bool hover_city
Definition menu.h:179
void add_all_cities()
Definition menu.cpp:87
void clear_trade_planing()
Definition menu.cpp:105
void discard()
Definition menu.cpp:343
void remove_city(struct city *pcity)
Definition menu.cpp:170
QList< qtiles > lines
Definition menu.h:180
bool discard_any(trade_city *tc, int freeroutes)
Definition menu.cpp:402
void check_if_done(trade_city *tc1, trade_city *tc2)
Definition menu.cpp:473
QList< struct city * > virtual_cities
Definition menu.h:181
int find_over_max(struct city *pcity)
Definition menu.cpp:309
void calculate()
Definition menu.cpp:232
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:1241
void disconnect_from_server(bool leaving_sound)
Definition clinet.c:306
char * incite_cost
Definition comments.c:75
@ 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_auto_settle(void)
Definition control.c:3590
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_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:4865
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
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:846
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:765
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:790
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:354
int Unit_type_id
Definition fc_types.h:382
#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:62
struct world wld
Definition game.c:63
struct city * game_city_by_number(int id)
Definition game.c:107
struct tile * tile_before_end_path(struct unit *punit, struct tile *ptile)
Definition goto.c:2011
bool send_attack_tile(struct unit *punit, struct tile *ptile)
Definition goto.c:1621
bool send_goto_tile(struct unit *punit, struct tile *ptile)
Definition goto.c:1551
void enter_goto_state(struct unit_list *punits)
Definition goto.c:1001
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:2349
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 science_report_dialog_popup(bool raise)
Definition repodlgs.c:716
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
@ ROAD
Definition menu.h:55
@ CONNECT_MAGLEV
Definition menu.h:66
@ CULTIVATE
Definition menu.h:50
@ PARADROP
Definition menu.h:52
@ AUTOSETTLER
Definition menu.h:63
@ 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:176
int get_direction_for_step(const struct civ_map *nmap, const struct tile *start_tile, const struct tile *end_tile)
Definition map.c:1347
bool is_tiles_adjacent(const struct tile *tile0, const struct tile *tile1)
Definition map.c:931
struct terrain_misc terrain_control
Definition map.c:69
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:3191
void multiairlift(struct city *acity, Unit_type_id ut)
Definition menu.cpp:3912
void real_menus_init(void)
Definition menu.cpp:510
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.cpp:551
void real_menus_update(void)
Definition menu.cpp:528
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:1280
void options_save(option_save_log_callback log_cb)
Definition options.c:6089
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:431
void popup_shortcuts_dialog()
void toggle_units_report(bool)
#define players_iterate_end
Definition player.h:537
#define players_iterate(_pplayer)
Definition player.h:532
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:941
void array_shuffle(int *array, int n)
Definition shared.c:2010
char * freeciv_storage_dir(void)
Definition shared.c:678
#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:320
char * name
Definition city.h:321
struct tile * tile
Definition city.h:322
struct packet_game_info info
Definition game.h:89
bool ruleset_ready
Definition game.h:119
struct civ_game::@31::@34 client
struct government * government_during_revolution
Definition game.h:94
int xsize
Definition map_types.h:78
int ysize
Definition map_types.h:78
struct connection conn
Definition client_main.h:96
bool gui_qt_fullscreen
Definition options.h:405
bool draw_native
Definition options.h:215
bool draw_city_output
Definition options.h:194
bool draw_city_names
Definition options.h:196
bool draw_city_productions
Definition options.h:198
bool draw_borders
Definition options.h:214
bool draw_city_buycost
Definition options.h:199
bool draw_unit_stack_size
Definition options.h:218
bool draw_city_trade_routes
Definition options.h:200
bool unit_selection_clears_orders
Definition options.h:175
bool save_options_on_exit
Definition options.h:125
bool draw_map_grid
Definition options.h:195
bool draw_city_growth
Definition options.h:197
bool draw_city_outlines
Definition options.h:193
bool draw_full_citybar
Definition options.h:216
struct player * playing
Definition connection.h:151
Definition climisc.h:82
struct city_list * cities
Definition player.h:279
Definition menu.h:160
QPixmap * pm
Definition sprite.h:25
struct terrain * cultivate_result
Definition terrain.h:215
struct terrain * plant_result
Definition terrain.h:218
struct terrain * transform_result
Definition terrain.h:229
Definition tile.h:50
struct unit_list * units
Definition tile.h:58
Definition unit.h:138
int id
Definition unit.h:145
struct tile * tile
Definition unit.h:140
int homecity
Definition unit.h:146
const struct unit_type * utype
Definition unit.h:139
struct canvas * store
struct civ_map map
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:974
#define TRUE
Definition support.h:46
#define FALSE
Definition support.h:47
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
#define advance_iterate(_p)
Definition tech.h:275
#define advance_iterate_end
Definition tech.h:276
#define T_NONE
Definition terrain.h:56
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1033
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:110
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:6793
int tileset_hex_width(const struct tileset *t)
Definition tilespec.c:721
const struct strvec * get_tileset_list(const struct option *poption)
Definition tilespec.c:1103
bool tileset_is_isometric(const struct tileset *t)
Definition tilespec.c:712
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:704
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:765
int tileset_tile_width(const struct tileset *t)
Definition tilespec.c:753
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1355
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)
bool have_cities_trade_route(const struct city *pc1, const struct city *pc2)
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:448
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:481
bool unit_contained_in(const struct unit *pcargo, const struct unit *ptrans)
Definition unit.c:2520
bool can_unit_do_autosettlers(const struct unit *punit)
Definition unit.c:606
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:822
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:397
@ ORDER_LAST
Definition unit.h:49
@ ORDER_PERFORM_ACTION
Definition unit.h:47
#define unit_owner(_pu)
Definition unit.h:396
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:349
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:273
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:334
bool units_can_unload(const struct unit_list *punits)
Definition unitlist.c:301
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:318
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:2078
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1560
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:371
#define unit_type_iterate(_p)
Definition unittype.h:855
#define unit_type_iterate_end
Definition unittype.h:862