Freeciv21
Develop your civilization from humble roots to a global empire
page_game.cpp
Go to the documentation of this file.
1 /****** , , **********************************************************
2  \\ \\ Copyright (c) 1996-2023 Freeciv21 and Freeciv
3  ) \\ \\ I-- contributors. This file is part of Freeciv21.
4  ) )) )) / * \ Freeciv21 is free software: you can redistribute
5  \ || || / /^=" in and/or modify it under the terms of the GNU
6  ,__ _\ \\ --/ / General Public License as published by the Free
7 < \\___/ ' Software Foundation, either version 3 of the License,
8  '===\ ___, ) or (at your option) any later version.
9  \ )___/\\ You should have received a copy of the
10  / / '" GNU General Public License along with Freeciv21.
11  \ \ If not, see https://www.gnu.org/licenses/.
12 ****** '" **********************************************************/
13 
14 #include "page_game.h"
15 
16 // Qt
17 #include <QGridLayout>
18 #include <QIcon>
19 #include <QResizeEvent>
20 #include <QScreen>
21 
22 // utility
23 #include "fcintl.h"
24 // common
25 #include "calendar.h"
26 #include "cityrep_g.h"
27 #include "government.h"
28 #include "repodlgs_g.h"
29 // client
30 #include "chatline.h"
31 #include "citydlg.h"
32 #include "client_main.h"
33 #include "fc_client.h"
34 #include "gotodlg.h"
35 #include "hudwidget.h"
36 #include "icons.h"
37 #include "mapctrl_common.h"
38 #include "messagewin.h"
39 #include "minimap.h"
40 #include "minimap_panel.h"
41 #include "ratesdlg.h"
42 #include "text.h"
43 #include "tileset/tilespec.h"
44 #include "top_bar.h"
45 #include "views/view_map.h"
46 #include "views/view_map_common.h"
47 #include "views/view_nations.h"
48 #include "views/view_units.h"
49 
50 #include "voteinfo_bar.h"
51 
56 
57 static void center_next_enemy_city();
58 static void center_next_player_city();
59 static void center_next_player_capital();
60 static void cycle_enemy_units();
61 
62 extern void toggle_units_report();
63 
64 pageGame::pageGame(QWidget *parent)
65  : QWidget(parent), unit_selector(nullptr), update_info_timer(nullptr)
66 {
67  QGridLayout *game_layout;
68 
69  game_main_widget = new QWidget;
70  game_layout = new QGridLayout;
71  game_layout->setContentsMargins(0, 0, 0, 0);
72  game_layout->setSpacing(0);
73  mapview_wdg = new map_view();
74  mapview_wdg->setFocusPolicy(Qt::WheelFocus);
75  top_bar_wdg = new top_bar();
76  sw_map = new top_bar_widget(Q_("?noun:View"), QStringLiteral("MAP"),
78 
79  // Show the national flag, unless global observing
80  if (client.conn.playing != nullptr) {
81  auto sprite = *get_nation_flag_sprite(
83  sw_map->setIcon(QIcon(sprite));
84  sw_map->setIconSize(sprite.size());
85  } else {
86  sw_map->setIcon(fcIcons::instance()->getIcon(QStringLiteral("globe")));
87  sw_map->setIconSize(QSize(24, 24));
88  }
89 
90  // Units view (F2)
91  sw_cunit = new top_bar_widget(_("Units"), QStringLiteral("UNI"),
93  sw_cunit->setIcon(fcIcons::instance()->getIcon(QStringLiteral("units")));
96  sw_cunit->setCheckable(true);
97 
98  // Nations view (F3)
99  sw_diplo = new top_bar_widget(_("Nations"), QStringLiteral("PLR"),
101  sw_diplo->setIcon(fcIcons::instance()->getIcon(QStringLiteral("flag")));
104  sw_diplo->setCheckable(true);
106 
107  // Cities view (F4)
108  sw_cities = new top_bar_widget(_("Cities"), QStringLiteral("CTS"),
110  sw_cities->setIcon(fcIcons::instance()->getIcon(QStringLiteral("cities")));
113  sw_cities->setCheckable(true);
114 
115  // Economics view (F5)
116  sw_economy = new gold_widget;
117  sw_economy->setIcon(
118  fcIcons::instance()->getIcon(QStringLiteral("economy")));
119  sw_economy->setCheckable(true);
120 
121  // Research view (F6)
122  sw_science = new top_bar_widget(_("Research"), QStringLiteral("SCI"),
124  sw_science->setIcon(
125  fcIcons::instance()->getIcon(QStringLiteral("research")));
126  sw_science->setCheckable(true);
128 
129  // National budget widget
131  connect(sw_tax, &QAbstractButton::clicked, this,
133 
134  // National status
136  connect(sw_indicators, &QAbstractButton::clicked, top_bar_indicators_menu);
137 
138  // Messages widget
140  message->setAttribute(Qt::WA_NoMousePropagation);
141  message->hide();
142  sw_message = new top_bar_widget(_("Messages"), QLatin1String(""), nullptr);
143  sw_message->setCheckable(true);
144  connect(
145  sw_message, &QToolButton::toggled, +[](bool checked) {
146  if (const auto message = queen()->message; message) {
147  message->setVisible(checked);
148 
149  // change icon to default if icon is notify
150  const auto sw_message = queen()->sw_message;
151  if (sw_message) {
152  queen()->sw_message->setIcon(
153  fcIcons::instance()->getIcon(QStringLiteral("messages")));
154  }
155  }
156  });
157  sw_message->setIcon(
158  fcIcons::instance()->getIcon(QStringLiteral("messages")));
159  connect(
161  const auto message = queen()->message;
162  if (message && !message->isVisible()) {
163  queen()->sw_message->setIcon(
164  fcIcons::instance()->getIcon(QStringLiteral("notify")));
165  }
166  });
167 
168  // The mini-map widget
169  minimap_panel = new ::minimap_panel(mapview_wdg, mapview_wdg);
173  city_overlay->hide();
174 
175  // Battle log widget
177  unitinfo_wdg->setAttribute(Qt::WA_NoMousePropagation);
179  battlelog_wdg->setAttribute(Qt::WA_NoMousePropagation);
180  battlelog_wdg->hide();
181 
182  // Chatline widget
184  chat->setAttribute(Qt::WA_NoMousePropagation);
185  chat->show();
186 
187  // Voting bar widget
188  x_vote = new xvote(mapview_wdg);
189  x_vote->setAttribute(Qt::WA_NoMousePropagation);
190  x_vote->hide();
191 
192  // Goto visuals
193  gtd = new goto_dialog(mapview_wdg);
194  gtd->setAttribute(Qt::WA_NoMousePropagation);
195  gtd->hide();
196 
197  top_bar_wdg->addWidget(sw_map); // F1
206 
207  game_layout->addWidget(mapview_wdg, 1, 0);
208  game_main_widget->setLayout(game_layout);
210  game_tab_widget->setMinimumSize(600, 400);
211  game_tab_widget->setContentsMargins(0, 0, 0, 0);
212 
213  game_tab_widget->addWidget(game_main_widget);
214 
215  auto page_game_layout = new QVBoxLayout;
216  page_game_layout->addWidget(top_bar_wdg);
217  page_game_layout->setStretchFactor(top_bar_wdg, 0);
218  page_game_layout->addWidget(game_tab_widget);
219  page_game_layout->setStretchFactor(game_tab_widget, 1);
220  page_game_layout->setContentsMargins(0, 0, 0, 0);
221  page_game_layout->setSpacing(0);
222  setLayout(page_game_layout);
223 
225 
227 }
228 
229 pageGame::~pageGame() = default;
230 
235 {
236  if (client.conn.playing != nullptr) {
237  auto sprite = *get_nation_flag_sprite(
239  sw_map->setIcon(QIcon(sprite));
240  sw_map->setIconSize(sprite.size());
241  } else {
242  sw_map->setIcon(fcIcons::instance()->getIcon(QStringLiteral("globe")));
243  sw_map->setIconSize(QSize(24, 24));
244  }
245 
246  sw_cunit->setIcon(fcIcons::instance()->getIcon(QStringLiteral("units")));
247  sw_cities->setIcon(fcIcons::instance()->getIcon(QStringLiteral("cities")));
248  sw_diplo->setIcon(fcIcons::instance()->getIcon(
249  diplomacy_notify ? QStringLiteral("flag-active")
250  : QStringLiteral("flag")));
251  sw_science->setIcon(
252  fcIcons::instance()->getIcon(QStringLiteral("research")));
253  sw_economy->setIcon(
254  fcIcons::instance()->getIcon(QStringLiteral("economy")));
255  sw_message->setIcon(
256  fcIcons::instance()->getIcon(QStringLiteral("messages")));
257 }
258 
263 {
264  if (king()->current_page() != PAGE_GAME) {
265  return;
266  }
267  if (update_info_timer == nullptr) {
268  update_info_timer = new QTimer();
269  update_info_timer->setSingleShot(true);
270  connect(update_info_timer, &QTimer::timeout, this,
272  update_info_timer->start(300);
274  return;
275  }
276 }
277 
282 {
283  if (client_is_observer()) {
284  // Can't change tax rates
285  return;
286  }
287 
289 
290  const auto rect = screen()->geometry();
291  auto p = sw_tax->mapToGlobal(QPoint(0, sw_tax->height()));
292  if (p.y() + budget_dialog->height() > rect.bottom()) {
293  p.setY(rect.bottom() - budget_dialog->height());
294  }
295  if (p.x() + budget_dialog->width() > rect.right()) {
296  p.setX(rect.right() - budget_dialog->width());
297  }
298 
299  budget_dialog->move(p);
300  budget_dialog->show();
301 }
302 
304 {
305  QString s, eco_info;
306  if (update_info_timer->remainingTime() != -1) {
307  return;
308  }
310  if (head_of_units_in_focus() != nullptr) {
312  }
313  // TRANS: T is shortcut from Turn
314  s = QString(_("%1 \nT:%2"))
315  .arg(calendar_text(), QString::number(game.info.turn));
316 
319 
320  if (client.conn.playing != nullptr) {
323  sw_economy->setEnabled(true);
324  } else {
325  sw_economy->set_gold(0);
327  sw_economy->setEnabled(false);
328  }
329 
330  sw_indicators->update();
331  sw_tax->update();
332  sw_economy->update();
333  delete update_info_timer;
334  update_info_timer = nullptr;
335 }
336 
341 {
342  QString str;
343  int max;
344  int entries_used, building_total, unit_total, tax;
345  char buf[256];
346 
347  struct improvement_entry building_entries[B_LAST];
348  struct unit_entry unit_entries[U_LAST];
349 
350  if (king()->current_page() != PAGE_GAME) {
351  return;
352  }
353 
354  if (nullptr != client.conn.playing) {
355  max = get_player_bonus(client.conn.playing, EFT_MAX_RATES);
356  } else {
357  max = 100;
358  }
359 
361  && C_S_RUNNING == client_state()) {
362  sw_science->setToolTip(science_dialog_text());
363  str = QString(nation_plural_for_player(client_player()));
364  str = str + '\n' + get_info_label_text(false);
365  sw_map->setToolTip(str);
367  str = QString(_("Tax: %1% Science: %2% Luxury: %3%\n"))
371 
372  str += QString(_("%1 - max rate: %2%"))
374  QString::number(max));
375 
376  get_economy_report_units_data(unit_entries, &entries_used, &unit_total);
377  get_economy_report_data(building_entries, &entries_used, &building_total,
378  &tax);
379  fc_snprintf(buf, sizeof(buf), _("Income: %d Total Costs: %d"), tax,
380  building_total + unit_total);
381  sw_economy->setToolTip(buf);
382  sw_cities->setToolTip(QString(_("Cities: %1 total"))
383  .arg(city_list_size(client_player()->cities)));
384  sw_science->show();
385  sw_economy->show();
386  } else {
387  sw_science->hide();
388  sw_map->setToolTip(QLatin1String(""));
389  sw_economy->hide();
390  }
392 }
393 
398 {
399  bool center_next = false;
400  bool first_tile = false;
401  int first_id;
402  struct tile *ptile = nullptr;
403 
404  players_iterate(pplayer)
405  {
406  if (pplayer != client_player()) {
407  city_list_iterate(pplayer->cities, pcity)
408  {
409  if (!first_tile) {
410  first_tile = true;
411  ptile = pcity->tile;
412  first_id = pcity->id;
413  }
414  if ((last_center_enemy_city == 0) || center_next) {
415  last_center_enemy_city = pcity->id;
416  queen()->mapview_wdg->center_on_tile(pcity->tile);
417  return;
418  }
419  if (pcity->id == last_center_enemy_city) {
420  center_next = true;
421  }
422  }
424  }
425  }
427 
428  if (ptile != nullptr) {
429  queen()->mapview_wdg->center_on_tile(ptile);
430  last_center_enemy_city = first_id;
431  }
432 }
433 
438 {
439  bool center_next = false;
440  bool first_tile = false;
441  int first_id;
442  struct tile *ptile = nullptr;
443 
444  players_iterate(pplayer)
445  {
446  if (pplayer == client_player()) {
447  city_list_iterate(pplayer->cities, pcity)
448  {
449  if (!first_tile) {
450  first_tile = true;
451  ptile = pcity->tile;
452  first_id = pcity->id;
453  }
454  if ((last_center_player_city == 0) || center_next) {
455  last_center_player_city = pcity->id;
456  queen()->mapview_wdg->center_on_tile(pcity->tile);
457  return;
458  }
459  if (pcity->id == last_center_player_city) {
460  center_next = true;
461  }
462  }
464  }
465  }
467 
468  if (ptile != nullptr) {
469  queen()->mapview_wdg->center_on_tile(ptile);
470  last_center_player_city = first_id;
471  }
472 }
473 
478 {
479  struct city *capital;
480  bool center_next = false;
481  bool first_tile = false;
482  int first_id;
483  struct tile *ptile = nullptr;
484 
485  players_iterate(pplayer)
486  {
487  if (pplayer != client_player()) {
488  capital = player_primary_capital(pplayer);
489  if (capital == nullptr) {
490  continue;
491  }
492  if (!first_tile) {
493  first_tile = true;
494  ptile = capital->tile;
495  first_id = capital->id;
496  }
497  if ((last_center_player_city == 0) || center_next) {
498  last_center_player_city = capital->id;
499  queen()->mapview_wdg->center_on_tile(capital->tile);
500  put_cross_overlay_tile(capital->tile);
501  return;
502  }
503  if (capital->id == last_center_player_city) {
504  center_next = true;
505  }
506  }
507  }
509 
510  if (ptile != nullptr) {
511  queen()->mapview_wdg->center_on_tile(ptile);
512  put_cross_overlay_tile(ptile);
513  last_center_player_city = first_id;
514  }
515 }
516 
521 {
522  bool center_next = false;
523  bool first_tile = false;
524  int first_id;
525  struct tile *ptile = nullptr;
526 
527  players_iterate(pplayer)
528  {
529  if (pplayer != client_player()) {
530  unit_list_iterate(pplayer->units, punit)
531  {
532  if (!first_tile) {
533  first_tile = true;
534  ptile = punit->tile;
535  first_id = punit->id;
536  }
537  if ((last_center_enemy == 0) || center_next) {
538  last_center_enemy = punit->id;
539  queen()->mapview_wdg->center_on_tile(punit->tile);
540  return;
541  }
542  if (punit->id == last_center_enemy) {
543  center_next = true;
544  }
545  }
547  }
548  }
550 
551  if (ptile != nullptr) {
552  queen()->mapview_wdg->center_on_tile(ptile);
553  last_center_enemy = first_id;
554  }
555 }
556 
558 {
559  return qobject_cast<pageGame *>(king()->pages[PAGE_GAME]);
560 }
561 
566 
571 {
572  connect(this, &QStackedWidget::currentChanged, this,
574 }
575 
580 {
581  if (C_S_RUNNING <= client_state()
582  && (event->type() == QEvent::Resize
583  || event->type() == QEvent::LayoutRequest)) {
584  const auto size = event->type() == QEvent::Resize
585  ? static_cast<QResizeEvent *>(event)->size()
586  : this->size();
587  if (event->type() == QEvent::Resize) {
588  queen()->message->resize(
589  qRound(size.width() * king()->qt_settings.chat_fwidth),
590  qRound(size.height() * king()->qt_settings.chat_fheight));
591  queen()->message->move(size.width() - queen()->message->width(), 0);
592 
593  auto chat = queen()->chat;
594  const bool visible = chat->is_chat_visible(); // Save old state
595  chat->set_chat_visible(true);
596  chat->resize(qRound(size.width() * king()->qt_settings.chat_fwidth),
597  qRound(size.height() * king()->qt_settings.chat_fheight));
598  chat->move(qRound(size.width() * king()->qt_settings.chat_fx_pos),
599  qRound(size.height() * king()->qt_settings.chat_fy_pos));
600  chat->set_chat_visible(visible); // Restore state
601 
602  queen()->battlelog_wdg->set_scale(king()->qt_settings.battlelog_scale);
603  queen()->battlelog_wdg->move(
604  qRound(king()->qt_settings.battlelog_x * mapview.width),
605  qRound(king()->qt_settings.battlelog_y * mapview.height));
606  queen()->x_vote->move(width() / 2 - queen()->x_vote->width() / 2, 0);
607 
609  queen()->minimap_panel->turn_done()->setEnabled(
611  queen()->mapview_wdg->resize(size.width(), size.height());
612  queen()->city_overlay->resize(queen()->mapview_wdg->size());
614  }
615 
616  /*
617  * Resize the panel at the bottom right.
618  * Keep current size if the widget has been resized.
619  */
620  const auto max_size = QSize(std::max(300, size.width() / 4),
621  std::max(200, size.height() / 3));
622  const auto curr_size = QSize(queen()->minimap_panel->width(),
623  queen()->minimap_panel->height());
624  if (curr_size.width() != max_size.width()
625  || curr_size.height() != max_size.height()) {
626  const auto panel_size =
627  QLayout::closestAcceptableSize(queen()->minimap_panel, curr_size);
628  const auto location = size - panel_size;
629  queen()->minimap_panel->move(location.width(), location.height());
630  queen()->minimap_panel->resize(panel_size);
631  } else {
632  const auto panel_size =
633  QLayout::closestAcceptableSize(queen()->minimap_panel, max_size);
634  const auto location = size - panel_size;
635  queen()->minimap_panel->move(location.width(), location.height());
636  queen()->minimap_panel->resize(panel_size);
637  }
638 
639  return true;
640  }
641 
642  return QWidget::event(event);
643 }
644 
649 {
650  if (king()->is_closing()) {
651  return;
652  }
653 
654  for (auto *sw : qAsConst(queen()->top_bar_wdg->objects)) {
655  sw->update();
656  }
657  currentWidget()->hide();
658  widget(index)->show();
659 
660  // Set focus to map instead sidebar
661  if (queen()->mapview_wdg && king()->current_page() == PAGE_GAME
662  && index == 0) {
663  queen()->mapview_wdg->setFocus();
664  }
665 }
666 
670 int pageGame::addGameTab(QWidget *widget)
671 {
672  int i;
673 
674  i = game_tab_widget->addWidget(widget);
675  game_tab_widget->setCurrentWidget(widget);
676  return i;
677 }
678 
683 {
684  game_tab_widget->removeWidget(queen()->game_tab_widget->widget(index));
685 }
686 
690 void pageGame::gimmePlace(QWidget *widget, const QString &str)
691 {
692  QString x;
693 
694  x = opened_repo_dlgs.key(widget);
695 
696  if (x.isEmpty()) {
697  opened_repo_dlgs.insert(str, widget);
698  return;
699  }
700  qCritical("Failed to find place for new tab widget");
701 }
702 
706 int pageGame::gimmeIndexOf(const QString &str)
707 {
708  int i;
709  QWidget *w;
710 
711  if (str == QLatin1String("MAP")) {
712  return 0;
713  }
714 
715  w = opened_repo_dlgs.value(str);
716  i = queen()->game_tab_widget->indexOf(w);
717  return i;
718 }
719 
723 void pageGame::removeRepoDlg(const QString &str)
724 {
725  // if app is closing opened_repo_dlg is already deleted
726  if (!king()->is_closing()) {
727  opened_repo_dlgs.remove(str);
728  }
729 }
730 
736 bool pageGame::isRepoDlgOpen(const QString &str)
737 {
738  QWidget *w;
739 
740  w = opened_repo_dlgs.value(str);
741 
742  return w != nullptr;
743 }
744 
const char * calendar_text()
Produce a statically allocated textual representation of the current calendar time.
Definition: calendar.cpp:137
#define city_list_iterate(citylist, pcity)
Definition: city.h:482
#define city_list_iterate_end
Definition: city.h:484
void city_report_dialog_popup()
Display the city report dialog.
bool is_chat_visible() const
Returns whether the chat widget is currently visible.
Definition: chatline.h:116
void refresh()
Various refresh after getting new info/reply from server.
Definition: citydlg.cpp:1597
QIcon getIcon(const QString &id)
Returns icon by given name.
Definition: icons.cpp:125
static fcIcons * instance()
Returns instance of fc_icons.
Definition: icons.cpp:36
fc_game_tab_widget()
Game tab widget constructor.
Definition: page_game.cpp:565
void init()
Init default settings for game_tab_widget.
Definition: page_game.cpp:570
bool event(QEvent *event) override
Resize event for all game tab widgets.
Definition: page_game.cpp:579
void current_changed(int index)
Tab has been changed.
Definition: page_game.cpp:648
Top bar widget that shows the amount of gold owned by the current player, and their income.
Definition: top_bar.h:109
void set_income(int income)
Changes the gold amount shown by the widget.
Definition: top_bar.h:129
void set_gold(int gold)
Changes the gold amount shown by the widget.
Definition: top_bar.h:139
void set_scale(float s)
Set scale.
Definition: hudwidget.cpp:1637
void update_actions()
Update possible action for given units.
Definition: hudwidget.cpp:552
Top bar widget for indicators (global warming/nuclear winter/science/ government).
Definition: top_bar.h:50
void scale_changed(double scale) const
void center_on_tile(tile *tile, bool animate=true)
Centers the view on a tile.
Definition: view_map.cpp:197
The panel at the bottom right of the game screen, holding the minimap and the Turn Done button.
Definition: minimap_panel.h:23
auto turn_done()
Retrieves the Turn Done button.
Definition: minimap_panel.h:39
void refresh()
Refreshes tax rate data.
Definition: ratesdlg.cpp:87
Top bar widget for national budget.
Definition: top_bar.h:33
city_dialog * city_overlay
Definition: page_game.h:83
::minimap_panel * minimap_panel
Definition: page_game.h:82
top_bar_widget * sw_map
Definition: page_game.h:99
void rmGameTab(int index)
Removes given tab widget from game page.
Definition: page_game.cpp:682
int gimmeIndexOf(const QString &str)
Returns index on game tab page of given report dialog.
Definition: page_game.cpp:706
int addGameTab(QWidget *widget)
Inserts tab widget to game view page.
Definition: page_game.cpp:670
bool isRepoDlgOpen(const QString &str)
Checks if given report is opened, if you create new report as tab on game page, figure out some origi...
Definition: page_game.cpp:736
indicators_widget * sw_indicators
Definition: page_game.h:87
map_view * mapview_wdg
Definition: page_game.h:81
top_bar_widget * sw_cities
Definition: page_game.h:97
void removeRepoDlg(const QString &str)
Removes report dialog string from the list marking it as closed.
Definition: page_game.cpp:723
top_bar * top_bar_wdg
Definition: page_game.h:73
pageGame(QWidget *)
Definition: page_game.cpp:64
top_bar_widget * sw_science
Definition: page_game.h:88
chat_widget * chat
Definition: page_game.h:80
void updateInfoLabelTimeout()
Definition: page_game.cpp:303
national_budget_widget * sw_tax
Definition: page_game.h:101
void updateSidebarTooltips()
Updates top bar tooltips.
Definition: page_game.cpp:340
bool diplomacy_notify
Definition: page_game.h:89
~pageGame() override
hud_units * unitinfo_wdg
Definition: page_game.h:77
QWidget * game_main_widget
Definition: page_game.h:71
top_bar_widget * sw_cunit
Definition: page_game.h:84
QTimer * update_info_timer
Definition: page_game.h:96
message_widget * message
Definition: page_game.h:78
void gimmePlace(QWidget *widget, const QString &str)
Finds not used index on game_view_tab and returns it.
Definition: page_game.cpp:690
hud_battle_log * battlelog_wdg
Definition: page_game.h:76
fc_game_tab_widget * game_tab_widget
Definition: page_game.h:72
xvote * x_vote
Definition: page_game.h:85
void reloadSidebarIcons()
Reloads top bar icons (useful on theme change)
Definition: page_game.cpp:234
QMap< QString, QWidget * > opened_repo_dlgs
Definition: page_game.h:95
gold_widget * sw_economy
Definition: page_game.h:98
void updateInfoLabel()
Real update, updates only once per 300 ms.
Definition: page_game.cpp:262
national_budget_dialog * budget_dialog
Definition: page_game.h:100
goto_dialog * gtd
Definition: page_game.h:74
top_bar_widget * sw_message
Definition: page_game.h:79
top_bar_widget * sw_diplo
Definition: page_game.h:86
void popup_budget_dialog()
Popup (or raise) the (tax/science/luxury) rates selection dialog.
Definition: page_game.cpp:281
void setWheelUp(pfcn func)
Sets callback for mouse wheel up.
Definition: top_bar.cpp:267
void setRightClick(pfcn func)
Sets callback for mouse right click.
Definition: top_bar.cpp:257
void setWheelDown(pfcn func)
Sets callback for mouse wheel down.
Definition: top_bar.cpp:262
void setCustomLabels(const QString &)
Sets custom text visible on top of sidewidget.
Definition: top_bar.cpp:223
void addWidget(QWidget *fsw)
Adds new top_bar widget.
Definition: top_bar.cpp:439
enum client_states client_state()
Return current client state.
bool client_is_global_observer()
Returns whether client is global observer.
struct player * client_player()
Either controlling or observing.
struct civclient client
bool client_is_observer()
Returns whether client is observer.
@ C_S_RUNNING
Definition: client_main.h:43
void key_unit_wait()
Handle user 'wait' input.
Definition: control.cpp:2937
void key_center_capital()
Center the mapview on the player's named capital, or print a failure message.
Definition: control.cpp:2745
struct unit * head_of_units_in_focus()
Return head of focus units list.
Definition: control.cpp:387
int get_player_bonus(const struct player *pplayer, enum effect_type effect_type)
Returns the effect bonus for a player.
Definition: effects.cpp:673
enum event_type event
Definition: events.cpp:68
class fc_client * king()
Return fc_client instance.
Definition: gui_main.cpp:58
#define Q_(String)
Definition: fcintl.h:53
#define _(String)
Definition: fcintl.h:50
struct civ_game game
Definition: game.cpp:47
const char * government_name_for_player(const struct player *pplayer)
Return the (translated) name of the given government of a player.
Definition: government.cpp:147
#define B_LAST
Definition: improvement.h:33
bool get_turn_done_button_state()
Return TRUE iff the turn done button should be enabled.
void put_cross_overlay_tile(struct tile *ptile)
Draw a cross-hair overlay on a tile.
Definition: view_map.cpp:533
void real_menus_update(void)
Update all of the menus (sensitivity, name, etc.) based on the current state.
Definition: menu.cpp:101
const char * nation_plural_for_player(const struct player *pplayer)
Return the (translated) plural noun of the given nation of a player.
Definition: nation.cpp:155
struct nation_type * nation_of_player(const struct player *pplayer)
Return the nation of a player.
Definition: nation.cpp:419
struct city_list * cities
Definition: packhand.cpp:122
void update_info_label(void)
Typically an info box is provided to tell the player about the state of their civilization.
Definition: page_game.cpp:750
int last_center_capital
Definition: page_game.cpp:52
int last_center_enemy
Definition: page_game.cpp:55
static void center_next_enemy_city()
Centers next enemy city on view.
Definition: page_game.cpp:397
static void center_next_player_city()
Centers next player city on view.
Definition: page_game.cpp:437
int last_center_player_city
Definition: page_game.cpp:53
pageGame * queen()
Return game instandce.
Definition: page_game.cpp:557
static void cycle_enemy_units()
Center on next enemy unit.
Definition: page_game.cpp:520
int last_center_enemy_city
Definition: page_game.cpp:54
void toggle_units_report()
static void center_next_player_capital()
Centers next enemy capital.
Definition: page_game.cpp:477
int player_get_expected_income(const struct player *pplayer)
Return the expected net income of the player this turn.
Definition: player.cpp:1194
struct city * player_primary_capital(const struct player *pplayer)
Locate the player's primary capital city, (nullptr Otherwise)
Definition: player.cpp:1247
#define players_iterate_end
Definition: player.h:520
#define players_iterate(_pplayer)
Definition: player.h:514
void get_economy_report_units_data(struct unit_entry *entries, int *num_entries_used, int *total_cost)
Returns an array of units with gold_upkeep.
void get_economy_report_data(struct improvement_entry *entries, int *num_entries_used, int *total_cost, int *total_income)
Fills out the array of struct improvement_entry given by entries.
size_t size
Definition: specvec.h:64
Definition: city.h:291
int id
Definition: city.h:296
enum capital_type capital
Definition: city.h:298
struct tile * tile
Definition: city.h:293
struct packet_game_info info
Definition: game.h:80
struct connection conn
Definition: client_main.h:89
struct player * playing
Definition: connection.h:142
struct player_economic economic
Definition: player.h:266
Definition: tile.h:42
int index
Definition: tile.h:43
int height
int width
int fc_snprintf(char *str, size_t n, const char *format,...)
See also fc_utf8_snprintf_trunc(), fc_utf8_snprintf_rep().
Definition: support.cpp:537
const QString science_dialog_text()
Returns the text to display in the science dialog.
Definition: text.cpp:812
const QString get_info_label_text_popup()
Return the text for the popup label on the info panel.
Definition: text.cpp:1036
const QString get_info_label_text(bool moreinfo)
Return the text for the label on the info panel.
Definition: text.cpp:981
const QPixmap * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
Return the sprite for the nation.
Definition: tilespec.cpp:3367
void top_bar_right_click_diplomacy()
Right click for diplomacy Opens diplomacy meeting for player For observer popups menu.
Definition: top_bar.cpp:485
void top_bar_right_click_science()
Right click for science, allowing to choose current tech.
Definition: top_bar.cpp:525
void top_bar_units_view()
Click for units view, allowing to close/open.
Definition: top_bar.cpp:602
void top_bar_indicators_menu()
Popups menu on indicators widget.
Definition: top_bar.cpp:471
void top_bar_left_click_science()
Left click for science, allowing to close/open.
Definition: top_bar.cpp:575
void top_bar_show_map()
Callback to show map.
Definition: top_bar.cpp:448
#define unit_list_iterate(unitlist, punit)
Definition: unitlist.h:25
#define unit_list_iterate_end
Definition: unitlist.h:27
#define U_LAST
Definition: unittype.h:31
struct view mapview
void popup_players_dialog()
Display the player list dialog.