Freeciv-3.1
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;
92 s = city_list_size(client.conn.playing->cities);
93 if (s == 0) {
94 return;
95 }
96 for (i = 0; i < s; i++) {
97 pcity = city_list_get(client.conn.playing->cities, 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{
216 trade_city *ttc;
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;
248 cities_order[n] = cities[n];
249 }
250 array_shuffle(cities_ids, count);
251
252 cities.clear();
253 for (n = 0; n < count; n++) {
254 cities.append(cities_order[cities_ids[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
299 free(cities_ids);
300 free(cities_order);
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;
381 trade_city *ttc;
382
383 for (int i = cities.size() - 1 ; i >= 0; i--) {
384 ttc = cities.at(i);
385 current_candidate = ttc->over_max;
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{
404 trade_city *ttc;
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{
425 trade_city *ttc;
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/**********************************************************************/
494{
495 unit_list.append(fui);
496}
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);
559 tile_virtual_destroy(newtile);
560
561 return text;
562}
563
564/**********************************************************************/
567gov_menu::gov_menu(QWidget* parent) :
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{
580 qDeleteAll(actions);
581 instances.remove(this);
582}
583
584/**********************************************************************/
588 QAction *action;
589 struct government *gov, *revol_gov;
590 int gov_count, i;
591
592 // Clear any content
593 foreach(action, QWidget::actions()) {
594 removeAction(action);
595 action->deleteLater();
596 }
597 actions.clear();
598
599 gov_count = government_count();
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
613 action = addAction(QString(government_name_translation(gov))
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
634 gov_count = government_count();
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/**********************************************************************/
664void gov_menu::change_gov(int target_gov)
665{
667}
668
669/**************************************************************************
670 Keeps track of all gov_menu instances.
671**************************************************************************/
672QSet<gov_menu *> gov_menu::instances = QSet<gov_menu *>();
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. */
734 for (tgt_kind_group = 0; tgt_kind_group < ATK_COUNT; tgt_kind_group++) {
735 action_iterate(act_id) {
736 struct action *paction = action_by_number(act_id);
737 QString action_name = (QString(action_name_translation(paction))
738 .replace("&", "&&"));
739
740 if (action_id_get_actor_kind(act_id) != AAK_UNIT) {
741 /* This action isn't performed by a unit. */
742 continue;
743 }
744
745 if (action_id_get_target_kind(act_id) != tgt_kind_group) {
746 /* Wrong group. */
747 continue;
748 }
749
750 if (action_id_has_complex_target(act_id)) {
751 QMenu *sub_target_menu = addMenu(action_name);
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
764 switch (action_get_sub_target_kind(paction)) {
765 case ASTK_BUILDING:
766 improvement_iterate(pimpr) {
767 CREATE_SUB_ITEM(sub_target_menu, act_id,
768 improvement_number(pimpr),
771 break;
772 case ASTK_TECH:
773 advance_iterate(A_FIRST, ptech) {
774 CREATE_SUB_ITEM(sub_target_menu, act_id,
775 advance_number(ptech),
778 break;
779 case ASTK_EXTRA:
780 case ASTK_EXTRA_NOT_THERE:
781 extra_type_iterate(pextra) {
782 if (!(action_creates_extra(paction, pextra)
783 || action_removes_extra(paction, pextra))) {
784 /* Not relevant */
785 continue;
786 }
787
788 CREATE_SUB_ITEM(sub_target_menu, act_id,
789 extra_number(pextra),
790 extra_name_translation(pextra));
792 break;
793 case ASTK_NONE:
794 /* Should not be here. */
795 fc_assert(action_get_sub_target_kind(paction) != ASTK_NONE);
796 break;
797 case ASTK_COUNT:
798 /* Should not exits */
799 fc_assert(action_get_sub_target_kind(paction) != ASTK_COUNT);
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. */
813 item = addAction(action_name);
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. */
818 ADD_OLD_SHORTCUT(ACTION_FOUND_CITY, SC_GOBUILDCITY);
819 ADD_OLD_SHORTCUT(ACTION_JOIN_CITY, SC_GOJOINCITY);
820 ADD_OLD_SHORTCUT(ACTION_NUKE, SC_NUKE);
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**************************************************************************/
880QSet<go_act_menu *> go_act_menu::instances;
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 *menu;
960 QMenu *pr;
961 QList<QMenu*> menus;
962 int i;
963
964 delayed_order = false;
965 airlift_type_id = 0;
966 quick_airlifting = false;
967
968 /* Game Menu */
969 menu = this->addMenu(_("Game"));
970 pr = menu;
971
972#ifdef __APPLE__
973 // On Mac, Qt would try to move menu entry named just "Options" to
974 // application menu, but as this is submenu and not an action
975 // 1) It would fail to appear in the destination
976 // 2) It's impossible to override the behavior with QAction::menuRule()
977 // We add an invisible character for the string comparison to fail.
978 menu = menu->addMenu(QString("\u200B") + _("Options"));
979#else // __APPLE__
980 menu = menu->addMenu(_("Options"));
981#endif // __APPLE__
982
983 act = menu->addAction(_("Set local options"));
984 connect(act, &QAction::triggered, this, &mr_menu::local_options);
985 act = menu->addAction(_("Server Options"));
986 connect(act, &QAction::triggered, this, &mr_menu::server_options);
987 act = menu->addAction(_("Messages"));
988 connect(act, &QAction::triggered, this, &mr_menu::messages_options);
989 act = menu->addAction(_("Shortcuts"));
990 connect(act, &QAction::triggered, this, &mr_menu::shortcut_options);
991 act = menu->addAction(_("Load another tileset"));
992 connect(act, &QAction::triggered, this, &mr_menu::tileset_custom_load);
993 act = menu->addAction(_("Save Options Now"));
994 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
995 connect(act, &QAction::triggered, this, &mr_menu::save_options_now);
996 act = menu->addAction(_("Save Options on Exit"));
997 act->setCheckable(true);
998 act->setChecked(gui_options.save_options_on_exit);
999 menu = pr;
1000 menu->addSeparator();
1001 act = menu->addAction(_("Save Game"));
1002 act->setShortcut(QKeySequence(tr("Ctrl+s")));
1003 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
1004 menu_list.insert(SAVE, act);
1005 connect(act, &QAction::triggered, this, &mr_menu::save_game);
1006 act = menu->addAction(_("Save Game As..."));
1007 menu_list.insert(SAVE, act);
1008 act->setIcon(style()->standardIcon(QStyle::SP_DialogSaveButton));
1009 connect(act, &QAction::triggered, this, &mr_menu::save_game_as);
1010 act = menu->addAction(_("Save Map to Image"));
1011 connect(act, &QAction::triggered, this, &mr_menu::save_image);
1012 menu->addSeparator();
1013 act = menu->addAction(_("Leave game"));
1014 act->setIcon(style()->standardIcon(QStyle::SP_DialogDiscardButton));
1015 connect(act, &QAction::triggered, this, &mr_menu::back_to_menu);
1016 act = menu->addAction(_("Quit"));
1017 act->setIcon(style()->standardIcon(QStyle::SP_TitleBarCloseButton));
1018 connect(act, &QAction::triggered, this, &mr_menu::quit_game);
1019
1020 /* View Menu */
1021 menu = this->addMenu(Q_("?verb:View"));
1022 act = menu->addAction(_("Center View"));
1023 act->setShortcut(QKeySequence(shortcut_to_string(
1024 fc_shortcuts::sc()->get_shortcut(SC_CENTER_VIEW))));
1025 connect(act, &QAction::triggered, this, &mr_menu::slot_center_view);
1026 menu->addSeparator();
1027 act = menu->addAction(_("Fullscreen"));
1028 act->setShortcut(QKeySequence(shortcut_to_string(
1029 fc_shortcuts::sc()->get_shortcut(SC_FULLSCREEN))));
1030 act->setCheckable(true);
1031 act->setChecked(gui_options.gui_qt_fullscreen);
1032 connect(act, &QAction::triggered, this, &mr_menu::slot_fullscreen);
1033 menu->addSeparator();
1034 minimap_status = menu->addAction(_("Minimap"));
1035 minimap_status->setCheckable(true);
1036 minimap_status->setShortcut(QKeySequence(shortcut_to_string(
1037 fc_shortcuts::sc()->get_shortcut(SC_MINIMAP))));
1038 minimap_status->setChecked(true);
1039 connect(minimap_status, &QAction::triggered, this,
1041 osd_status = menu->addAction(_("Show new turn information"));
1042 osd_status->setCheckable(true);
1043 osd_status->setChecked(gui()->qt_settings.show_new_turn_text);
1044 connect(osd_status, &QAction::triggered, this,
1046 btlog_status = menu->addAction(_("Show combat detailed information"));
1047 btlog_status->setCheckable(true);
1048 btlog_status->setChecked(gui()->qt_settings.show_battle_log);
1049 connect(btlog_status, &QAction::triggered, this, &mr_menu::slot_battlelog);
1050 lock_status = menu->addAction(_("Lock interface"));
1051 lock_status->setCheckable(true);
1052 lock_status->setShortcut(QKeySequence(shortcut_to_string(
1053 fc_shortcuts::sc()->get_shortcut(SC_IFACE_LOCK))));
1054 lock_status->setChecked(false);
1055 connect(lock_status, &QAction::triggered, this, &mr_menu::slot_lock);
1056 connect(minimap_status, &QAction::triggered, this, &mr_menu::slot_lock);
1057 menu->addSeparator();
1058 act = menu->addAction(_("Zoom in"));
1059 act->setShortcut(QKeySequence(shortcut_to_string(
1060 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_IN))));
1061 connect(act, &QAction::triggered, this, &mr_menu::zoom_in);
1062 act = menu->addAction(_("Zoom default"));
1063 act->setShortcut(QKeySequence(shortcut_to_string(
1064 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_RESET))));
1065 connect(act, &QAction::triggered, this, &mr_menu::zoom_reset);
1066 act = menu->addAction(_("Zoom out"));
1067 act->setShortcut(QKeySequence(shortcut_to_string(
1068 fc_shortcuts::sc()->get_shortcut(SC_ZOOM_OUT))));
1069 connect(act, &QAction::triggered, this, &mr_menu::zoom_out);
1070 scale_fonts_status = menu->addAction(_("Scale fonts"));
1071 connect(scale_fonts_status, &QAction::triggered, this,
1073 scale_fonts_status->setCheckable(true);
1074 scale_fonts_status->setChecked(true);
1075 menu->addSeparator();
1076 act = menu->addAction(_("City Outlines"));
1077 act->setCheckable(true);
1078 act->setChecked(gui_options.draw_city_outlines);
1079 connect(act, &QAction::triggered, this, &mr_menu::slot_city_outlines);
1080 act = menu->addAction(_("City Output"));
1081 act->setCheckable(true);
1082 act->setChecked(gui_options.draw_city_output);
1083 act->setShortcut(QKeySequence(shortcut_to_string(
1084 fc_shortcuts::sc()->get_shortcut(SC_CITY_OUTPUT))));
1085 connect(act, &QAction::triggered, this, &mr_menu::slot_city_output);
1086 act = menu->addAction(_("Map Grid"));
1087 act->setShortcut(QKeySequence(shortcut_to_string(
1088 fc_shortcuts::sc()->get_shortcut(SC_MAP_GRID))));
1089 act->setCheckable(true);
1090 act->setChecked(gui_options.draw_map_grid);
1091 connect(act, &QAction::triggered, this, &mr_menu::slot_map_grid);
1092 act = menu->addAction(_("National Borders"));
1093 act->setCheckable(true);
1094 act->setChecked(gui_options.draw_borders);
1095 act->setShortcut(QKeySequence(shortcut_to_string(
1096 fc_shortcuts::sc()->get_shortcut(SC_NAT_BORDERS))));
1097 connect(act, &QAction::triggered, this, &mr_menu::slot_borders);
1098 act = menu->addAction(_("Native Tiles"));
1099 act->setCheckable(true);
1100 act->setChecked(gui_options.draw_native);
1101 act->setShortcut(QKeySequence(tr("ctrl+shift+n")));
1102 connect(act, &QAction::triggered, this, &mr_menu::slot_native_tiles);
1103 act = menu->addAction(_("City Full Bar"));
1104 act->setCheckable(true);
1105 act->setShortcut(QKeySequence(shortcut_to_string(
1106 fc_shortcuts::sc()->get_shortcut(SC_SHOW_FULLBAR))));
1107 act->setChecked(gui_options.draw_full_citybar);
1108 connect(act, &QAction::triggered, this, &mr_menu::slot_fullbar);
1109 act = menu->addAction(_("City Names"));
1110 act->setCheckable(true);
1111 act->setChecked(gui_options.draw_city_names);
1112 act->setShortcut(QKeySequence(shortcut_to_string(
1113 fc_shortcuts::sc()->get_shortcut(SC_CITY_NAMES))));
1114 connect(act, &QAction::triggered, this, &mr_menu::slot_city_names);
1115 act = menu->addAction(_("City Growth"));
1116 act->setCheckable(true);
1117 act->setChecked(gui_options.draw_city_growth);
1118 act->setShortcut(QKeySequence(tr("ctrl+o")));
1119 connect(act, &QAction::triggered, this, &mr_menu::slot_city_growth);
1120 act = menu->addAction(_("City Production"));
1121 act->setCheckable(true);
1122 act->setChecked(gui_options.draw_city_productions);
1123 act->setShortcut(QKeySequence(shortcut_to_string(
1124 fc_shortcuts::sc()->get_shortcut(SC_CITY_PROD))));
1125 connect(act, &QAction::triggered, this, &mr_menu::slot_city_production);
1126 act = menu->addAction(_("City Buy Cost"));
1127 act->setCheckable(true);
1128 act->setChecked(gui_options.draw_city_buycost);
1129 connect(act, &QAction::triggered, this, &mr_menu::slot_city_buycost);
1130 act = menu->addAction(_("City Trade Routes"));
1131 act->setCheckable(true);
1132 act->setChecked(gui_options.draw_city_trade_routes);
1133 act->setShortcut(QKeySequence(shortcut_to_string(
1134 fc_shortcuts::sc()->get_shortcut(SC_TRADE_ROUTES))));
1135 connect(act, &QAction::triggered, this, &mr_menu::slot_city_trade_routes);
1136 act = menu->addAction(_("Unit Stack Size"));
1137 act->setCheckable(true);
1138 act->setChecked(gui_options.draw_unit_stack_size);
1139 act->setShortcut(QKeySequence(shortcut_to_string(
1140 fc_shortcuts::sc()->get_shortcut(SC_STACK_SIZE))));
1141 connect(act, &QAction::triggered, this, &mr_menu::slot_stack_size);
1142
1143 /* Select Menu */
1144 menu = this->addMenu(_("Select"));
1145 act = menu->addAction(_("Single Unit (Unselect Others)"));
1146 act->setShortcut(QKeySequence(tr("shift+z")));
1147 menu_list.insert(STANDARD, act);
1148 connect(act, &QAction::triggered, this, &mr_menu::slot_select_one);
1149 act = menu->addAction(_("All On Tile"));
1150 act->setShortcut(QKeySequence(tr("v")));
1151 menu_list.insert(STANDARD, act);
1152 connect(act, &QAction::triggered, this, &mr_menu::slot_select_all_tile);
1153 menu->addSeparator();
1154 act = menu->addAction(_("Same Type on Tile"));
1155 act->setShortcut(QKeySequence(tr("shift+v")));
1156 menu_list.insert(STANDARD, act);
1157 connect(act, &QAction::triggered, this, &mr_menu::slot_select_same_tile);
1158 act = menu->addAction(_("Same Type on Continent"));
1159 act->setShortcut(QKeySequence(tr("shift+c")));
1160 menu_list.insert(STANDARD, act);
1161 connect(act, &QAction::triggered, this,
1163 act = menu->addAction(_("Same Type Everywhere"));
1164 act->setShortcut(QKeySequence(tr("shift+x")));
1165 menu_list.insert(STANDARD, act);
1166 connect(act, &QAction::triggered, this,
1168 menu->addSeparator();
1169 act = menu->addAction(_("Wait"));
1170 act->setShortcut(QKeySequence(shortcut_to_string(
1171 fc_shortcuts::sc()->get_shortcut(SC_WAIT))));
1172 menu_list.insert(STANDARD, act);
1173 connect(act, &QAction::triggered, this, &mr_menu::slot_wait);
1174 act = menu->addAction(_("Done"));
1175 act->setShortcut(QKeySequence(shortcut_to_string(
1176 fc_shortcuts::sc()->get_shortcut(SC_DONE_MOVING))));
1177 menu_list.insert(STANDARD, act);
1178 connect(act, &QAction::triggered, this, &mr_menu::slot_done_moving);
1179
1180 act = menu->addAction(_("Advanced unit selection"));
1181 act->setShortcut(QKeySequence(tr("ctrl+e")));
1182 menu_list.insert(NOT_4_OBS, act);
1183 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_filter);
1184
1185 /* Unit Menu */
1186 menu = this->addMenu(_("Unit"));
1187 act = menu->addAction(_("Go to Tile"));
1188 act->setShortcut(QKeySequence(shortcut_to_string(
1189 fc_shortcuts::sc()->get_shortcut(SC_GOTO))));
1190 menu_list.insert(STANDARD, act);
1191 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_goto);
1192
1193 // The goto and act sub menu is handled as a separate object.
1194 menu->addMenu(new go_act_menu(this));
1195
1196 act = menu->addAction(_("Go to Nearest City"));
1197 act->setShortcut(QKeySequence(tr("shift+g")));
1198 menu_list.insert(GOTO_CITY, act);
1199 connect(act, &QAction::triggered, this, &mr_menu::slot_return_to_city);
1200 act = menu->addAction(_("Go to/Airlift to City..."));
1201 act->setShortcut(QKeySequence(shortcut_to_string(
1202 fc_shortcuts::sc()->get_shortcut(SC_GOTOAIRLIFT))));
1203 menu_list.insert(AIRLIFT, act);
1204 connect(act, &QAction::triggered, this, &mr_menu::slot_airlift);
1205 menu->addSeparator();
1206 act = menu->addAction(_("Auto Explore"));
1207 menu_list.insert(EXPLORE, act);
1208 act->setShortcut(QKeySequence(shortcut_to_string(
1209 fc_shortcuts::sc()->get_shortcut(SC_AUTOEXPLORE))));
1210 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_explore);
1211 act = menu->addAction(_("Patrol"));
1212 menu_list.insert(STANDARD, act);
1213 act->setEnabled(false);
1214 act->setShortcut(QKeySequence(shortcut_to_string(
1215 fc_shortcuts::sc()->get_shortcut(SC_PATROL))));
1216 connect(act, &QAction::triggered, this, &mr_menu::slot_patrol);
1217 menu->addSeparator();
1218 act = menu->addAction(_("Sentry"));
1219 act->setShortcut(QKeySequence(shortcut_to_string(
1220 fc_shortcuts::sc()->get_shortcut(SC_SENTRY))));
1221 menu_list.insert(SENTRY, act);
1222 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_sentry);
1223 act = menu->addAction(_("Unsentry All On Tile"));
1224 act->setShortcut(QKeySequence(shortcut_to_string(
1225 fc_shortcuts::sc()->get_shortcut(SC_UNSENTRY_TILE))));
1226 menu_list.insert(WAKEUP, act);
1227 connect(act, &QAction::triggered, this, &mr_menu::slot_unsentry);
1228 menu->addSeparator();
1229 act = menu->addAction(_("Load"));
1230 act->setShortcut(QKeySequence(shortcut_to_string(
1231 fc_shortcuts::sc()->get_shortcut(SC_BOARD))));
1232 menu_list.insert(BOARD, act);
1233 connect(act, &QAction::triggered, this, &mr_menu::slot_board);
1234 act = menu->addAction(_("Unload"));
1235 act->setShortcut(QKeySequence(shortcut_to_string(
1236 fc_shortcuts::sc()->get_shortcut(SC_DEBOARD))));
1237 menu_list.insert(DEBOARD, act);
1238 connect(act, &QAction::triggered, this, &mr_menu::slot_deboard);
1239 act = menu->addAction(_("Unload All From Transporter"));
1240 act->setShortcut(QKeySequence(tr("shift+t")));
1241 menu_list.insert(TRANSPORTER, act);
1242 connect(act, &QAction::triggered, this, &mr_menu::slot_unload_all);
1243 menu->addSeparator();
1244 // Defeat keyboard shortcut mnemonics
1245 act = menu->addAction(QString(action_id_name_translation(ACTION_HOME_CITY))
1246 .replace("&", "&&"));
1247 menu_list.insert(HOMECITY, act);
1248 act->setShortcut(QKeySequence(shortcut_to_string(
1249 fc_shortcuts::sc()->get_shortcut(SC_SETHOME))));
1250 connect(act, &QAction::triggered, this, &mr_menu::slot_set_home);
1251 act = menu->addAction(_("Upgrade"));
1252 act->setShortcut(QKeySequence(shortcut_to_string(
1253 fc_shortcuts::sc()->get_shortcut(SC_UPGRADE_UNIT))));
1254 menu_list.insert(UPGRADE, act);
1255 connect(act, &QAction::triggered, this, &mr_menu::slot_upgrade);
1256 act = menu->addAction(_("Convert"));
1257 act->setShortcut(QKeySequence(tr("shift+o")));
1258 menu_list.insert(CONVERT, act);
1259 connect(act, &QAction::triggered, this, &mr_menu::slot_convert);
1260 act = menu->addAction(_("Disband"));
1261 act->setShortcut(QKeySequence(tr("shift+d")));
1262 menu_list.insert(DISBAND, act);
1263 connect(act, &QAction::triggered, this, &mr_menu::slot_disband);
1264
1265 /* Combat Menu */
1266 menu = this->addMenu(_("Combat"));
1267 act = menu->addAction(_("Fortify Unit"));
1268 menu_list.insert(FORTIFY, act);
1269 act->setShortcut(QKeySequence(shortcut_to_string(
1270 fc_shortcuts::sc()->get_shortcut(SC_FORTIFY))));
1271 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_fortify);
1272 act = menu->addAction(QString(Q_(terrain_control.gui_type_base0))
1273 .replace("&", "&&"));
1274 menu_list.insert(FORTRESS, act);
1275 act->setShortcut(QKeySequence(tr("shift+f")));
1276 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_fortress);
1277 act = menu->addAction(QString(Q_(terrain_control.gui_type_base1))
1278 .replace("&", "&&"));
1279 menu_list.insert(AIRBASE, act);
1280 act->setShortcut(QKeySequence(tr("shift+e")));
1281 connect(act, &QAction::triggered, this, &mr_menu::slot_unit_airbase);
1282 bases_menu = menu->addMenu(_("Build Base"));
1283 menu->addSeparator();
1284 act = menu->addAction(_("Pillage"));
1285 menu_list.insert(PILLAGE, act);
1286 act->setShortcut(QKeySequence(tr("shift+p")));
1287 connect(act, &QAction::triggered, this, &mr_menu::slot_pillage);
1288 /* TRANS: Menu item to bring up the action selection dialog. */
1289 act = menu->addAction(_("Do..."));
1290 menu_list.insert(ORDER_DIPLOMAT_DLG, act);
1291 act->setShortcut(QKeySequence(shortcut_to_string(
1292 fc_shortcuts::sc()->get_shortcut(SC_DO))));
1293 connect(act, &QAction::triggered, this, &mr_menu::slot_action);
1294
1295 /* Work Menu */
1296 menu = this->addMenu(_("Work"));
1297 act = menu->addAction(QString(action_id_name_translation(ACTION_FOUND_CITY))
1298 .replace("&", "&&"));
1299 act->setShortcut(QKeySequence(shortcut_to_string(
1300 fc_shortcuts::sc()->get_shortcut(SC_BUILDCITY))));
1301 menu_list.insert(BUILD, act);
1302 connect(act, &QAction::triggered, this, &mr_menu::slot_build_city);
1303 act = menu->addAction(_("Auto Settler"));
1304 act->setShortcut(QKeySequence(shortcut_to_string(
1305 fc_shortcuts::sc()->get_shortcut(SC_AUTOMATE))));
1306 menu_list.insert(AUTOSETTLER, act);
1307 connect(act, &QAction::triggered, this, &mr_menu::slot_auto_settler);
1308 menu->addSeparator();
1309 act = menu->addAction(_("Build Road"));
1310 menu_list.insert(ROAD, act);
1311 act->setShortcut(QKeySequence(shortcut_to_string(
1312 fc_shortcuts::sc()->get_shortcut(SC_BUILDROAD))));
1313 connect(act, &QAction::triggered, this, &mr_menu::slot_build_road);
1314 roads_menu = menu->addMenu(_("Build Path"));
1315 act = menu->addAction(_("Build Irrigation"));
1316 act->setShortcut(QKeySequence(shortcut_to_string(
1317 fc_shortcuts::sc()->get_shortcut(SC_BUILDIRRIGATION))));
1318 menu_list.insert(IRRIGATION, act);
1319 connect(act, &QAction::triggered, this, &mr_menu::slot_build_irrigation);
1320 act = menu->addAction(_("Cultivate"));
1321 act->setShortcut(QKeySequence(shortcut_to_string(
1322 fc_shortcuts::sc()->get_shortcut(SC_CULTIVATE))));
1323 menu_list.insert(CULTIVATE, act);
1324 connect(act, &QAction::triggered, this, &mr_menu::slot_cultivate);
1325 act = menu->addAction(_("Build Mine"));
1326 act->setShortcut(QKeySequence(shortcut_to_string(
1327 fc_shortcuts::sc()->get_shortcut(SC_BUILDMINE))));
1328 menu_list.insert(MINE, act);
1329 connect(act, &QAction::triggered, this, &mr_menu::slot_build_mine);
1330 act = menu->addAction(_("Plant"));
1331 act->setShortcut(QKeySequence(shortcut_to_string(
1332 fc_shortcuts::sc()->get_shortcut(SC_PLANT))));
1333 menu_list.insert(PLANT, act);
1334 connect(act, &QAction::triggered, this, &mr_menu::slot_plant);
1335 menu->addSeparator();
1336 act = menu->addAction(_("Connect With Road"));
1337 act->setShortcut(QKeySequence(tr("ctrl+r")));
1338 menu_list.insert(CONNECT_ROAD, act);
1339 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_road);
1340 act = menu->addAction(_("Connect With Railroad"));
1341 menu_list.insert(CONNECT_RAIL, act);
1342 act->setShortcut(QKeySequence(tr("ctrl+l")));
1343 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_rail);
1344 act = menu->addAction(_("Connect With Maglev"));
1345 menu_list.insert(CONNECT_MAGLEV, act);
1346 act->setShortcut(QKeySequence(tr("ctrl+m")));
1347 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_maglev);
1348 act = menu->addAction(_("Connect With Irrigation"));
1349 menu_list.insert(CONNECT_IRRIGATION, act);
1350 act->setShortcut(QKeySequence(tr("ctrl+i")));
1351 connect(act, &QAction::triggered, this, &mr_menu::slot_conn_irrigation);
1352 menu->addSeparator();
1353 act = menu->addAction(_("Transform Terrain"));
1354 menu_list.insert(TRANSFORM, act);
1355 act->setShortcut(QKeySequence(shortcut_to_string(
1356 fc_shortcuts::sc()->get_shortcut(SC_TRANSFORM))));
1357 connect(act, &QAction::triggered, this, &mr_menu::slot_transform);
1358 act = menu->addAction(_("Clean Pollution"));
1359 menu_list.insert(POLLUTION, act);
1360 act->setShortcut(QKeySequence(shortcut_to_string(
1361 fc_shortcuts::sc()->get_shortcut(SC_PARADROP))));
1362 connect(act, &QAction::triggered, this, &mr_menu::slot_clean_pollution);
1363 act = menu->addAction(_("Clean Nuclear Fallout"));
1364 menu_list.insert(FALLOUT, act);
1365 act->setShortcut(QKeySequence(tr("n")));
1366 connect(act, &QAction::triggered, this, &mr_menu::slot_clean_fallout);
1367 act = menu->addAction(QString(action_id_name_translation(ACTION_HELP_WONDER))
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);
1372 act = menu->addAction(QString(action_id_name_translation(ACTION_TRADE_ROUTE))
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 menu = this->addMenu(_("Civilization"));
1524 act = 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 menu->addSeparator();
1528
1529 act = menu->addAction(_("Policies..."));
1530 menu_list.insert(MULTIPLIERS, act);
1531 connect(act, &QAction::triggered, this, &mr_menu::slot_popup_mult_rates);
1532 menu->addSeparator();
1533
1534 menu->addMenu(new class gov_menu(this));
1535 menu->addSeparator();
1536
1537 act = 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 = menu->addAction(_("Units"));
1542 act->setShortcut(QKeySequence(tr("F2")));
1543 connect(act, &QAction::triggered, this, &mr_menu::slot_show_units_report);
1544
1545 act = menu->addAction(_("Nations"));
1546 act->setShortcut(QKeySequence(tr("F3")));
1547 connect(act, &QAction::triggered, this, &mr_menu::slot_show_nations);
1548
1549 act = menu->addAction(_("Cities"));
1550 act->setShortcut(QKeySequence(tr("F4")));
1551 connect(act, &QAction::triggered, this, &mr_menu::slot_show_cities);
1552
1553 act = menu->addAction(_("Economy"));
1554 act->setShortcut(QKeySequence(tr("F5")));
1555 connect(act, &QAction::triggered, this, &mr_menu::slot_show_eco_report);
1556
1557 act = menu->addAction(_("Research"));
1558 act->setShortcut(QKeySequence(tr("F6")));
1559 connect(act, &QAction::triggered, this, &mr_menu::slot_show_research_tab);
1560
1561 act = 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 = menu->addAction(_("Top Five Cities"));
1566 act->setShortcut(QKeySequence(tr("F8")));
1567 connect(act, &QAction::triggered, this, &mr_menu::slot_top_five);
1568
1569 act = menu->addAction(_("Demographics"));
1570 act->setShortcut(QKeySequence(tr("F11")));
1571 connect(act, &QAction::triggered, this, &mr_menu::slot_demographics);
1572
1573 act = menu->addAction(_("Spaceship"));
1574 act->setShortcut(QKeySequence(tr("F12")));
1575 connect(act, &QAction::triggered, this, &mr_menu::slot_spaceship);
1576
1577 act = menu->addAction(_("Achievements"));
1578 connect(act, &QAction::triggered, this, &mr_menu::slot_achievements);
1579
1580 act = menu->addAction(_("Endgame report"));
1581 menu_list.insert(ENDGAME, act);
1582 connect(act, &QAction::triggered, this, &mr_menu::slot_endgame);
1583
1584 // Battle Groups Menu
1585 menu = this->addMenu(_("Battle Groups"));
1586
1587 act = menu->addAction(_("Select Battle Group 1"));
1588 act->setShortcut(QKeySequence(tr("Shift+F1")));
1589 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1select);
1590
1591 act = menu->addAction(_("Assign Battle Group 1"));
1592 act->setShortcut(QKeySequence(tr("Ctrl+F1")));
1593 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1assign);
1594
1595 act = menu->addAction(_("Append to Battle Group 1"));
1596 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F1")));
1597 connect(act, &QAction::triggered, this, &mr_menu::slot_bg1append);
1598
1599 act = menu->addAction(_("Select Battle Group 2"));
1600 act->setShortcut(QKeySequence(tr("Shift+F2")));
1601 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2select);
1602
1603 act = menu->addAction(_("Assign Battle Group 2"));
1604 act->setShortcut(QKeySequence(tr("Ctrl+F2")));
1605 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2assign);
1606
1607 act = menu->addAction(_("Append to Battle Group 2"));
1608 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F2")));
1609 connect(act, &QAction::triggered, this, &mr_menu::slot_bg2append);
1610
1611 act = menu->addAction(_("Select Battle Group 3"));
1612 act->setShortcut(QKeySequence(tr("Shift+F3")));
1613 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3select);
1614
1615 act = menu->addAction(_("Assign Battle Group 3"));
1616 act->setShortcut(QKeySequence(tr("Ctrl+F3")));
1617 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3assign);
1618
1619 act = menu->addAction(_("Append to Battle Group 3"));
1620 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F3")));
1621 connect(act, &QAction::triggered, this, &mr_menu::slot_bg3append);
1622
1623 act = menu->addAction(_("Select Battle Group 4"));
1624 act->setShortcut(QKeySequence(tr("Shift+F4")));
1625 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4select);
1626
1627 act = menu->addAction(_("Assign Battle Group 4"));
1628 act->setShortcut(QKeySequence(tr("Ctrl+F4")));
1629 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4assign);
1630
1631 act = menu->addAction(_("Append to Battle Group 4"));
1632 act->setShortcut(QKeySequence(tr("Ctrl+Shift+F4")));
1633 connect(act, &QAction::triggered, this, &mr_menu::slot_bg4append);
1634
1635 // Help Menu
1636 menu = this->addMenu(_("Help"));
1637
1638 act = menu->addAction(Q_(HELP_OVERVIEW_ITEM));
1639 QObject::connect(act, &QAction::triggered, [this]() {
1641 });
1642
1643 act = menu->addAction(Q_(HELP_PLAYING_ITEM));
1644 QObject::connect(act, &QAction::triggered, [this]() {
1646 });
1647
1648 act = menu->addAction(Q_(HELP_TERRAIN_ITEM));
1649 QObject::connect(act, &QAction::triggered, [this]() {
1651 });
1652
1653 act = menu->addAction(Q_(HELP_ECONOMY_ITEM));
1654 QObject::connect(act, &QAction::triggered, [this]() {
1656 });
1657
1658 act = menu->addAction(Q_(HELP_CITIES_ITEM));
1659 QObject::connect(act, &QAction::triggered, [this]() {
1661 });
1662
1663 act = menu->addAction(Q_(HELP_IMPROVEMENTS_ITEM));
1664 QObject::connect(act, &QAction::triggered, [this]() {
1666 });
1667
1668 act = menu->addAction(Q_(HELP_WONDERS_ITEM));
1669 QObject::connect(act, &QAction::triggered, [this]() {
1671 });
1672
1673 act = menu->addAction(Q_(HELP_UNITS_ITEM));
1674 QObject::connect(act, &QAction::triggered, [this]() {
1676 });
1677
1678 act = menu->addAction(Q_(HELP_COMBAT_ITEM));
1679 QObject::connect(act, &QAction::triggered, [this]() {
1681 });
1682
1683 act = menu->addAction(Q_(HELP_ZOC_ITEM));
1684 QObject::connect(act, &QAction::triggered, [this]() {
1686 });
1687
1688 act = menu->addAction(Q_(HELP_GOVERNMENT_ITEM));
1689 QObject::connect(act, &QAction::triggered, [this]() {
1691 });
1692
1693 act = menu->addAction(Q_(HELP_ECONOMY_ITEM));
1694 QObject::connect(act, &QAction::triggered, [this]() {
1696 });
1697
1698 act = menu->addAction(Q_(HELP_DIPLOMACY_ITEM));
1699 QObject::connect(act, &QAction::triggered, [this]() {
1701 });
1702
1703 act = menu->addAction(Q_(HELP_TECHS_ITEM));
1704 QObject::connect(act, &QAction::triggered, [this]() {
1706 });
1707
1708 act = menu->addAction(Q_(HELP_SPACE_RACE_ITEM));
1709 QObject::connect(act, &QAction::triggered, [this]() {
1711 });
1712
1713 act = menu->addAction(Q_(HELP_IMPROVEMENTS_ITEM));
1714 QObject::connect(act, &QAction::triggered, [this]() {
1716 });
1717
1718 act = menu->addAction(Q_(HELP_RULESET_ITEM));
1719 QObject::connect(act, &QAction::triggered, [this]() {
1721 });
1722
1723 act = menu->addAction(Q_(HELP_TILESET_ITEM));
1724 QObject::connect(act, &QAction::triggered, [this]() {
1726 });
1727
1728 act = menu->addAction(Q_(HELP_NATIONS_ITEM));
1729 QObject::connect(act, &QAction::triggered, [this]() {
1731 });
1732
1733 menu->addSeparator();
1734
1735 act = menu->addAction(Q_(HELP_CONNECTING_ITEM));
1736 QObject::connect(act, &QAction::triggered, [this]() {
1738 });
1739
1740 act = menu->addAction(Q_(HELP_CONTROLS_ITEM));
1741 QObject::connect(act, &QAction::triggered, [this]() {
1743 });
1744
1745 act = menu->addAction(Q_(HELP_CMA_ITEM));
1746 QObject::connect(act, &QAction::triggered, [this]() {
1748 });
1749
1750 act = menu->addAction(Q_(HELP_CHATLINE_ITEM));
1751 QObject::connect(act, &QAction::triggered, [this]() {
1753 });
1754
1755 act = menu->addAction(Q_(HELP_WORKLIST_EDITOR_ITEM));
1756 QObject::connect(act, &QAction::triggered, [this]() {
1758 });
1759
1760 menu->addSeparator();
1761
1762 act = menu->addAction(Q_(HELP_LANGUAGES_ITEM));
1763 QObject::connect(act, &QAction::triggered, [this]() {
1765 });
1766
1767 act = menu->addAction(Q_(HELP_COPYING_ITEM));
1768 QObject::connect(act, &QAction::triggered, [this]() {
1770 });
1771
1772 act = menu->addAction(Q_(HELP_ABOUT_ITEM));
1773 QObject::connect(act, &QAction::triggered, [this]() {
1775 });
1776
1777 menus = this->findChildren<QMenu*>();
1778 for (i = 0; i < menus.count(); i++) {
1779 menus[i]->setAttribute(Qt::WA_TranslucentBackground);
1780 }
1781 this->setVisible(false);
1782}
1783
1784/**********************************************************************/
1788{
1789 for (int i=0; i < units_list.nr_units; i++) {
1790 units_list.unit_list.at(units_list.unit_list.count() - i -1)->ptile = ptile;
1791 }
1792}
1793
1794/**********************************************************************/
1799bool mr_menu::execute_shortcut_inner(const QMenu *m, QKeySequence seq)
1800{
1801 foreach (QAction *a, m->actions()) {
1802 if (a->shortcut() == seq && a->isEnabled()) {
1803 a->activate(QAction::Trigger);
1804 return TRUE;
1805 }
1806 }
1807
1808 return FALSE;
1809}
1810
1811/**********************************************************************/
1815{
1816 QList<QMenu*> menus;
1817 QKeySequence seq;
1818 fc_shortcut *fcs;
1819
1820 if (sid == SC_GOTO) {
1821 gui()->mapview_wdg->menu_click = true;
1823 return;
1824 }
1825 fcs = fc_shortcuts::sc()->get_shortcut(static_cast<shortcut_id>(sid));
1826 seq = QKeySequence(shortcut_to_string(fcs));
1827
1828 menus = findChildren<QMenu*>();
1829 foreach (const QMenu *m, menus) {
1830 if (execute_shortcut_inner(m, seq)) {
1831 return;
1832 }
1833 }
1834}
1835
1836/**********************************************************************/
1841bool mr_menu::shortcut_exist_inner(const QMenu *m, QKeySequence seq,
1842 fc_shortcut *fcs, QString *ret)
1843{
1844 foreach (QAction *a, m->actions()) {
1845 if (a->shortcut() == seq && fcs->mouse == Qt::AllButtons) {
1846 *ret = a->text();
1847
1848 return TRUE;
1849 }
1850 }
1851
1852 return FALSE;
1853}
1854
1855/**********************************************************************/
1859{
1860 QList<QMenu*> menus;
1861 QKeySequence seq;
1862
1863 seq = QKeySequence(shortcut_to_string(fcs));
1864 menus = findChildren<QMenu *>();
1865 foreach (const QMenu *m, menus) {
1866 QString ret;
1867
1868 if (shortcut_exist_inner(m, seq, fcs, &ret)) {
1869 return ret;
1870 }
1871 }
1872
1873 return QString();
1874}
1875
1876/**********************************************************************/
1881bool mr_menu::shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq,
1882 QString *ret)
1883{
1884 foreach (QAction *a, m->actions()) {
1885 if (a->shortcut() == seq) {
1886 *ret = a->text() + " ("
1887 + a->shortcut().toString(QKeySequence::NativeText) + ")";
1888
1889 return TRUE;
1890 }
1891 }
1892
1893 return FALSE;
1894}
1895
1896/**********************************************************************/
1900{
1901 QList<QMenu *> menus;
1902 QKeySequence seq;
1903 fc_shortcut *fcs;
1904
1905 fcs = fc_shortcuts::sc()->get_shortcut(static_cast<shortcut_id>(sid));
1906 seq = QKeySequence(shortcut_to_string(fcs));
1907
1908 menus = findChildren<QMenu *>();
1909 foreach (const QMenu *m, menus) {
1910 QString ret;
1911
1912 if (shortcut_2_menustring_inner(m, seq, &ret)) {
1913 return ret;
1914 }
1915 }
1916
1917 return QString();
1918}
1919
1920/**********************************************************************/
1924{
1925 Unit_type_id utype_id;
1926 QAction *act;
1927
1928 airlift_menu->clear();
1929 if (client_is_observer()) {
1930 return;
1931 }
1932 unit_type_iterate(utype) {
1933 utype_id = utype_index(utype);
1934
1936 || !utype_can_do_action(utype, ACTION_AIRLIFT)) {
1937 continue;
1938 }
1940 && !has_player_unit_type(utype_id)) {
1941 continue;
1942 }
1943 // Defeat keyboard shortcut mnemonics
1944 act = airlift_menu->addAction(QString(utype_name_translation(utype))
1945 .replace("&", "&&"));
1946 act->setCheckable(true);
1947 act->setData(utype_id);
1948 if (airlift_type_id == utype_id) {
1949 act->setChecked(true);
1950 }
1951 connect(act, &QAction::triggered, this, &mr_menu::slot_quickairlift_set);
1952 airlift_type->addAction(act);
1954}
1955
1956/****************************************************************************
1957 Updates "build path" menu
1958****************************************************************************/
1960{
1961 QAction *act;
1962 struct unit_list *punits = nullptr;
1963 bool enabled = false;
1964
1965 foreach(act, roads_menu->actions()) {
1966 removeAction(act);
1967 act->deleteLater();
1968 }
1969 roads_menu->clear();
1970 roads_menu->setDisabled(true);
1971 if (client_is_observer()) {
1972 return;
1973 }
1974
1975 punits = get_units_in_focus();
1976 extra_type_by_cause_iterate(EC_ROAD, pextra) {
1977 if (pextra->buildable) {
1978 int road_id;
1979
1980 // Defeat keyboard shortcut mnemonics
1981 act = roads_menu->addAction(QString(extra_name_translation(pextra))
1982 .replace("&", "&&"));
1983 road_id = pextra->id;
1984 act->setData(road_id);
1985 QObject::connect(act, &QAction::triggered, [this,road_id]() {
1986 slot_build_path(road_id);
1987 });
1989 ACTIVITY_GEN_ROAD, pextra)) {
1990 act->setEnabled(true);
1991 enabled = true;
1992 } else {
1993 act->setDisabled(true);
1994 }
1995 }
1997
1998 if (enabled) {
1999 roads_menu->setEnabled(true);
2000 }
2001}
2002
2003/****************************************************************************
2004 Updates "build bases" menu
2005****************************************************************************/
2007{
2008 QAction *act;
2009 struct unit_list *punits = nullptr;
2010 bool enabled = false;
2011
2012 foreach(act, bases_menu->actions()) {
2013 removeAction(act);
2014 act->deleteLater();
2015 }
2016 bases_menu->clear();
2017 bases_menu->setDisabled(true);
2018
2019 if (client_is_observer()) {
2020 return;
2021 }
2022
2023 punits = get_units_in_focus();
2024 extra_type_by_cause_iterate(EC_BASE, pextra) {
2025 if (pextra->buildable) {
2026 int base_id;
2027
2028 // Defeat keyboard shortcut mnemonics
2029 act = bases_menu->addAction(QString(extra_name_translation(pextra))
2030 .replace("&", "&&"));
2031 base_id = pextra->id;
2032 act->setData(base_id);
2033 QObject::connect(act, &QAction::triggered, [this,base_id]() {
2034 slot_build_base(base_id);
2035 });
2036 if (can_units_do_activity_targeted_client(punits, ACTIVITY_BASE, pextra)) {
2037 act->setEnabled(true);
2038 enabled = true;
2039 } else {
2040 act->setDisabled(true);
2041 }
2042 }
2044
2045 if (enabled) {
2046 bases_menu->setEnabled(true);
2047 }
2048}
2049
2050/**********************************************************************/
2054{
2055 QList <QAction * >values;
2056 QList <munit > keys;
2057 QMultiHash <munit, QAction *>::iterator i;
2058 struct unit_list *punits = nullptr;
2059 struct road_type *proad;
2060 struct extra_type *tgt;
2061 bool any_cities = false;
2062 bool city_on_tile = false;
2063 bool units_all_same_tile = true;
2064 const struct tile *ptile = NULL;
2065 const struct unit_type *ptype = NULL;
2066
2067 players_iterate(pplayer) {
2068 if (city_list_size(pplayer->cities)) {
2069 any_cities = true;
2070 break;
2071 }
2073
2075 foreach(QAction *a, menu_list) {
2076 a->setEnabled(false);
2077 }
2078
2079 if (client_is_observer()) {
2080 multiplayer_menu->setDisabled(true);
2081 } else {
2082 multiplayer_menu->setDisabled(false);
2083 }
2084
2085 /* Non unit menus */
2086 keys = menu_list.keys();
2087 foreach (munit key, keys) {
2088 i = menu_list.find(key);
2089 while (i != menu_list.end() && i.key() == key) {
2090 switch (key) {
2091 case SAVE:
2093 i.value()->setEnabled(true);
2094 }
2095 break;
2096 case NOT_4_OBS:
2097 if (!client_is_observer()) {
2098 i.value()->setEnabled(true);
2099 }
2100 break;
2101 case MULTIPLIERS:
2102 if (!client_is_observer() && multiplier_count() > 0) {
2103 i.value()->setEnabled(true);
2104 i.value()->setVisible(true);
2105 } else {
2106 i.value()->setVisible(false);
2107 }
2108 break;
2109 case ENDGAME:
2110 if (gui()->is_repo_dlg_open("END")) {
2111 i.value()->setEnabled(true);
2112 i.value()->setVisible(true);
2113 } else {
2114 i.value()->setVisible(false);
2115 }
2116 break;
2117 default:
2118 break;
2119 }
2120 i++;
2121 }
2122 }
2123
2125 return;
2126 }
2127
2128 punits = get_units_in_focus();
2129 unit_list_iterate(punits, punit) {
2130 if (tile_city(unit_tile(punit))) {
2131 city_on_tile = true;
2132 break;
2133 }
2135
2136 unit_list_iterate(punits, punit) {
2137 const struct unit_type *ntype;
2138
2139 fc_assert((ptile == NULL) == (ptype == NULL));
2140
2141 ntype = unit_type_get(punit);
2142
2143 // 'ntype == ptype' is correct check even when ptype is still nullptr
2144 if (ptile != nullptr && ntype == ptype && unit_tile(punit) != ptile) {
2145 units_all_same_tile = false;
2146 }
2147
2148 if (ptype == nullptr || ntype == ptype) {
2149 ptile = unit_tile(punit);
2150 ptype = ntype;
2151 }
2153
2154 keys = menu_list.keys();
2155 foreach(munit key, keys) {
2156 i = menu_list.find(key);
2157 while (i != menu_list.end() && i.key() == key) {
2158 switch (key) {
2159 case STANDARD:
2160 i.value()->setEnabled(true);
2161 break;
2162
2163 case EXPLORE:
2164 if (can_units_do_activity_client(punits, ACTIVITY_EXPLORE)) {
2165 i.value()->setEnabled(true);
2166 }
2167 break;
2168
2169 case BOARD:
2170 if (units_can_load(punits)) {
2171 i.value()->setEnabled(true);
2172 }
2173 break;
2174
2175 case DEBOARD:
2176 if (units_can_unload(punits)) {
2177 i.value()->setEnabled(true);
2178 }
2179 break;
2180
2181 case TRANSPORTER:
2182 if (units_are_occupied(punits)) {
2183 i.value()->setEnabled(true);
2184 }
2185 break;
2186
2187 case CONVERT:
2188 if (units_can_convert(&(wld.map), punits)) {
2189 i.value()->setEnabled(true);
2190 }
2191 break;
2192
2193 case MINE:
2194 if (can_units_do_activity_client(punits, ACTIVITY_MINE)) {
2195 i.value()->setEnabled(true);
2196 }
2197
2198 if (units_all_same_tile) {
2199 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2200 struct extra_type *pextra = NULL;
2201
2202 /* FIXME: this overloading doesn't work well with multiple focus
2203 * units. */
2204 unit_list_iterate(punits, builder) {
2205 pextra = next_extra_for_tile(unit_tile(builder), EC_MINE,
2206 unit_owner(builder), builder);
2207 if (pextra != NULL) {
2208 break;
2209 }
2211
2212 if (pextra != NULL) {
2213 i.value()->setText(
2214 /* TRANS: Build mine of specific type */
2215 QString(_("Build %1"))
2216 .arg(extra_name_translation(pextra))
2217 .replace("&", "&&"));
2218 } else {
2219 i.value()->setText(QString(_("Build Mine")));
2220 }
2221 } else {
2222 i.value()->setText(QString(_("Build Mine")));
2223 }
2224 }
2225 break;
2226
2227 case IRRIGATION:
2228 if (can_units_do_activity_client(punits, ACTIVITY_IRRIGATE)) {
2229 i.value()->setEnabled(true);
2230 }
2231 if (units_all_same_tile) {
2232 if (units_have_type_flag(punits, UTYF_SETTLERS, TRUE)) {
2233 struct extra_type *pextra = NULL;
2234
2235 /* FIXME: this overloading doesn't work well with multiple focus
2236 * units. */
2237 unit_list_iterate(punits, builder) {
2238 pextra = next_extra_for_tile(unit_tile(builder), EC_IRRIGATION,
2239 unit_owner(builder), builder);
2240 if (pextra != NULL) {
2241 break;
2242 }
2244
2245 if (pextra != NULL) {
2246 i.value()->setText(
2247 /* TRANS: Build irrigation of specific type */
2248 QString(_("Build %1"))
2249 .arg(extra_name_translation(pextra))
2250 .replace("&", "&&"));
2251 } else {
2252 i.value()->setText(QString(_("Build Irrigation")));
2253 }
2254 } else {
2255 i.value()->setText(QString(_("Build Irrigation")));
2256 }
2257 }
2258 break;
2259
2260 case CULTIVATE:
2261 if (can_units_do_activity_client(punits, ACTIVITY_CULTIVATE)) {
2262 i.value()->setEnabled(true);
2263 }
2264 if (units_all_same_tile) {
2265 struct unit *punit = unit_list_get(punits, 0);
2266 struct tile *atile = unit_tile(punit);
2267 struct terrain *pterrain = tile_terrain(atile);
2268
2269 if (pterrain->cultivate_result != T_NONE) {
2270 i.value()->setText(
2271 /* TRANS: Transform terrain to specific type */
2272 QString(_("Cultivate to %1"))
2273 .arg(QString(get_tile_change_menu_text(atile, ACTIVITY_CULTIVATE)))
2274 .replace("&", "&&"));
2275 } else {
2276 i.value()->setText(QString(_("Cultivate")));
2277 }
2278 } else {
2279 i.value()->setText(QString(_("Cultivate")));
2280 }
2281 break;
2282
2283 case PLANT:
2284 if (can_units_do_activity_client(punits, ACTIVITY_PLANT)) {
2285 i.value()->setEnabled(true);
2286 }
2287 if (units_all_same_tile) {
2288 struct unit *punit = unit_list_get(punits, 0);
2289 struct tile *atile = unit_tile(punit);
2290 struct terrain *pterrain = tile_terrain(atile);
2291
2292 if (pterrain->plant_result != T_NONE) {
2293 i.value()->setText(
2294 /* TRANS: Transform terrain to specific type */
2295 QString(_("Plant to %1"))
2296 .arg(QString(get_tile_change_menu_text(atile, ACTIVITY_PLANT)))
2297 .replace("&", "&&"));
2298 } else {
2299 i.value()->setText(QString(_("Plant")));
2300 }
2301 } else {
2302 i.value()->setText(QString(_("Plant")));
2303 }
2304 break;
2305
2306 case TRANSFORM:
2307 if (can_units_do_activity_client(punits, ACTIVITY_TRANSFORM)) {
2308 i.value()->setEnabled(true);
2309 } else {
2310 break;
2311 }
2312 if (units_all_same_tile) {
2313 struct unit *punit = unit_list_get(punits, 0);
2314 struct tile *atile = unit_tile(punit);
2315 struct terrain *pterrain = tile_terrain(atile);
2316
2317 if (pterrain->transform_result != T_NONE
2318 && pterrain->transform_result != pterrain) {
2319 i.value()->setText(
2320 /* TRANS: Transform terrain to specific type */
2321 QString(_("Transform to %1"))
2322 .arg(QString(get_tile_change_menu_text(atile, ACTIVITY_TRANSFORM)))
2323 .replace("&", "&&"));
2324 } else {
2325 i.value()->setText(_("Transform Terrain"));
2326 }
2327 }
2328 break;
2329
2330 case BUILD:
2331 if (can_units_do_on_map(&(wld.map), punits,
2333 i.value()->setEnabled(true);
2334 }
2335 if (city_on_tile
2336 && units_can_do_action(punits, ACTION_JOIN_CITY, true)) {
2337 i.value()->setText(
2338 QString(action_id_name_translation(ACTION_JOIN_CITY))
2339 .replace("&", "&&"));
2340 } else {
2341 i.value()->setText(
2342 QString(action_id_name_translation(ACTION_FOUND_CITY))
2343 .replace("&", "&&"));
2344 }
2345 break;
2346
2347 case ROAD:
2348 {
2349 struct extra_type *pextra = nullptr;
2350
2351 if (can_units_do_any_road(&(wld.map), punits)) {
2352 i.value()->setEnabled(true);
2353 }
2354 unit_list_iterate(punits, punit) {
2355 pextra = next_extra_for_tile(unit_tile(punit), EC_ROAD,
2357 if (pextra != nullptr) {
2358 break;
2359 }
2361
2362 if (pextra != nullptr) {
2363 i.value()->setText(
2364 /* TRANS: Build road of specific type */
2365 QString(_("Build %1"))
2366 .arg(extra_name_translation(pextra))
2367 .replace("&", "&&"));
2368 }
2369 }
2370 break;
2371
2372 case FORTIFY:
2373 if (can_units_do_activity_client(punits, ACTIVITY_FORTIFYING)) {
2374 i.value()->setEnabled(true);
2375 }
2376 break;
2377
2378 case FORTRESS:
2379 if (can_units_do_base_gui(punits, BASE_GUI_FORTRESS)) {
2380 i.value()->setEnabled(true);
2381 }
2382 break;
2383
2384 case AIRBASE:
2385 if (can_units_do_base_gui(punits, BASE_GUI_AIRBASE)) {
2386 i.value()->setEnabled(true);
2387 }
2388 break;
2389
2390 case POLLUTION:
2391 if (can_units_do_activity_client(punits, ACTIVITY_POLLUTION)
2392 || can_units_do_on_map(&(wld.map), punits, can_unit_paradrop)) {
2393 i.value()->setEnabled(true);
2394 }
2395 if (units_can_do_action_with_result(punits, ACTRES_PARADROP,
2396 true)
2398 ACTRES_PARADROP_CONQUER,
2399 true)) {
2400 i.value()->setText(
2401 QString(action_id_name_translation(ACTION_PARADROP))
2402 .replace("&", "&&"));
2403 } else {
2404 i.value()->setText(_("Clean Pollution"));
2405 }
2406 break;
2407
2408 case FALLOUT:
2409 if (can_units_do_activity_client(punits, ACTIVITY_FALLOUT)) {
2410 i.value()->setEnabled(true);
2411 }
2412 break;
2413
2414 case SENTRY:
2415 if (can_units_do_activity_client(punits, ACTIVITY_SENTRY)) {
2416 i.value()->setEnabled(true);
2417 }
2418 break;
2419
2420 case PILLAGE:
2421 if (can_units_do_activity_client(punits, ACTIVITY_PILLAGE)) {
2422 i.value()->setEnabled(true);
2423 }
2424 break;
2425
2426 case HOMECITY:
2428 i.value()->setEnabled(true);
2429 }
2430 break;
2431
2432 case WAKEUP:
2433 if (units_have_activity_on_tile(punits, ACTIVITY_SENTRY)) {
2434 i.value()->setEnabled(true);
2435 }
2436 break;
2437
2438 case AUTOSETTLER:
2440 i.value()->setEnabled(true);
2441 }
2442 if (units_contain_cityfounder(punits)) {
2443 i.value()->setText(_("Auto Settler"));
2444 } else {
2445 i.value()->setText(_("Auto Worker"));
2446 }
2447 break;
2448 case CONNECT_ROAD:
2449 proad = road_by_gui_type(ROAD_GUI_ROAD);
2450 if (proad != NULL) {
2451 tgt = road_extra_get(proad);
2452 } else {
2453 break;
2454 }
2455 if (can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt)) {
2456 i.value()->setEnabled(true);
2457 }
2458 break;
2459
2460 case DISBAND:
2461 if (units_can_do_action(punits, ACTION_DISBAND_UNIT, true)) {
2462 i.value()->setEnabled(true);
2463 }
2464 break;
2465
2466 case CONNECT_RAIL:
2467 proad = road_by_gui_type(ROAD_GUI_RAILROAD);
2468 if (proad != NULL) {
2469 tgt = road_extra_get(proad);
2470 } else {
2471 break;
2472 }
2473 if (can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt)) {
2474 i.value()->setEnabled(true);
2475 }
2476 break;
2477
2478 case CONNECT_MAGLEV:
2479 proad = road_by_gui_type(ROAD_GUI_MAGLEV);
2480 if (proad != NULL) {
2481 tgt = road_extra_get(proad);
2482 } else {
2483 break;
2484 }
2485 if (can_units_do_connect(punits, ACTIVITY_GEN_ROAD, tgt)) {
2486 i.value()->setEnabled(true);
2487 }
2488 break;
2489
2490 case CONNECT_IRRIGATION:
2491 {
2492 struct extra_type_list *extras = extra_type_list_by_cause(EC_IRRIGATION);
2493
2494 if (extra_type_list_size(extras) > 0) {
2495 struct extra_type *pextra;
2496
2497 pextra = extra_type_list_get(extra_type_list_by_cause(EC_IRRIGATION), 0);
2498 if (can_units_do_connect(punits, ACTIVITY_IRRIGATE, pextra)) {
2499 i.value()->setEnabled(true);
2500 }
2501 }
2502 }
2503 break;
2504
2505 case GOTO_CITY:
2506 if (any_cities) {
2507 i.value()->setEnabled(true);
2508 }
2509 break;
2510
2511 case AIRLIFT:
2512 if (any_cities) {
2513 i.value()->setEnabled(true);
2514 }
2515 break;
2516
2517 case BUILD_WONDER:
2518 i.value()->setText(
2519 QString(action_id_name_translation(ACTION_HELP_WONDER))
2520 .replace("&", "&&"));
2522 i.value()->setEnabled(true);
2523 }
2524 break;
2525
2526 case AUTOTRADEROUTE:
2527 if (units_can_do_action(punits, ACTION_TRADE_ROUTE, TRUE)) {
2528 i.value()->setEnabled(true);
2529 }
2530 break;
2531
2532 case ORDER_TRADE_ROUTE:
2533 i.value()->setText(
2534 QString(action_id_name_translation(ACTION_TRADE_ROUTE))
2535 .replace("&", "&&"));
2537 i.value()->setEnabled(true);
2538 }
2539 break;
2540
2541 case ORDER_DIPLOMAT_DLG:
2542 if (units_can_do_action(punits, ACTION_ANY, TRUE)) {
2543 i.value()->setEnabled(true);
2544 }
2545 break;
2546
2547 case UPGRADE:
2548 if (units_can_upgrade(&(wld.map), punits)) {
2549 i.value()->setEnabled(true);
2550 }
2551 break;
2552 default:
2553 break;
2554 }
2555
2556 i++;
2557 }
2558 }
2559}
2560
2561/**********************************************************************/
2568
2569/**********************************************************************/
2573{
2574 if (NULL != client.conn.playing) {
2576 }
2577}
2578
2579/**********************************************************************/
2586
2587/**********************************************************************/
2591{
2592 ::gui()->game_tab_widget->setCurrentIndex(0);
2593}
2594
2595/**********************************************************************/
2602
2603/**********************************************************************/
2607{
2608 popup_players_dialog(false);
2609}
2610
2611/**********************************************************************/
2618
2619/**********************************************************************/
2623{
2625 /* FIXME: this can provide different actions for different units...
2626 * not good! */
2627 /* Enable the button for adding to a city in all cases, so we
2628 get an eventual error message from the server if we try. */
2631 } else if (utype_can_do_action(unit_type_get(punit), ACTION_HELP_WONDER)) {
2632 request_unit_caravan_action(punit, ACTION_HELP_WONDER);
2633 }
2635}
2636
2637/**********************************************************************/
2644
2645/**********************************************************************/
2649{
2651 /* FIXME: this can provide different actions for different units...
2652 * not good! */
2653 struct extra_type *pextra;
2654
2655 pextra = prev_extra_in_tile(unit_tile(punit), ERM_CLEANPOLLUTION,
2657 if (pextra != NULL) {
2658 request_new_unit_activity_targeted(punit, ACTIVITY_POLLUTION, pextra);
2659 } else if (can_unit_paradrop(&(wld.map), punit)) {
2660 /* FIXME: This is getting worse, we use a key_unit_*() function
2661 * which assign the order for all units! Very bad! */
2663 }
2665}
2666
2667/**********************************************************************/
2671{
2672 struct extra_type_list *extras = extra_type_list_by_cause(EC_IRRIGATION);
2673
2674 if (extra_type_list_size(extras) > 0) {
2675 struct extra_type *pextra;
2676
2677 pextra = extra_type_list_get(extra_type_list_by_cause(EC_IRRIGATION), 0);
2678
2679 key_unit_connect(ACTIVITY_IRRIGATE, pextra);
2680 }
2681}
2682
2683/**********************************************************************/
2687{
2688 struct road_type *prail = road_by_gui_type(ROAD_GUI_RAILROAD);
2689
2690 if (prail != NULL) {
2691 struct extra_type *tgt;
2692
2693 tgt = road_extra_get(prail);
2694 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2695 }
2696}
2697
2698/**********************************************************************/
2702{
2703 struct road_type *pmaglev = road_by_gui_type(ROAD_GUI_MAGLEV);
2704
2705 if (pmaglev != NULL) {
2706 struct extra_type *tgt;
2707
2708 tgt = road_extra_get(pmaglev);
2709 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2710 }
2711}
2712
2713/**********************************************************************/
2720
2721/**********************************************************************/
2728
2729/**********************************************************************/
2733{
2734 struct road_type *proad = road_by_gui_type(ROAD_GUI_ROAD);
2735
2736 if (proad != NULL) {
2737 struct extra_type *tgt;
2738
2739 tgt = road_extra_get(proad);
2740 key_unit_connect(ACTIVITY_GEN_ROAD, tgt);
2741 }
2742}
2743
2744/**********************************************************************/
2751
2752/**********************************************************************/
2756{
2758}
2759
2760/**********************************************************************/
2767
2768/**********************************************************************/
2775
2776/**********************************************************************/
2780{
2782 /* FIXME: this can provide different actions for different units...
2783 * not good! */
2785 EC_ROAD,
2787 punit);
2788 bool building_road = false;
2789
2790 if (tgt != NULL
2791 && can_unit_do_activity_targeted_client(punit, ACTIVITY_GEN_ROAD, tgt)) {
2792 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD, tgt);
2793 building_road = true;
2794 }
2795
2796 if (!building_road && unit_can_est_trade_route_here(punit)) {
2797 request_unit_caravan_action(punit, ACTION_TRADE_ROUTE);
2798 }
2800}
2801
2802/**********************************************************************/
2809
2810/**********************************************************************/
2817
2818/**********************************************************************/
2822{
2823 key_unit_mine();
2824}
2825
2826/**********************************************************************/
2830{
2832}
2833
2834/**********************************************************************/
2841
2842/**********************************************************************/
2849
2850/**********************************************************************/
2854{
2856}
2857
2858/**********************************************************************/
2865
2866/**********************************************************************/
2870{
2871 delayed_order = false;
2872 units_list.clear();
2873}
2874
2875/**********************************************************************/
2879{
2880 gui()->rallies.hover_tile = false;
2881 gui()->rallies.hover_city = true;
2882}
2883
2884/**********************************************************************/
2888{
2889 gui()->trade_gen.hover_city = true;
2890}
2891
2892/**********************************************************************/
2896{
2897 gui()->trade_gen.add_all_cities();
2898}
2899
2900/**********************************************************************/
2904{
2905 gui()->trade_gen.calculate();
2906}
2907
2908/**********************************************************************/
2912{
2913 gui()->trade_gen.clear_trade_planing();
2914}
2915
2916/**********************************************************************/
2920{
2921 qtiles gilles;
2922 struct unit *punit;
2923 struct city *homecity;
2924 struct tile *home_tile;
2925 struct tile *dest_tile;
2926 bool sent = false;
2927
2929 homecity = game_city_by_number(punit->homecity);
2930 home_tile = homecity->tile;
2931 foreach(gilles, gui()->trade_gen.lines) {
2932 if ((gilles.t1 == home_tile || gilles.t2 == home_tile)
2933 && gilles.autocaravan == nullptr) {
2934 /* send caravan */
2935 if (gilles.t1 == home_tile) {
2936 dest_tile = gilles.t2;
2937 } else {
2938 dest_tile = gilles.t1;
2939 }
2940 if (send_goto_tile(punit, dest_tile)) {
2941 int i;
2942 i = gui()->trade_gen.lines.indexOf(gilles);
2943 gilles = gui()->trade_gen.lines.takeAt(i);
2944 gilles.autocaravan = punit;
2945 gui()->trade_gen.lines.append(gilles);
2946 sent = true;
2947 break;
2948 }
2949 }
2950 }
2951
2952 if (!sent) {
2953 gui()->infotab->chtwdg->append(_("Didn't find any trade route"
2954 " to establish"));
2955 }
2956}
2957
2958/**********************************************************************/
2962{
2963 QVariant v;
2964 QAction *act;
2965
2966 act = qobject_cast<QAction *>(sender());
2967 v = act->data();
2968 airlift_type_id = v.toInt();
2969}
2970
2971/**********************************************************************/
2975{
2976 QAction *act;
2977
2978 act = qobject_cast<QAction *>(sender());
2979 qdef_act::action()->vs_unit_set(act->data().toInt());
2980}
2981
2982/**********************************************************************/
2986{
2987 QAction *act;
2988
2989 act = qobject_cast<QAction *>(sender());
2990 qdef_act::action()->vs_city_set(act->data().toInt());
2991}
2992
2993/**********************************************************************/
2997{
2998 quick_airlifting = true;
2999}
3000
3001/**********************************************************************/
3005{
3007 int i = 0;
3008 delay_order dg;
3009
3010 delayed_order = true;
3011 dg = D_GOTO;
3012
3013 struct unit_list *punits = get_units_in_focus();
3014 if (unit_list_size(punits) == 0) {
3015 return;
3016 }
3017 if (hover_state != HOVER_GOTO) {
3018 set_hover_state(punits, HOVER_GOTO, ACTIVITY_LAST, NULL,
3020 enter_goto_state(punits);
3023 }
3025 i++;
3028 units_list.nr_units = i;
3030}
3031
3032/**********************************************************************/
3036{
3038 struct unit *punit;
3039 struct tile *last_tile;
3040 struct tile *new_tile;
3041 int i = 0;
3042
3043 foreach (fui, units_list.unit_list) {
3044 i++;
3045 punit = unit_list_find(client_player()->units, fui->id);
3046 if (punit == nullptr) {
3047 continue;
3048 }
3049 last_tile = punit->tile;
3050 new_tile = find_last_unit_pos(punit, i);
3051 if (new_tile != nullptr) {
3052 punit->tile = new_tile;
3053 }
3054 if (is_tiles_adjacent(punit->tile, fui->ptile)) {
3057 punit->tile,
3058 fui->ptile));
3059 } else {
3061 }
3062 punit->tile = last_tile;
3063 }
3064 units_list.clear();
3065}
3066
3067/**********************************************************************/
3076
3077/**********************************************************************/
3081{
3083}
3084
3085/**********************************************************************/
3094
3095/**********************************************************************/
3099{
3101}
3102
3103/**********************************************************************/
3110
3111/**********************************************************************/
3120
3121/**********************************************************************/
3128
3129/**********************************************************************/
3136
3137/**********************************************************************/
3144
3145/**********************************************************************/
3149{
3150 key_unit_goto();
3151}
3152
3153/**********************************************************************/
3160
3161/**********************************************************************/
3168
3169/**********************************************************************/
3173{
3174 if (gui()->interface_locked) {
3175 enable_interface(false);
3176 } else {
3177 enable_interface(true);
3178 }
3179 gui()->interface_locked = !gui()->interface_locked;
3180}
3181
3182/**********************************************************************/
3186{
3187 QList<close_widget *> lc;
3188 QList<move_widget *> lm;
3189 QList<resize_widget *> lr;
3190 int i;
3191
3192 lc = gui()->findChildren<close_widget *>();
3193 lm = gui()->findChildren<move_widget *>();
3194 lr = gui()->findChildren<resize_widget *>();
3195
3196 for (i = 0; i < lc.size(); ++i) {
3197 lc.at(i)->setVisible(!enable);
3198 }
3199 for (i = 0; i < lm.size(); ++i) {
3200 lm.at(i)->setVisible(!enable);
3201 }
3202 for (i = 0; i < lr.size(); ++i) {
3203 lr.at(i)->setVisible(!enable);
3204 }
3205}
3206
3207/**********************************************************************/
3211{
3213
3214 gui()->apply_fullscreen();
3215}
3216
3217/**********************************************************************/
3221{
3222 if (minimap_status->isChecked()) {
3223 ::gui()->minimapview_wdg->show();
3224 } else {
3225 ::gui()->minimapview_wdg->hide();
3226 }
3227}
3228
3229/**********************************************************************/
3233{
3234 if (osd_status->isChecked()) {
3235 gui()->qt_settings.show_new_turn_text = true;
3236 } else {
3237 gui()->qt_settings.show_new_turn_text = false;
3238 }
3239}
3240
3241/**********************************************************************/
3245{
3246 if (btlog_status->isChecked()) {
3247 gui()->qt_settings.show_battle_log = true;
3248 } else {
3249 gui()->qt_settings.show_battle_log = false;
3250 }
3251}
3252
3253/**********************************************************************/
3260
3261/**********************************************************************/
3268
3269/**********************************************************************/
3276
3277/**********************************************************************/
3284
3285/**********************************************************************/
3289{
3290 gui()->map_scale = gui()->map_scale * 1.2f;
3291 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3292}
3293
3294/**********************************************************************/
3298{
3299 QFont *qf;
3300
3301 gui()->map_scale = 1.0f;
3303 qf->setPointSize(fc_font::instance()->city_fontsize);
3305 qf->setPointSize(fc_font::instance()->prod_fontsize);
3306 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3307}
3308
3309/**********************************************************************/
3313{
3314 QFont *qf;
3315
3316 if (scale_fonts_status->isChecked()) {
3317 gui()->map_font_scale = true;
3318 } else {
3320 qf->setPointSize(fc_font::instance()->city_fontsize);
3322 qf->setPointSize(fc_font::instance()->prod_fontsize);
3323 gui()->map_font_scale = false;
3324 }
3326}
3327
3328
3329/**********************************************************************/
3333{
3334 gui()->map_scale = gui()->map_scale / 1.2f;
3335 tilespec_reread(tileset_basename(tileset), true, gui()->map_scale);
3336}
3337
3338/**********************************************************************/
3345
3346/**********************************************************************/
3353
3354/**********************************************************************/
3361
3362/**********************************************************************/
3369
3370/**********************************************************************/
3377
3378/**********************************************************************/
3385
3386/**********************************************************************/
3393
3394/**********************************************************************/
3401
3402/**********************************************************************/
3406{
3407 key_unit_done();
3408}
3409
3410/**********************************************************************/
3414{
3415 request_unit_select(get_units_in_focus(), SELTYPE_ALL, SELLOC_TILE);
3416}
3417
3418/**********************************************************************/
3422{
3423 request_unit_select(get_units_in_focus(), SELTYPE_SINGLE, SELLOC_TILE);
3424}
3425
3426/**********************************************************************/
3435
3436/**********************************************************************/
3445
3446/**********************************************************************/
3450{
3451 request_unit_select(get_units_in_focus(), SELTYPE_SAME, SELLOC_TILE);
3452}
3453
3454/**********************************************************************/
3458{
3459 key_unit_wait();
3460}
3461
3462/**********************************************************************/
3466{
3467 unit_hud_selector *uhs;
3468 uhs = new unit_hud_selector(gui()->central_wdg);
3469 uhs->show_me();
3470}
3471
3472/**********************************************************************/
3479
3480/**********************************************************************/
3487
3488/**********************************************************************/
3495
3496/**********************************************************************/
3503
3504/**********************************************************************/
3511
3512/**********************************************************************/
3519
3520/**********************************************************************/
3527
3528/**********************************************************************/
3535
3536/**********************************************************************/
3543
3544/**********************************************************************/
3551
3552/**********************************************************************/
3559
3560/**********************************************************************/
3567
3568/**********************************************************************/
3575
3576/**********************************************************************/
3583
3584/**********************************************************************/
3591
3592/**********************************************************************/
3599
3600/**********************************************************************/
3607
3608/**********************************************************************/
3612{
3613 QDialog *dialog = new QDialog(this);
3614 QLabel *label;
3615 QPushButton *but;
3616 QVBoxLayout *layout;
3617 const struct strvec *tlset_list;
3618 const struct option *poption;
3619 QStringList sl;
3620 QString s;
3621
3622 sl << "default_tileset_overhead_name" << "default_tileset_iso_name"
3623 << "default_tileset_hex_name" << "default_tileset_isohex_name";
3624 layout = new QVBoxLayout;
3625 dialog->setWindowTitle(_("Available tilesets"));
3626 label = new QLabel;
3627 label->setText(_("Some tilesets might not be compatible with current"
3628 " map topology!"));
3629 layout->addWidget(label);
3630
3631 foreach (s, sl) {
3632 QByteArray on_bytes;
3633
3634 on_bytes = s.toUtf8();
3635 poption = optset_option_by_name(client_optset, on_bytes.data());
3636 tlset_list = get_tileset_list(poption);
3637 strvec_iterate(tlset_list, value) {
3638 but = new QPushButton(value);
3639 connect(but, &QAbstractButton::clicked, this, &mr_menu::load_new_tileset);
3640 layout->addWidget(but);
3642 }
3643 dialog->setSizeGripEnabled(true);
3644 dialog->setLayout(layout);
3645 dialog->show();
3646}
3647
3648/**********************************************************************/
3652{
3653 QPushButton *but;
3654 QByteArray tn_bytes;
3655
3656 but = qobject_cast<QPushButton *>(sender());
3657 tn_bytes = but->text().toUtf8();
3658 tilespec_reread(tn_bytes.data(), true, 1.0f);
3659 gui()->map_scale = 1.0f;
3660 but->parentWidget()->close();
3661}
3662
3663/**********************************************************************/
3667{
3668 gui()->trade_gen.calculate();
3669}
3670
3671/**********************************************************************/
3678
3679/**********************************************************************/
3686
3687/**********************************************************************/
3690void mr_menu::slot_help(const QString &topic)
3691{
3692 popup_help_dialog_typed(Q_(topic.toStdString().c_str()), HELP_ANY);
3693}
3694
3695/****************************************************************
3696 Actions "BUILD_PATH_*"
3697*****************************************************************/
3699{
3701 extra_type_by_cause_iterate(EC_ROAD, pextra) {
3702 if (pextra->buildable && pextra->id == id
3703 && can_unit_do_activity_targeted_client(punit, ACTIVITY_GEN_ROAD,
3704 pextra)) {
3705 request_new_unit_activity_targeted(punit, ACTIVITY_GEN_ROAD, pextra);
3706 }
3709}
3710
3711/****************************************************************
3712 Actions "BUILD_BASE_*"
3713*****************************************************************/
3715{
3717 extra_type_by_cause_iterate(EC_BASE, pextra) {
3718 if (pextra->buildable && pextra->id == id
3720 pextra)) {
3721 request_new_unit_activity_targeted(punit, ACTIVITY_BASE, pextra);
3722 }
3725}
3726
3727
3728
3729/**********************************************************************/
3733{
3734 gui()->popup_client_options();
3735}
3736
3737/**********************************************************************/
3744
3745/**********************************************************************/
3749{
3750 gui()->pr_options->popup_server_options();
3751}
3752
3753/**********************************************************************/
3760
3761/**********************************************************************/
3765{
3766 options_save(NULL);
3767}
3768
3769/**********************************************************************/
3773{
3775}
3776
3777/**********************************************************************/
3781{
3782 int current_width, current_height;
3783 int full_size_x, full_size_y;
3784 QString path, storage_path;
3785 hud_message_box *saved = new hud_message_box(gui()->central_wdg);
3786 bool map_saved;
3787 QString img_name;
3788
3789 full_size_x = (wld.map.xsize + 2) * tileset_tile_width(tileset);
3790 full_size_y = (wld.map.ysize + 2) * tileset_tile_height(tileset);
3791 current_width = gui()->mapview_wdg->width();
3792 current_height = gui()->mapview_wdg->height();
3793 if (tileset_hex_width(tileset) > 0) {
3794 full_size_y = full_size_y * 11 / 20;
3795 } else if (tileset_is_isometric(tileset)) {
3796 full_size_y = full_size_y / 2;
3797 }
3798 map_canvas_resized(full_size_x, full_size_y);
3799 img_name = QString("Freeciv-Turn%1").arg(game.info.turn);
3800 if (client_has_player()) {
3801 img_name = img_name + "-"
3803 }
3804 storage_path = freeciv_storage_dir();
3805 path = QStandardPaths::writableLocation(QStandardPaths::PicturesLocation);
3806 if (!storage_path.isEmpty() && QDir(storage_path).isReadable()) {
3807 img_name = storage_path + DIR_SEPARATOR + img_name;
3808 } else if (!path.isEmpty()) {
3809 img_name = path + DIR_SEPARATOR + img_name;
3810 } else {
3811 img_name = QStandardPaths::writableLocation(QStandardPaths::HomeLocation)
3812 + DIR_SEPARATOR + img_name;
3813 }
3814 map_saved = mapview.store->map_pixmap.save(img_name, "png");
3815 map_canvas_resized(current_width, current_height);
3816 saved->setStandardButtons(QMessageBox::Ok);
3817 saved->setDefaultButton(QMessageBox::Cancel);
3818 saved->setAttribute(Qt::WA_DeleteOnClose);
3819 if (map_saved) {
3820 saved->set_text_title("Image saved as:\n" + img_name, _("Success"));
3821 } else {
3822 saved->set_text_title(_("Failed to save image of the map"), _("Error"));
3823 }
3824 saved->show();
3825}
3826
3827/**********************************************************************/
3831{
3832 send_save_game(NULL);
3833}
3834
3835/**********************************************************************/
3839{
3840 QString str;
3841 QString current_file;
3842 QString location;
3843
3844 strvec_iterate(get_save_dirs(), dirname) {
3845 location = dirname;
3846 // choose last location
3848
3849 str = QString(_("Save Games"))
3850 + QString(" (*.sav *.sav.bz2 *.sav.gz *.sav.xz)");
3851 current_file = QFileDialog::getSaveFileName(gui()->central_wdg,
3852 _("Save Game As..."),
3853 location, str);
3854 if (!current_file.isEmpty()) {
3855 QByteArray cf_bytes;
3856
3857 cf_bytes = current_file.toUtf8();
3858 send_save_game(cf_bytes.data());
3859 }
3860}
3861
3862/**********************************************************************/
3866{
3867 hud_message_box *ask;
3868
3869 if (is_server_running()) {
3870 ask = new hud_message_box(gui()->central_wdg);
3871 ask->set_text_title(_("Leaving a local game will end it!"), "Leave game");
3872 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
3873 ask->setDefaultButton(QMessageBox::Cancel);
3874 ask->setAttribute(Qt::WA_DeleteOnClose);
3875
3876 connect(ask, &hud_message_box::accepted, [=]() {
3877 if (client.conn.used) {
3878 disconnect_from_server();
3879 }
3880 });
3881 ask->show();
3882 } else {
3884 }
3885}
3886
3887/**********************************************************************/
3891{
3892 hud_message_box* ask = new hud_message_box(gui()->central_wdg);
3893
3894 ask->setIcon(QMessageBox::Warning);
3895 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Ok);
3896 ask->setDefaultButton(QMessageBox::Cancel);
3897 ask->setAttribute(Qt::WA_DeleteOnClose);
3898 return (ask->set_text_title(_("Selection will cancel current assignments!"),
3899 _("Confirm Disruptive Selection"), true)
3900 == QMessageBox::Ok);
3901}
3902
3903/**********************************************************************/
3906void multiairlift(struct city *acity, Unit_type_id ut)
3907{
3908 struct tile *ptile;
3910 if (get_city_bonus(pcity, EFT_AIRLIFT) > 0) {
3911 ptile = city_tile(pcity);
3912 unit_list_iterate(ptile->units, punit) {
3913 if (punit->utype == utype_by_number(ut)) {
3915 break;
3916 }
3918 }
3920}
bool action_removes_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2312
const char * action_name_translation(const struct action *action)
Definition actions.c:1890
const char * action_id_name_translation(action_id act_id)
Definition actions.c:1910
enum action_sub_target_kind action_get_sub_target_kind(const struct action *paction)
Definition actions.c:1751
bool actions_are_ready(void)
Definition actions.c:1583
bool action_creates_extra(const struct action *paction, const struct extra_type *pextra)
Definition actions.c:2224
static struct action * action_by_number(action_id act_id)
Definition actions.h:638
#define action_iterate_end
Definition actions.h:472
#define action_id_get_actor_kind(act_id)
Definition actions.h:651
#define action_iterate(_act_)
Definition actions.h:467
#define ACTION_ANY
Definition actions.h:290
#define action_id_get_target_kind(act_id)
Definition actions.h:655
#define action_id_has_complex_target(act_id)
Definition actions.h:673
#define ACTION_NONE
Definition actions.h:293
#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:3343
void destroy_city_virtual(struct city *pcity)
Definition city.c:3419
static bool is_non_allied_city_tile(const struct tile *ptile, const struct player *pplayer)
Definition city.h:748
#define city_list_iterate(citylist, pcity)
Definition city.h:488
#define city_tile(_pcity_)
Definition city.h:544
#define city_list_iterate_end
Definition city.h:490
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:236
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:238
static QSet< gov_menu * > instances
Definition menu.h:211
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:213
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
int set_text_title(QString s1, QString s2, bool return_exec=false)
bool shortcut_2_menustring_inner(const QMenu *m, QKeySequence seq, QString *ret)
Definition menu.cpp:1881
void slot_unit_sentry()
Definition menu.cpp:2845
QActionGroup * action_vs_city
Definition menu.h:266
void slot_bg3select()
Definition menu.cpp:3563
void slot_traveler()
Definition menu.cpp:3507
bool execute_shortcut_inner(const QMenu *m, QKeySequence seq)
Definition menu.cpp:1799
void slot_delayed_goto()
Definition menu.cpp:3004
void zoom_in()
Definition menu.cpp:3288
void slot_autocaravan()
Definition menu.cpp:2919
QMenu * multiplayer_menu
Definition menu.h:263
void slot_build_irrigation()
Definition menu.cpp:2805
void slot_execute_orders()
Definition menu.cpp:3035
void update_bases_menu()
Definition menu.cpp:2006
QString shortcut_exist(fc_shortcut *fcs)
Definition menu.cpp:1858
void tileset_custom_load()
Definition menu.cpp:3611
void update_roads_menu()
Definition menu.cpp:1959
void slot_calculate()
Definition menu.cpp:2903
void slot_conn_road()
Definition menu.cpp:2732
void slot_conn_irrigation()
Definition menu.cpp:2670
QMenu * bases_menu
Definition menu.h:262
QActionGroup * airlift_type
Definition menu.h:265
void slot_quickairlift_set()
Definition menu.cpp:2961
void slot_battlelog()
Definition menu.cpp:3244
QMultiHash< munit, QAction * > menu_list
Definition menu.h:270
void slot_trade_add_all()
Definition menu.cpp:2895
void update_airlift_menu()
Definition menu.cpp:1923
void slot_show_cities()
Definition menu.cpp:2614
void slot_transform()
Definition menu.cpp:2747
void slot_action_vs_unit()
Definition menu.cpp:2974
void slot_achievements()
Definition menu.cpp:3483
void slot_show_research_tab()
Definition menu.cpp:2564
void shortcut_options()
Definition menu.cpp:3740
void slot_city_output()
Definition menu.cpp:3357
void slot_show_eco_report()
Definition menu.cpp:2582
QMenu * airlift_menu
Definition menu.h:261
QAction * osd_status
Definition menu.h:286
void slot_bg1select()
Definition menu.cpp:3515
void slot_unload_all()
Definition menu.cpp:3124
void slot_airlift()
Definition menu.cpp:3098
void slot_select_same_continent()
Definition menu.cpp:3429
void slot_city_production()
Definition menu.cpp:3365
void slot_set_home()
Definition menu.cpp:3106
QAction * lock_status
Definition menu.h:285
void slot_native_tiles()
Definition menu.cpp:3264
void slot_unit_explore()
Definition menu.cpp:3156
void slot_bg4assign()
Definition menu.cpp:3595
void slot_bg1append()
Definition menu.cpp:3531
void slot_upgrade()
Definition menu.cpp:3140
void execute_shortcut(int sid)
Definition menu.cpp:1814
void slot_popup_mult_rates()
Definition menu.cpp:3682
void slot_select_same_everywhere()
Definition menu.cpp:3439
void slot_map_grid()
Definition menu.cpp:3397
void slot_unit_filter()
Definition menu.cpp:3465
void slot_bg2select()
Definition menu.cpp:3539
void slot_clean_pollution()
Definition menu.cpp:2648
void slot_done_moving()
Definition menu.cpp:3405
void calc_trade_routes()
Definition menu.cpp:3666
void slot_city_buycost()
Definition menu.cpp:3272
void slot_action()
Definition menu.cpp:2763
void slot_bg4append()
Definition menu.cpp:3603
QMenu * roads_menu
Definition menu.h:264
QAction * minimap_status
Definition menu.h:283
bool shortcut_exist_inner(const QMenu *m, QKeySequence seq, fc_shortcut *fcs, QString *ret)
Definition menu.cpp:1841
void slot_select_all_tile()
Definition menu.cpp:3413
void save_game()
Definition menu.cpp:3830
struct tile * find_last_unit_pos(struct unit *punit, int pos)
Definition menu.cpp:905
void save_image()
Definition menu.cpp:3780
void slot_pillage()
Definition menu.cpp:2755
void zoom_reset()
Definition menu.cpp:3297
void slot_board()
Definition menu.cpp:3070
void slot_center_view()
Definition menu.cpp:3164
void slot_build_mine()
Definition menu.cpp:2821
void server_options()
Definition menu.cpp:3748
void load_new_tileset()
Definition menu.cpp:3651
void set_tile_for_order(struct tile *ptile)
Definition menu.cpp:1787
void slot_fullscreen()
Definition menu.cpp:3210
void slot_bg4select()
Definition menu.cpp:3587
void slot_top_five()
Definition menu.cpp:3499
void slot_show_nations()
Definition menu.cpp:2606
void slot_build_road()
Definition menu.cpp:2779
void slot_unsentry()
Definition menu.cpp:3132
void slot_show_new_turn_text()
Definition menu.cpp:3232
void local_options()
Definition menu.cpp:3732
bool delayed_order
Definition menu.h:290
void slot_borders()
Definition menu.cpp:3256
void slot_clear_trade()
Definition menu.cpp:2911
void zoom_scale_fonts()
Definition menu.cpp:3312
void slot_conn_rail()
Definition menu.cpp:2686
void slot_select_same_tile()
Definition menu.cpp:3449
void slot_convert()
Definition menu.cpp:2853
QMenu * action_unit_menu
Definition menu.h:268
QActionGroup * action_vs_unit
Definition menu.h:267
void slot_endgame()
Definition menu.cpp:3491
void slot_bg2assign()
Definition menu.cpp:3547
void slot_select_one()
Definition menu.cpp:3421
void menus_sensitive()
Definition menu.cpp:2053
void messages_options()
Definition menu.cpp:3756
void slot_unit_goto()
Definition menu.cpp:3148
void slot_cultivate()
Definition menu.cpp:2813
void slot_stack_size()
Definition menu.cpp:3381
void slot_conn_maglev()
Definition menu.cpp:2701
void slot_patrol()
Definition menu.cpp:3080
void slot_unit_fortress()
Definition menu.cpp:2716
void slot_wait()
Definition menu.cpp:3457
void slot_demographics()
Definition menu.cpp:3475
void slot_build_city()
Definition menu.cpp:2622
void slot_city_growth()
Definition menu.cpp:3280
void slot_city_trade_routes()
Definition menu.cpp:3373
void slot_rally()
Definition menu.cpp:2878
void slot_plant()
Definition menu.cpp:2829
void slot_build_path(int id)
Definition menu.cpp:3698
void slot_bg1assign()
Definition menu.cpp:3523
void slot_return_to_city()
Definition menu.cpp:3088
Unit_type_id airlift_type_id
Definition menu.h:292
void slot_show_map()
Definition menu.cpp:2590
void slot_bg3assign()
Definition menu.cpp:3571
QAction * scale_fonts_status
Definition menu.h:284
void slot_minimap_view()
Definition menu.cpp:3220
void slot_trade_city()
Definition menu.cpp:2887
void quit_game()
Definition menu.cpp:3772
void slot_help(const QString &topic)
Definition menu.cpp:3690
void save_game_as()
Definition menu.cpp:3838
void slot_bg2append()
Definition menu.cpp:3555
bool quick_airlifting
Definition menu.h:291
void slot_spaceship()
Definition menu.cpp:2572
void slot_city_names()
Definition menu.cpp:3341
void slot_clean_fallout()
Definition menu.cpp:2640
QMenu * action_city_menu
Definition menu.h:269
void save_options_now()
Definition menu.cpp:3764
QAction * btlog_status
Definition menu.h:287
void slot_unit_fortify()
Definition menu.cpp:2837
void slot_show_units_report()
Definition menu.cpp:2598
void slot_quickairlift()
Definition menu.cpp:2996
QString shortcut_2_menustring(int sid)
Definition menu.cpp:1899
void slot_lock()
Definition menu.cpp:3172
void back_to_menu()
Definition menu.cpp:3865
void slot_deboard()
Definition menu.cpp:3114
void slot_popup_tax_rates()
Definition menu.cpp:3674
void slot_auto_settler()
Definition menu.cpp:2771
void slot_build_base(int id)
Definition menu.cpp:3714
qfc_units_list units_list
Definition menu.h:271
void setup_menus()
Definition menu.cpp:956
mr_menu()
Definition menu.cpp:947
void slot_bg3append()
Definition menu.cpp:3579
void slot_action_vs_city()
Definition menu.cpp:2985
void zoom_out()
Definition menu.cpp:3332
void slot_disband()
Definition menu.cpp:2861
void slot_unit_airbase()
Definition menu.cpp:2724
void slot_fullbar()
Definition menu.cpp:3389
void slot_city_outlines()
Definition menu.cpp:3349
bool confirm_disruptive_selection()
Definition menu.cpp:3890
void slot_orders_clear()
Definition menu.cpp:2869
static qdef_act * action()
Definition dialogs.cpp:1020
void vs_city_set(int i)
Definition dialogs.cpp:1042
void vs_unit_set(int i)
Definition dialogs.cpp:1050
struct tile * ptile
Definition menu.h:118
QList< qfc_delayed_unit_item * > unit_list
Definition menu.h:130
void add(qfc_delayed_unit_item *fui)
Definition menu.cpp:493
int nr_units
Definition menu.h:131
void clear()
Definition menu.cpp:501
bool done
Definition menu.h:142
unsigned trade_num
Definition menu.h:145
int poss_trade_num
Definition menu.h:144
QList< struct city * > pos_cities
Definition menu.h:148
QList< struct city * > new_tr_cities
Definition menu.h:147
int over_max
Definition menu.h:143
trade_city(struct city *pcity)
Definition menu.cpp:68
QList< struct city * > curr_tr_cities
Definition menu.h:146
struct city * city
Definition menu.h:149
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:181
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:178
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:179
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:180
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:1235
void disconnect_from_server(void)
Definition clinet.c:305
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:3634
void request_unit_airlift(struct unit *punit, struct city *pcity)
Definition control.c:1538
void key_city_output_toggle(void)
Definition control.c:3731
void request_unit_return(struct unit *punit)
Definition control.c:1547
void request_unit_caravan_action(struct unit *punit, action_id action)
Definition control.c:2148
void key_unit_auto_explore(void)
Definition control.c:3410
void key_unit_auto_settle(void)
Definition control.c:3423
void key_unit_connect(enum unit_activity activity, struct extra_type *tgt)
Definition control.c:3216
void key_city_full_bar_toggle(void)
Definition control.c:3763
void key_map_native_toggle(void)
Definition control.c:3755
void request_unit_goto(enum unit_orders last_order, action_id act_id, int sub_tgt_id)
Definition control.c:1129
void key_unit_paradrop(void)
Definition control.c:3320
struct unit_list * get_units_in_focus(void)
Definition control.c:177
void request_center_focus_unit(void)
Definition control.c:2637
void key_city_productions_toggle(void)
Definition control.c:3797
void key_unit_plant(void)
Definition control.c:3556
void key_unit_fortress(void)
Definition control.c:3465
void key_unit_mine(void)
Definition control.c:3548
void key_unit_pillage(void)
Definition control.c:3568
void request_unit_unload(struct unit *pcargo)
Definition control.c:2119
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Definition control.c:1863
void key_unit_irrigate(void)
Definition control.c:3528
void request_unit_build_city(struct unit *punit)
Definition control.c:1740
void key_unit_unload_all(void)
Definition control.c:3350
void key_city_outlines_toggle(void)
Definition control.c:3723
void key_unit_homecity(void)
Definition control.c:3482
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:3328
void key_unit_wakeup_others(void)
Definition control.c:3383
enum cursor_hover_state hover_state
Definition control.c:89
void key_unit_stack_size_toggle(void)
Definition control.c:3814
void key_unit_wait(void)
Definition control.c:3375
void key_unit_select_battlegroup(int battlegroup, bool append)
Definition control.c:3697
void key_map_grid_toggle(void)
Definition control.c:3739
struct unit * head_of_units_in_focus(void)
Definition control.c:411
void key_city_growth_toggle(void)
Definition control.c:3780
void key_unit_action_select_tgt(void)
Definition control.c:3247
void key_unit_fallout(void)
Definition control.c:3445
void key_city_buycost_toggle(void)
Definition control.c:3789
int get_num_units_in_focus(void)
Definition control.c:185
void key_unit_transform(void)
Definition control.c:3646
void request_move_unit_direction(struct unit *punit, int dir)
Definition control.c:1803
void key_unit_done(void)
Definition control.c:3304
void key_city_trade_routes_toggle(void)
Definition control.c:3806
void key_city_names_toggle(void)
Definition control.c:3771
void request_unit_select(struct unit_list *punits, enum unit_select_type_mode seltype, enum unit_select_location_mode selloc)
Definition control.c:1616
void key_unit_airbase(void)
Definition control.c:3393
void key_unit_goto(void)
Definition control.c:3312
void control_mouse_cursor(struct tile *ptile)
Definition control.c:1214
void key_unit_convert(void)
Definition control.c:3435
void key_unit_fortify(void)
Definition control.c:3453
void key_unit_assign_battlegroup(int battlegroup, bool append)
Definition control.c:3658
void key_unit_cultivate(void)
Definition control.c:3536
void key_map_borders_toggle(void)
Definition control.c:3747
#define can_unit_do_activity_targeted_client(_punit_, _act_, _tgt_)
Definition control.h:42
#define can_units_do_activity_targeted_client(_punits_, _act_, _tgt_)
Definition control.h:46
@ HOVER_GOTO
Definition control.h:27
#define can_units_do_activity_client(_punits_, _act_)
Definition control.h:44
bool qtg_request_transport(struct unit *pcargo, struct tile *ptile)
Definition dialogs.cpp:4759
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:73
int get_city_bonus(const struct city *pcity, enum effect_type effect_type)
Definition effects.c:789
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:740
int extra_number(const struct extra_type *pextra)
Definition extras.c:153
struct extra_type_list * extra_type_list_by_cause(enum extra_cause cause)
Definition extras.c:241
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:765
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:186
#define extra_type_iterate(_p)
Definition extras.h:291
#define extra_type_iterate_end
Definition extras.h:297
#define extra_type_by_cause_iterate_end
Definition extras.h:315
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:309
#define NO_TARGET
Definition fc_types.h:324
int Unit_type_id
Definition fc_types.h:352
#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:57
struct world wld
Definition game.c:58
struct city * game_city_by_number(int id)
Definition game.c:102
struct tile * tile_before_end_path(struct unit *punit, struct tile *ptile)
Definition goto.c:2012
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:998
const char * government_name_translation(const struct government *pgovern)
Definition government.c:142
bool untargeted_revolution_allowed(void)
Definition government.c:565
Government_type_id government_count(void)
Definition government.c:70
struct government * government_by_number(const Government_type_id gov)
Definition government.c:102
bool can_change_to_government(struct player *pplayer, const struct government *gov)
Definition government.c:165
static PangoLayout * layout
Definition canvas.c:331
void city_report_dialog_popup(bool raise)
Definition cityrep.c:292
void popup_upgrade_dialog(struct unit_list *punits)
Definition dialogs.c:1444
void popup_disband_dialog(struct unit_list *punits)
Definition dialogs.c:1482
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:257
void popup_quit_dialog(void)
Definition gui_main.c:2154
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
Definition helpdlg.c:195
void create_line_at_mouse_pos(void)
Definition mapctrl.c:347
void update_city_descriptions(void)
Definition mapview.c:470
static const char * get_tile_change_menu_text(struct tile *ptile, enum unit_activity activity)
Definition menu.c:2302
#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:1242
void popup_spaceship_dialog(struct player *pplayer)
delay_order
Definition menu.h:81
@ D_GOTO
Definition menu.h:82
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:55
@ GOTO_CITY
Definition menu.h:68
@ TRANSPORTER
Definition menu.h:44
@ BUILD
Definition menu.h:53
@ 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:52
@ FALLOUT
Definition menu.h:59
@ BUILD_WONDER
Definition menu.h:70
@ DISBAND
Definition menu.h:45
@ DEBOARD
Definition menu.h:43
@ 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
@ POLLUTION
Definition menu.h:58
@ 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:54
@ CONNECT_MAGLEV
Definition menu.h:66
@ CULTIVATE
Definition menu.h:50
@ AUTOSETTLER
Definition menu.h:63
@ BOARD
Definition menu.h:42
@ FORTRESS
Definition menu.h:56
@ ENDGAME
Definition menu.h:77
@ AUTOTRADEROUTE
Definition menu.h:71
@ AIRBASE
Definition menu.h:57
void popup_revolution_dialog(void)
Definition dialogs.c:109
#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:1345
bool is_tiles_adjacent(const struct tile *tile0, const struct tile *tile1)
Definition map.c:929
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:3185
void multiairlift(struct city *acity, Unit_type_id ut)
Definition menu.cpp:3906
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:177
const struct option_set * client_optset
Definition options.c:1255
void options_save(option_save_log_callback log_cb)
Definition options.c:6053
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:406
@ REPORT_WONDERS_OF_THE_WORLD
Definition packets.h:74
@ REPORT_DEMOGRAPHIC
Definition packets.h:76
@ REPORT_TOP_5_CITIES
Definition packets.h:75
@ REPORT_ACHIEVEMENTS
Definition packets.h:77
void popup_shortcuts_dialog()
void toggle_units_report(bool)
#define players_iterate_end
Definition player.h:535
#define players_iterate(_pplayer)
Definition player.h:530
void popup_endgame_report()
struct extra_type * road_extra_get(const struct road_type *proad)
Definition road.c:42
struct road_type * road_by_gui_type(enum road_gui_type gui_type)
Definition road.c:180
const struct strvec * get_save_dirs(void)
Definition shared.c:934
void array_shuffle(int *array, int n)
Definition shared.c:2000
char * freeciv_storage_dir(void)
Definition shared.c:672
#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:82
@ 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_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:309
char * name
Definition city.h:310
struct tile * tile
Definition city.h:311
struct packet_game_info info
Definition game.h:89
struct civ_game::@30::@33 client
bool ruleset_ready
Definition game.h:116
struct government * government_during_revolution
Definition game.h:94
int xsize
Definition map_types.h:77
int ysize
Definition map_types.h:77
struct connection conn
Definition client_main.h:96
bool gui_qt_fullscreen
Definition options.h:386
bool draw_native
Definition options.h:207
bool draw_city_output
Definition options.h:186
bool draw_city_names
Definition options.h:188
bool draw_city_productions
Definition options.h:190
bool draw_borders
Definition options.h:206
bool draw_city_buycost
Definition options.h:191
bool draw_unit_stack_size
Definition options.h:210
bool draw_city_trade_routes
Definition options.h:192
bool unit_selection_clears_orders
Definition options.h:168
bool save_options_on_exit
Definition options.h:121
bool draw_map_grid
Definition options.h:187
bool draw_city_growth
Definition options.h:189
bool draw_city_outlines
Definition options.h:185
bool draw_full_citybar
Definition options.h:208
struct player * playing
Definition connection.h:156
Qt::MouseButton mouse
Definition shortcuts.h:107
Definition climisc.h:82
struct city_list * cities
Definition player.h:281
Definition menu.h:159
struct tile * t1
Definition menu.h:160
struct tile * t2
Definition menu.h:161
struct unit * autocaravan
Definition menu.h:162
QPixmap * pm
Definition sprite.h:25
struct terrain * cultivate_result
Definition terrain.h:203
struct terrain * plant_result
Definition terrain.h:206
struct terrain * transform_result
Definition terrain.h:217
Definition tile.h:49
struct unit_list * units
Definition tile.h:57
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:969
#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(_start, _p)
Definition tech.h:264
#define A_FIRST
Definition tech.h:44
#define advance_iterate_end
Definition tech.h:270
#define T_NONE
Definition terrain.h:56
void tile_virtual_destroy(struct tile *vtile)
Definition tile.c:1018
bool tile_apply_activity(struct tile *ptile, Activity_type_id act, struct extra_type *tgt)
Definition tile.c:658
struct tile * tile_virtual_new(const struct tile *ptile)
Definition tile.c:966
const char * tile_get_info_text(const struct tile *ptile, bool include_nuisances, int linebreaks)
Definition tile.c:756
struct city * tile_city(const struct tile *ptile)
Definition tile.c:83
#define tile_terrain(_tile)
Definition tile.h:109
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:6504
int tileset_hex_width(const struct tileset *t)
Definition tilespec.c:684
const struct strvec * get_tileset_list(const struct option *poption)
Definition tilespec.c:1047
bool tileset_is_isometric(const struct tileset *t)
Definition tilespec.c:675
const char * tileset_basename(const struct tileset *t)
Definition tilespec.c:667
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:728
int tileset_tile_width(const struct tileset *t)
Definition tilespec.c:716
bool tilespec_reread(const char *new_tileset_name, bool game_fully_initialized, float scale)
Definition tilespec.c:1299
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:286
bool unit_can_add_or_build_city(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:427
bool can_unit_change_homecity(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:460
bool unit_contained_in(const struct unit *pcargo, const struct unit *ptrans)
Definition unit.c:2504
bool can_unit_do_autosettlers(const struct unit *punit)
Definition unit.c:583
bool can_unit_paradrop(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:826
bool unit_can_help_build_wonder_here(const struct civ_map *nmap, const struct unit *punit)
Definition unit.c:260
#define unit_tile(_pu)
Definition unit.h:395
@ ORDER_LAST
Definition unit.h:49
@ ORDER_PERFORM_ACTION
Definition unit.h:47
#define unit_owner(_pu)
Definition unit.h:394
bool units_can_convert(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:353
bool units_are_occupied(const struct unit_list *punits)
Definition unitlist.c:277
bool units_can_do_action_with_result(const struct unit_list *punits, enum action_result result, bool can_do)
Definition unitlist.c:262
bool can_units_do_base_gui(const struct unit_list *punits, enum base_gui_type base_gui)
Definition unitlist.c:184
bool units_contain_cityfounder(const struct unit_list *punits)
Definition unitlist.c:221
bool can_units_do_any_road(const struct civ_map *nmap, const struct unit_list *punits)
Definition unitlist.c:165
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:338
bool units_can_unload(const struct unit_list *punits)
Definition unitlist.c:305
bool units_have_activity_on_tile(const struct unit_list *punits, enum unit_activity activity)
Definition unitlist.c:322
bool units_have_type_flag(const struct unit_list *punits, enum unit_type_flag_id flag, bool has_flag)
Definition unitlist.c:206
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:243
bool units_can_load(const struct unit_list *punits)
Definition unitlist.c:291
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:2131
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1612
bool utype_can_do_action(const struct unit_type *putype, const action_id act_id)
Definition unittype.c:443
#define unit_type_iterate(_p)
Definition unittype.h:841
#define unit_type_iterate_end
Definition unittype.h:848
#define enable(id)
Definition widget.h:223