13 #include <QApplication>
16 #include <QHeaderView>
19 #include <QRadioButton>
20 #include <QRandomGenerator>
21 #include <QVBoxLayout>
60 #define BUTTON_MOVE ACTION_COUNT
61 #define BUTTON_WAIT BUTTON_MOVE + 1
62 #define BUTTON_CANCEL BUTTON_MOVE + 2
63 #define BUTTON_COUNT BUTTON_MOVE + 3
78 static void spy_sabotage(QVariant data1, QVariant data2);
79 static void spy_steal(QVariant data1, QVariant data2);
84 static void spy_poison(QVariant data1, QVariant data2);
92 static void nuke_city(QVariant data1, QVariant data2);
93 static void destroy_city(QVariant data1, QVariant data2);
95 static void spy_embassy(QVariant data1, QVariant data2);
106 static void unit_recycle(QVariant data1, QVariant data2);
108 static void nuke_units(QVariant data1, QVariant data2);
109 static void expel_unit(QVariant data1, QVariant data2);
110 static void bombard(QVariant data1, QVariant data2);
111 static void bombard2(QVariant data1, QVariant data2);
112 static void bombard3(QVariant data1, QVariant data2);
113 static void found_city(QVariant data1, QVariant data2);
115 static void cultivate(QVariant data1, QVariant data2);
116 static void plant(QVariant data1, QVariant data2);
117 static void pillage(QVariant data1, QVariant data2);
120 static void road(QVariant data1, QVariant data2);
121 static void base(QVariant data1, QVariant data2);
122 static void mine(QVariant data1, QVariant data2);
123 static void irrigate(QVariant data1, QVariant data2);
124 static void nuke(QVariant data1, QVariant data2);
125 static void attack(QVariant data1, QVariant data2);
127 static void paradrop(QVariant data1, QVariant data2);
128 static void disembark1(QVariant data1, QVariant data2);
129 static void disembark2(QVariant data1, QVariant data2);
130 static void convert_unit(QVariant data1, QVariant data2);
131 static void fortify(QVariant data1, QVariant data2);
132 static void disband_unit(QVariant data1, QVariant data2);
133 static void join_city(QVariant data1, QVariant data2);
135 static void unit_upgrade(QVariant data1, QVariant data2);
136 static void airlift(QVariant data1, QVariant data2);
137 static void conquer_city(QVariant data1, QVariant data2);
139 static void heal_unit(QVariant data1, QVariant data2);
144 static void keep_moving(QVariant data1, QVariant data2);
151 const QString custom, QVariant data1,
176 QHash<action_id, pfcn_void> action_function;
179 action_function[ACTION_ESTABLISH_EMBASSY] =
spy_embassy;
183 action_function[ACTION_SPY_POISON] =
spy_poison;
189 action_function[ACTION_SPY_TARGETED_SABOTAGE_CITY] =
191 action_function[ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC] =
195 action_function[ACTION_SPY_TARGETED_STEAL_TECH] =
spy_steal;
196 action_function[ACTION_SPY_TARGETED_STEAL_TECH_ESC] =
spy_steal_esc;
202 action_function[ACTION_JOIN_CITY] =
join_city;
211 action_function[ACTION_AIRLIFT] =
airlift;
215 action_function[ACTION_NUKE_CITY] =
nuke_city;
221 action_function[ACTION_EXPEL_UNIT] =
expel_unit;
222 action_function[ACTION_HEAL_UNIT] =
heal_unit;
230 action_function[ACTION_BOMBARD] =
bombard;
231 action_function[ACTION_BOMBARD2] =
bombard2;
232 action_function[ACTION_BOMBARD3] =
bombard3;
233 action_function[ACTION_NUKE_UNITS] =
nuke_units;
236 action_function[ACTION_FOUND_CITY] =
found_city;
237 action_function[ACTION_NUKE] =
nuke;
238 action_function[ACTION_PARADROP] =
paradrop;
239 action_function[ACTION_ATTACK] =
attack;
242 action_function[ACTION_CULTIVATE] =
cultivate;
243 action_function[ACTION_PLANT] =
plant;
244 action_function[ACTION_PILLAGE] =
pillage;
247 action_function[ACTION_ROAD] =
road;
248 action_function[ACTION_BASE] =
base;
249 action_function[ACTION_MINE] =
mine;
250 action_function[ACTION_IRRIGATE] =
irrigate;
251 action_function[ACTION_TRANSPORT_DISEMBARK1] =
disembark1;
252 action_function[ACTION_TRANSPORT_DISEMBARK2] =
disembark2;
256 action_function[ACTION_FORTIFY] =
fortify;
264 return action_function;
275 : QDialog(parent, Qt::FramelessWindowHint)
279 setSizeGripEnabled(
true);
293 QStyleOptionTitleBar tbar_opt;
294 QStyleOption win_opt;
295 QStyle *style = this->style();
296 QRect active_area = this->rect();
298 QRect close_rect, text_rect;
300 qpal.setColor(QPalette::Active, QPalette::ToolTipText, Qt::white);
301 tbar_opt.initFrom(
this);
303 style->pixelMetric(QStyle::PM_TitleBarHeight, &tbar_opt,
this) + 2;
310 close_rect = QRect(this->width() -
close_pix->width(), 0, this->width(),
312 tbar_opt.titleBarState = this->windowState();
313 tbar_opt.text = tbar_opt.fontMetrics.elidedText(
314 this->windowTitle(), Qt::ElideRight, text_rect.width());
315 style->drawComplexControl(QStyle::CC_TitleBar, &tbar_opt, &p,
this);
316 style->drawItemText(&p, text_rect, Qt::AlignCenter, qpal,
true,
317 tbar_opt.text, QPalette::ToolTipText);
318 style->drawItemPixmap(&p, close_rect, Qt::AlignLeft,
323 win_opt.initFrom(
this);
324 win_opt.rect = active_area;
325 style->drawPrimitive(QStyle::PE_Widget, &win_opt, &p,
this);
345 point =
event->globalPos() - geometry().topLeft();
347 setCursor(Qt::SizeAllCursor);
361 setCursor(Qt::ArrowCursor);
368 :
qfc_dialog(parent), nations_tabs_list(nullptr)
371 QGridLayout *qgroupbox_layout;
373 QTableWidgetItem *
item;
378 setAttribute(Qt::WA_DeleteOnClose);
383 styles =
new QTableWidget;
386 ns_label =
new QLabel;
391 setWindowTitle(
_(
"Select Nation"));
404 nation_tabs->setSelectionMode(QAbstractItemView::SingleSelection);
406 nation_tabs->horizontalHeader()->setVisible(
false);
408 nation_tabs->setEditTriggers(QAbstractItemView::NoEditTriggers);
410 ns_label->setText(
_(
"Nation Set:"));
412 styles->setColumnCount(2);
413 styles->setSelectionMode(QAbstractItemView::SingleSelection);
414 styles->verticalHeader()->setVisible(
false);
415 styles->horizontalHeader()->setVisible(
false);
416 styles->setProperty(
"showGrid",
"false");
417 styles->setProperty(
"selectionBehavior",
"SelectRows");
418 styles->setEditTriggers(QAbstractItemView::NoEditTriggers);
419 styles->setShowGrid(
false);
421 qgroupbox_layout =
new QGridLayout;
422 no_name =
new QGroupBox(parent);
424 is_male =
new QRadioButton(no_name);
428 qgroupbox_layout->addWidget(
leader_name, 1, 0, 1, 2);
429 qgroupbox_layout->addWidget(
is_male, 2, 1);
430 qgroupbox_layout->addWidget(
is_female, 2, 0);
434 is_male->setChecked(QRandomGenerator::global()->generate() % 2 == 0);
436 no_name->setLayout(qgroupbox_layout);
441 no_name->setTitle(
_(
"Your leader name"));
452 item =
new QTableWidgetItem;
455 item->setData(Qt::DecorationRole, pix);
457 item->setSizeHint(pix.size());
459 item =
new QTableWidgetItem;
466 header =
styles->horizontalHeader();
467 header->setSectionResizeMode(QHeaderView::Stretch);
468 header->resizeSections(QHeaderView::ResizeToContents);
469 header =
styles->verticalHeader();
470 header->resizeSections(QHeaderView::ResizeToContents);
480 connect(
styles->selectionModel(), &QItemSelectionModel::selectionChanged,
483 &QItemSelectionModel::selectionChanged,
this,
485 connect(
leader_name, QOverload<int>::of(&QComboBox::currentIndexChanged),
487 connect(
leader_name->lineEdit(), &QLineEdit::returnPressed,
this,
489 connect(
qnation_set, QOverload<int>::of(&QComboBox::currentIndexChanged),
492 &QItemSelectionModel::selectionChanged,
this,
497 connect(
ok_button, &QAbstractButton::pressed,
this,
507 connect(
ok_button, &QAbstractButton::pressed,
this,
526 title =
_(
"Edit Nation");
528 title =
_(
"What Nation Will You Be?");
530 title =
_(
"Pick Nation");
534 setWindowTitle(title);
548 QTableWidgetItem *
item;
555 item =
new QTableWidgetItem;
556 item->setText(
_(
"All nations"));
557 item->setData(Qt::UserRole, -99);
565 auto count = std::count_if(
567 return is_nation_playable(&n) && is_nation_pickable(&n)
568 && nation_is_in_group(&n, group);
574 item =
new QTableWidgetItem;
575 item->setData(Qt::UserRole, i - 1);
580 header->resizeSections(QHeaderView::Stretch);
582 header->resizeSections(QHeaderView::ResizeToContents);
606 const QItemSelection &ds)
609 QModelIndexList indexes = sl.indexes();
612 if (indexes.isEmpty()) {
615 index = indexes.at(0);
625 QTableWidgetItem *
item;
637 index =
item->data(Qt::UserRole).toInt();
642 for (
const auto &pnation :
nations) {
649 item =
new QTableWidgetItem;
652 if (pnation.player) {
654 f.setStrikeOut(
true);
657 item->setData(Qt::DecorationRole, *s);
665 header->resizeSections(QHeaderView::Stretch);
667 header->resizeSections(QHeaderView::ResizeToContents);
674 const QItemSelection &deselcted)
680 QModelIndexList indexes = selected.indexes();
682 QTableWidgetItem *
item;
685 if (indexes.isEmpty()) {
689 index = indexes.at(0);
690 if (indexes.isEmpty()) {
693 qvar = index.data(Qt::UserRole);
717 qvar = qvar.fromValue<
int>(style);
719 for (ind = 0; ind <
styles->rowCount(); ind++) {
722 if (
item->data(Qt::UserRole) == qvar) {
732 const QItemSelection &deselcted)
737 QModelIndexList indexes = selected.indexes();
739 if (indexes.isEmpty()) {
743 index = indexes.at(0);
744 qvar = index.data(Qt::UserRole);
788 _(
"Nation has been chosen by other player"));
863 const struct text_tag_list *tags,
tile *ptile,
865 : QMessageBox(parent)
869 setAttribute(Qt::WA_DeleteOnClose);
870 goto_but = this->addButton(
_(
"Goto Location"), QMessageBox::ActionRole);
872 inspect_but = this->addButton(
_(
"Inspect City"), QMessageBox::ActionRole);
875 close_but = this->addButton(QMessageBox::Close);
887 qlines.replace(QLatin1String(
"\n"), QLatin1String(
" "));
889 connect(
goto_but, &QAbstractButton::pressed,
this,
891 connect(
inspect_but, &QAbstractButton::pressed,
this,
893 connect(
close_but, &QAbstractButton::pressed,
this, &QWidget::close);
929 rn_bytes = rule_name.toLocal8Bit();
932 rn = rn_bytes.data();
945 const struct text_tag_list *tags,
958 QMessageBox *msg =
new QMessageBox(
king()->central_wdg);
961 msg->setStandardButtons(QMessageBox::Ok);
963 msg->setAttribute(Qt::WA_DeleteOnClose);
982 for (
auto report : list) {
990 nd->move(
queen()->mapview_wdg->find_place(nd->size()));
1024 if (ptile !=
nullptr
1025 && (unit_list_size(ptile->
units) > 1
1051 Q_UNUSED(nationset_change)
1080 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Yes);
1081 ask->setDefaultButton(QMessageBox::Cancel);
1082 ask->button(QMessageBox::Yes)->setText(
_(
"Yes Start a Revolution!"));
1084 ask->setAttribute(Qt::WA_DeleteOnClose);
1085 QObject::connect(ask, &hud_message_box::accepted, [=]() {
1104 : QPushButton(title), data1(data1_in), data2(data2_in)
1140 QWidget *parent,
void (*run_on_close_in)(
int))
1141 : QWidget(parent), target_unit_button(nullptr), unit_skip(nullptr)
1143 QLabel *l =
new QLabel(text);
1145 setProperty(
"themed_choice",
true);
1146 layout =
new QVBoxLayout(
this);
1150 setWindowFlags(Qt::Dialog);
1151 setWindowTitle(title);
1152 setAttribute(Qt::WA_DeleteOnClose);
1198 QPushButton *next, *prev;
1200 next =
new QPushButton();
1203 next->setIconSize(QSize(32, 32));
1204 next->setFixedSize(QSize(36, 36));
1205 prev =
new QPushButton();
1207 prev->setIconSize(QSize(32, 32));
1208 prev->setFixedSize(QSize(36, 36));
1212 pix->fill(Qt::transparent);
1219 unit_skip->addWidget(prev, Qt::AlignCenter);
1221 unit_skip->addWidget(next, Qt::AlignCenter);
1224 connect(prev, &QAbstractButton::clicked,
this,
1226 connect(next, &QAbstractButton::clicked,
this,
1238 QString tool_tip = QLatin1String(
""),
1239 const int button_id = -1)
1245 QObject::connect(button, &QPushButton::clicked,
1250 if (!tool_tip.isEmpty()) {
1254 if (0 <= button_id) {
1259 layout->addWidget(button);
1269 p = mapFromGlobal(QCursor::pos());
1270 p.setY(p.y() - this->height());
1271 p.setX(p.x() - this->width());
1335 struct unit *new_target =
nullptr;
1336 bool break_next =
false;
1364 pix->fill(Qt::transparent);
1377 struct unit *new_target =
nullptr;
1395 pix->fill(Qt::transparent);
1465 layout->removeWidget(button);
1482 layout->addWidget(button);
1491 int actor_unit_id = data1.toInt();
1492 int target_city_id = data2.toInt();
1506 int actor_unit_id = data1.toInt();
1507 int target_city_id = data2.toInt();
1521 int caravan_id = data1.toInt();
1522 int caravan_target_id = data2.toInt();
1536 int actor_id = data1.toInt();
1537 int tgt_city_id = data2.toInt();
1550 int actor_id = data1.toInt();
1551 int tgt_city_id = data2.toInt();
1566 int actor_id = data1.toInt();
1567 int tgt_city_id = data2.toInt();
1578 static void airlift(QVariant data1, QVariant data2)
1580 int actor_id = data1.toInt();
1581 int tgt_city_id = data2.toInt();
1594 int actor_id = data1.toInt();
1595 int tgt_city_id = data2.toInt();
1608 int actor_id = data1.toInt();
1609 int tgt_city_id = data2.toInt();
1649 struct unit *actor_unit;
1659 delete[] actor_unit->
client.act_prob_cache;
1660 actor_unit->
client.act_prob_cache =
nullptr;
1709 struct city *target_city,
1710 struct unit *target_unit,
1711 struct tile *target_tile,
1715 QString title, text;
1719 struct city *actor_homecity;
1726 for (
auto caras : qAsConst(
king()->trade_gen.lines)) {
1727 if (caras.autocaravan == actor_unit) {
1732 target_city->
id, 0,
"");
1755 "Diplomat queue problem. Is another diplomat window open?");
1763 QString(
_(
"Choose Your %1's Strategy"))
1766 if (target_city && actor_homecity) {
1768 QString(
_(
"Your %1 from %2 reaches the city of %3.\nWhat now?"))
1771 }
else if (target_city) {
1772 text = QString(
_(
"Your %1 has arrived at %2.\nWhat is your command?"))
1775 }
else if (target_unit) {
1777 text = QString(
_(
"Your %1 is ready to act against %2 %3."))
1783 "No target specified.");
1785 text = QString(
_(
"Your %1 is waiting for your command."))
1796 qv1 = actor_unit->
id;
1849 act_probs[act], actor_unit,
1867 act_probs[act], actor_unit,
1885 act_probs[act], actor_unit,
1903 act_probs[act], actor_unit,
1921 act_probs[act], actor_unit,
1930 qv2 = target_tile->
index;
1938 cd->
add_item(QString(
_(
"&Wait")),
func, qv1, qv2, QLatin1String(
""),
1942 cd->
add_item(QString(
_(
"Do nothing")),
func, qv1, qv2, QLatin1String(
""),
1952 actor_unit->
client.act_prob_cache[act] = act_probs[act];
1965 switch (
static_cast<enum gen_action
>(tgt_action_id)) {
1966 case ACTION_SPY_TARGETED_SABOTAGE_CITY:
1967 return ACTION_SPY_SABOTAGE_CITY;
1968 case ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC:
1969 return ACTION_SPY_SABOTAGE_CITY_ESC;
1970 case ACTION_SPY_TARGETED_STEAL_TECH:
1971 return ACTION_SPY_STEAL_TECH;
1972 case ACTION_SPY_TARGETED_STEAL_TECH_ESC:
1973 return ACTION_SPY_STEAL_TECH_ESC;
1988 switch (
static_cast<enum gen_action
>(tgt_action_id)) {
1989 case ACTION_SPY_TARGETED_SABOTAGE_CITY:
1990 return ACTION_SPY_SABOTAGE_CITY_PRODUCTION;
1991 case ACTION_SPY_TARGETED_SABOTAGE_CITY_ESC:
1992 return ACTION_SPY_SABOTAGE_CITY_PRODUCTION_ESC;
1993 case ACTION_STRIKE_BUILDING:
1994 return ACTION_STRIKE_PRODUCTION;
2006 const QString custom, QVariant data1,
2012 if (!
af_map.contains(act)) {
2036 const QString custom, QVariant data1,
2053 button->setText(title);
2054 button->setToolTip(tool_tip);
2062 int actor_id = data1.toInt();
2063 int target_id = data2.toInt();
2071 static void fortify(QVariant data1, QVariant data2)
2073 int actor_id = data1.toInt();
2074 int target_id = data2.toInt();
2086 int actor_id = data1.toInt();
2087 int target_id = data2.toInt();
2097 int diplomat_id = data1.toInt();
2098 int diplomat_target_id = data2.toInt();
2107 diplomat_target_id);
2116 int diplomat_id = data1.toInt();
2117 int diplomat_target_id = data2.toInt();
2120 diplomat_target_id, 0,
"");
2128 int diplomat_id = data1.toInt();
2129 int diplomat_target_id = data2.toInt();
2132 diplomat_target_id, 0,
"");
2140 int actor_id = data1.toInt();
2141 int target_id = data2.toInt();
2151 int actor_id = data1.toInt();
2152 int target_id = data2.toInt();
2162 int actor_id = data1.toInt();
2163 int target_id = data2.toInt();
2173 int actor_id = data1.toInt();
2174 int target_id = data2.toInt();
2184 int actor_id = data1.toInt();
2185 int target_id = data2.toInt();
2192 int actor_id = data1.toInt();
2193 int target_id = data2.toInt();
2222 int actor_id = data1.toInt();
2223 int target_id = data2.toInt();
2233 int actor_id = data1.toInt();
2234 int target_id = data2.toInt();
2244 int actor_id = data1.toInt();
2245 int target_id = data2.toInt();
2253 static void bombard(QVariant data1, QVariant data2)
2255 int actor_id = data1.toInt();
2256 int target_id = data2.toInt();
2266 int actor_id = data1.toInt();
2267 int target_id = data2.toInt();
2277 int actor_id = data1.toInt();
2278 int target_id = data2.toInt();
2288 int actor_id = data1.toInt();
2290 dsend_packet_city_name_suggestion_req(&
client.
conn, actor_id);
2312 static void plant(QVariant data1, QVariant data2)
2320 static void pillage(QVariant data1, QVariant data2)
2322 int actor_id = data1.toInt();
2323 int target_id = data2.toInt();
2340 int actor_id = data1.toInt();
2341 int target_id = data2.toInt();
2358 int actor_id = data1.toInt();
2359 int target_id = data2.toInt();
2374 static void road(QVariant data1, QVariant data2)
2376 int actor_id = data1.toInt();
2377 int target_id = data2.toInt();
2393 static void base(QVariant data1, QVariant data2)
2395 int actor_id = data1.toInt();
2396 int target_id = data2.toInt();
2412 static void mine(QVariant data1, QVariant data2)
2414 int actor_id = data1.toInt();
2415 int target_id = data2.toInt();
2433 int actor_id = data1.toInt();
2434 int target_id = data2.toInt();
2450 static void nuke(QVariant data1, QVariant data2)
2452 int diplomat_id = data1.toInt();
2453 int diplomat_target_id = data2.toInt();
2464 static void attack(QVariant data1, QVariant data2)
2466 int diplomat_id = data1.toInt();
2467 int diplomat_target_id = data2.toInt();
2480 int diplomat_id = data1.toInt();
2481 int diplomat_target_id = data2.toInt();
2503 int actor_id = data1.toInt();
2504 int target_id = data2.toInt();
2521 int diplomat_id = data1.toInt();
2522 int diplomat_target_id = data2.toInt();
2525 struct player *pvictim =
nullptr;
2527 QList<QVariant> actor_and_target;
2537 if (cd !=
nullptr) {
2542 queen()->game_tab_widget,
2546 actor_and_target.append(diplomat_id);
2547 actor_and_target.append(diplomat_target_id);
2548 actor_and_target.append(act_id);
2549 qv1 = QVariant::fromValue(actor_and_target);
2573 stra = QString(
_(
"At %1's Discretion"))
2605 int diplomat_id = data1.toList().at(0).toInt();
2606 int diplomat_target_id = data1.toList().at(1).toInt();
2607 action_id act_id = data1.toList().at(2).toInt();
2611 if (data2.toInt() ==
A_UNSET) {
2614 diplomat_target_id, data2.toInt(),
"");
2628 int actor_id = data1.toInt();
2629 int target_id = data2.toInt();
2646 int diplomat_id = data1.toInt();
2647 int diplomat_target_id = data2.toInt();
2656 diplomat_target_id);
2665 int diplomat_id = data1.toInt();
2666 int diplomat_target_id = data2.toInt();
2675 diplomat_id, diplomat_target_id);
2684 int diplomat_id = data1.toInt();
2685 int diplomat_target_id = data2.toInt();
2699 int diplomat_id = data1.toInt();
2700 int diplomat_target_id = data2.toInt();
2714 int diplomat_id = data1.toInt();
2715 int diplomat_target_id = data2.toInt();
2729 int diplomat_id = data1.toInt();
2730 int diplomat_target_id = data2.toInt();
2744 int actor_id = data1.toInt();
2745 int target_id = data2.toInt();
2758 int diplomat_id = data1.toInt();
2759 int diplomat_target_id = data2.toInt();
2773 int diplomat_id = data1.toInt();
2774 int diplomat_target_id = data2.toInt();
2788 int diplomat_id = data1.toInt();
2789 int diplomat_target_id = data2.toInt();
2794 diplomat_target_id, 0,
"");
2803 int diplomat_id = data1.toInt();
2804 int diplomat_target_id = data2.toInt();
2818 int diplomat_id = data1.toInt();
2819 int diplomat_target_id = data2.toInt();
2833 int diplomat_id = data1.toInt();
2834 int diplomat_target_id = data2.toInt();
2839 diplomat_target_id, 0,
"");
2848 int diplomat_id = data1.toInt();
2849 int diplomat_target_id = data2.toInt();
2854 diplomat_target_id, 0,
"");
2863 int diplomat_id = data1.toInt();
2864 int diplomat_target_id = data2.toInt();
2869 diplomat_target_id, 0,
"");
2878 int diplomat_id = data1.toInt();
2879 int diplomat_target_id = data2.toInt();
2893 int diplomat_id = data1.toInt();
2894 int diplomat_target_id = data2.toInt();
2899 diplomat_target_id,
B_LAST + 1,
"");
2908 int diplomat_id = data1.toInt();
2909 int diplomat_target_id = data2.toInt();
2914 diplomat_target_id,
B_LAST + 1,
"");
2923 int diplomat_id = data1.toInt();
2924 int diplomat_target_id = data2.toInt();
2938 int diplomat_id = data1.toInt();
2939 int diplomat_target_id = data2.toInt();
2944 diplomat_target_id,
A_UNSET,
"");
2953 int diplomat_id = data1.toInt();
2954 int diplomat_target_id = data2.toInt();
2963 diplomat_target_id);
2972 int diplomat_id = data1.toInt();
2973 int diplomat_target_id = data2.toInt();
2982 diplomat_target_id);
2993 int diplomat_id = data1.toInt();
2994 int diplomat_target_id = data2.toInt();
3008 const struct action *paction)
3011 int diplomat_id = actor->
id;
3012 int diplomat_target_id = tcity->
id;
3018 buf = QString::asprintf(
PL_(
"Treasury contains %d gold.",
3019 "Treasury contains %d gold.",
3026 buf2 = QString::asprintf(
_(
"You can't incite a revolt in %s."),
3029 impossible->setStandardButtons(QMessageBox::Ok);
3030 impossible->setAttribute(Qt::WA_DeleteOnClose);
3035 buf2 = QString(
PL_(
"Incite a revolt for %1 gold?\n%2",
3036 "Incite a revolt for %1 gold?\n%2", cost))
3037 .arg(QString::number(cost), buf);
3039 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Yes);
3040 ask->setDefaultButton(QMessageBox::Cancel);
3041 ask->button(QMessageBox::Yes)->setText(
_(
"Yes Incite a Revolt!"));
3042 ask->setAttribute(Qt::WA_DeleteOnClose);
3043 QObject::connect(ask, &hud_message_box::accepted, [=]() {
3052 buf2 = QString(
PL_(
"Inciting a revolt costs %1 gold.\n%2",
3053 "Inciting a revolt costs %1 gold.\n%2", cost))
3054 .arg(QString::number(cost), buf);
3056 too_much->setStandardButtons(QMessageBox::Ok);
3057 too_much->setAttribute(Qt::WA_DeleteOnClose);
3069 const struct action *paction)
3073 int diplomat_id = actor->
id;
3074 int diplomat_target_id = tunit->
id;
3080 buf = QString::asprintf(
PL_(
"Treasury contains %d gold.",
3081 "Treasury contains %d gold.",
3086 buf2 = QString(
PL_(
"Bribe unit for %1 gold?\n%2",
3087 "Bribe unit for %1 gold?\n%2", cost))
3088 .arg(QString::number(cost), buf);
3090 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Yes);
3091 ask->setDefaultButton(QMessageBox::Cancel);
3092 ask->button(QMessageBox::Yes)->setText(
_(
"Yes Bribe!"));
3093 ask->setAttribute(Qt::WA_DeleteOnClose);
3094 QObject::connect(ask, &hud_message_box::accepted, [=]() {
3101 buf2 = QString(
PL_(
"Bribing the unit costs %1 gold.\n%2",
3102 "Bribing the unit costs %1 gold.\n%2", cost))
3103 .arg(QString::number(cost), buf);
3105 ask->setAttribute(Qt::WA_DeleteOnClose);
3122 what = data1.toInt();
3123 punit_id = data2.toInt();
3184 int actor_id = data1.toInt();
3185 int target_id = data2.toInt();
3237 int diplomat_id = data1.toList().at(0).toInt();
3238 int diplomat_target_id = data1.toList().at(1).toInt();
3239 action_id act_id = data1.toList().at(2).toInt();
3243 if (data2.toInt() ==
B_LAST) {
3246 diplomat_target_id, data2.toInt(),
"");
3247 }
else if (data2.toInt() == -1) {
3250 diplomat_id, diplomat_target_id, data2.toInt(),
"");
3264 const struct action *paction)
3267 int diplomat_id = actor->
id;
3268 int diplomat_target_id = tcity->
id;
3271 _(
"Sabotage"),
_(
"Select Improvement to Sabotage"),
3275 QList<QVariant> actor_and_target;
3281 actor_and_target.append(diplomat_id);
3282 actor_and_target.append(diplomat_target_id);
3283 actor_and_target.append(paction->
id);
3284 qv1 = QVariant::fromValue(actor_and_target);
3295 if (pimprove->sabotage > 0) {
3332 cd =
new choice_dialog(
_(
"What To Pillage"),
_(
"Select what to pillage:"),
3333 queen()->game_tab_widget);
3359 setAttribute(Qt::WA_DeleteOnClose);
3362 str = QString(
PL_(
"Are you sure you want to disband that %1 unit?",
3363 "Are you sure you want to disband those %1 units?",
3365 .arg(punits.size());
3366 pb = addButton(
_(
"Yes"), QMessageBox::AcceptRole);
3367 addButton(
_(
"No"), QMessageBox::RejectRole);
3369 setDefaultButton(pb);
3370 connect(pb, &QAbstractButton::clicked,
this,
3380 for (
const auto punit :
cpunits) {
3411 title = QString(
_(
"Modpack suggests using %1 tileset."))
3413 text = QStringLiteral(
"It might not work with other tilesets.\n"
3414 "You are currently using tileset %1.")
3416 ask->addButton(
_(
"Keep current tileset"), QMessageBox::RejectRole);
3417 ask->addButton(
_(
"Load tileset"), QMessageBox::AcceptRole);
3419 ask->setAttribute(Qt::WA_DeleteOnClose);
3421 QObject::connect(ask, &hud_message_box::accepted, [=]() {
3424 tileset_error(nullptr, LOG_ERROR,
3425 _(
"Can't load requested tileset %s."),
3426 game.control.preferred_tileset);
3442 title = QString(
_(
"Modpack suggests using %1 soundset."))
3444 text = QStringLiteral(
"It might not work with other tilesets.\n"
3445 "You are currently using soundset %1.")
3447 ask->addButton(
_(
"Keep current soundset"), QMessageBox::RejectRole);
3448 ask->addButton(
_(
"Load soundset"), QMessageBox::AcceptRole);
3450 ask->setAttribute(Qt::WA_DeleteOnClose);
3451 QObject::connect(ask, &hud_message_box::accepted, [=]() {
3467 title = QString(
_(
"Modpack suggests using %1 musicset."))
3469 text = QStringLiteral(
"It might not work with other tilesets.\n"
3470 "You are currently using musicset %1.")
3472 ask->addButton(
_(
"Keep current musicset"), QMessageBox::RejectRole);
3473 ask->addButton(
_(
"Load musicset"), QMessageBox::AcceptRole);
3475 ask->setAttribute(Qt::WA_DeleteOnClose);
3476 QObject::connect(ask, &hud_message_box::accepted, [=]() {
3488 Q_UNUSED(theme_name)
3499 QList<choice_dialog *> cd_list;
3500 QList<freeciv::report_widget *> nd_list;
3502 QApplication::alert(
king()->central_wdg);
3504 for (i = 0; i < cd_list.count(); i++) {
3505 cd_list[i]->close();
3509 for (i = 0; i < nd_list.count(); i++) {
3510 nd_list[i]->close();
3532 if (cd !=
nullptr) {
3549 if (cd !=
nullptr) {
3566 if (cd !=
nullptr) {
3583 if (cd !=
nullptr) {
3600 if (cd !=
nullptr) {
3611 struct city *target_city,
3612 struct unit *target_unit,
3613 struct tile *target_tile,
3617 Q_UNUSED(target_extra)
3625 if (asd ==
nullptr) {
3627 "The action selection dialog should have been open");
3633 "The action selection dialog is for another actor unit.");
3637 qv1 = actor_unit->
id;
3640 if (cancel_button !=
nullptr) {
3647 if (wait_button !=
nullptr) {
3654 if (keep_moving_button !=
nullptr) {
3675 if (target_unit !=
nullptr) {
3676 qv2 = target_unit->
id;
3679 || target_unit !=
nullptr,
3680 "Action enabled against non existing unit!");
3686 if (target_city !=
nullptr) {
3687 qv2 = target_city->
id;
3690 || target_city !=
nullptr,
3691 "Action enabled against non existing city!");
3698 if (target_tile !=
nullptr) {
3702 || target_tile !=
nullptr,
3703 "Action enabled against all units on "
3704 "non existing tile!");
3710 qv2 = actor_unit->
id;
3729 if (keep_moving_button !=
nullptr || wait_button !=
nullptr
3730 || cancel_button !=
nullptr) {
3745 if (cd !=
nullptr) {
3766 if (punits.empty()) {
3771 for (
const auto punit : punits) {
3772 punit_ids->push_back(punit->id);
3776 title =
_(
"Upgrade Unit!");
3777 ask->setStandardButtons(QMessageBox::Ok);
3779 title =
_(
"Upgrade Obsolete Units");
3780 ask->setStandardButtons(QMessageBox::Cancel | QMessageBox::Yes);
3781 ask->setDefaultButton(QMessageBox::Cancel);
3782 ask->button(QMessageBox::Yes)->setText(
_(
"Yes Upgrade"));
3785 ask->setAttribute(Qt::WA_DeleteOnClose);
3786 QObject::connect(ask, &hud_message_box::accepted, [=]() {
3787 std::unique_ptr<QVector<int>> uptr(punit_ids);
3791 for (
int id : not_ptr) {
3831 struct unit_list *potential_transports = unit_list_new();
3839 unit_list_append(potential_transports, ptransport);
3844 tcount = unit_list_size(potential_transports);
3848 unit_list_destroy(potential_transports);
3851 }
else if (tcount == 1) {
3853 fc_assert(unit_list_get(potential_transports, 0) == best_transport);
3856 unit_list_destroy(potential_transports);
3863 unit_list_destroy(potential_transports);
3872 int attacker_hp,
int defender_hp,
3873 bool make_att_veteran,
bool make_def_veteran)
3875 if (
king()->qt_settings.show_battle_log) {
3877 attacker_unit_id, defender_unit_id, attacker_hp, defender_hp,
3878 make_att_veteran, make_def_veteran,
queen()->battlelog_wdg->scale,
3879 queen()->battlelog_wdg);
const QString action_prepare_ui_name(action_id act_id, const char *mnemonic, const struct act_prob prob, const QString &custom)
Get the UI name ready to show the action in the UI.
bool action_prob_possible(const struct act_prob probability)
Returns TRUE iff the given action probability belongs to an action that may be possible.
struct action * action_by_number(action_id act_id)
Return the action with the given id.
#define action_iterate_end
#define action_id_get_actor_kind(act_id)
#define action_iterate(_act_)
#define action_id_get_target_kind(act_id)
QString break_lines(const QString &src, int after)
void audio_restart(const QString &soundset_name, const QString &musicset_name)
Switch soundset.
void output_window_append(const struct ft_color color, const char *featured_text)
Add a line of text to the output ("chatline") window, like puts() would do it in the console.
struct player * city_owner(const struct city *pcity)
Return the owner of the city.
const char * city_name_get(const struct city *pcity)
Return the name of the city.
const char * city_improvement_name_translation(const struct city *pcity, const struct impr_type *pimprove)
Return the extended name of the building.
#define INCITE_IMPOSSIBLE_COST
#define city_built_iterate(_pcity, _p)
#define city_built_iterate_end
void real_city_dialog_popup(struct city *pcity)
Pop up (or bring to the front) a dialog for the given city.
void stack_button(Choice_dialog_button *button)
Put the button in the stack and temporarily remove it.
void prev_unit()
Focus previous target.
struct unit * targeted_unit
void unstack_all_buttons()
Put all the buttons in the stack back to the dialog.
Choice_dialog_button * get_identified_button(const int id)
Get the button with the given identity.
QPushButton * target_unit_button
void set_layout()
Sets layout for choice dialog.
void update_dialog(const struct act_prob *act_probs)
Update dialog for new target (targeted_unit)
QList< Choice_dialog_button * > last_buttons_stack
~choice_dialog() override
Destructor for choice dialog.
void next_unit()
Focus next target.
void show_me()
Shows choice dialog.
QVBoxLayout * get_layout()
Returns layout in choice dialog.
QList< Choice_dialog_button * > buttons_list
void(* run_on_close)(int)
choice_dialog(const QString title, const QString text, QWidget *parent=nullptr, void(*run_on_close_in)(int)=nullptr)
Constructor for choice_dialog.
void switch_target()
Switches target unit.
QList< Choice_dialog_button * > action_button_map
int sub_target_id[ASTK_COUNT]
void execute_action(const int action)
Run chosen action and close dialog.
void add_item(QString title, pfcn_void func, QVariant data1, QVariant data2, QString tool_tip, const int button_id)
Adds new action for choice dialog.
void disband_clicked()
Clicked Yes in disband box.
const std::vector< unit * > cpunits
disband_box(const std::vector< unit * > &punits, QWidget *parent=0)
Disband Message box contructor.
~disband_box() override
Destructor for disband box.
QPixmap * getPixmap(const QString &id)
Returns pixmap by given name, pixmap needs to be deleted by someone else.
static fcIcons * instance()
Returns instance of fc_icons.
trade_generator trade_gen
choice_dialog * opened_dialog
choice_dialog * get_diplo_dialog()
Get current diplo dialog.
void set_diplo_dialog(choice_dialog *widget)
Set current diplo dialog.
QPixmap sample_sprite(int style_index=0) const
Returns an example of what a city might look like.
void add_combat_info(hud_unit_combat *huc)
Adds combat information to battle log.
void set_text_title(const QString &s1, const QString &s2)
Sets text and title and shows message box.
void show_me()
Shows unit loader, adds possible tranportsand units to table Calculates table size.
void center_on_tile(tile *tile, bool animate=true)
Centers the view on a tile.
notify_goto(const char *headline, const char *lines, const struct text_tag_list *tags, struct tile *ptile, QWidget *parent)
Notify goto dialog constructor.
void inspect_city()
Clicked inspect city in notify goto dialog.
QPushButton * inspect_but
void goto_tile()
Clicked goto tile in notify goto dialog.
hud_battle_log * battlelog_wdg
fc_game_tab_widget * game_tab_widget
qdef_act()
Default actions provider constructor.
static qdef_act * action()
Returns instance of qdef_act.
action_id vs_city_get()
Returns default action vs city.
static qdef_act * m_instance
static void drop()
Deletes qdef_act instance.
void vs_city_set(int i)
Sets default action vs city.
void vs_unit_set(int i)
Sets default action vs unit.
action_id vs_unit_get()
Returns default action vs unit.
void mouseReleaseEvent(QMouseEvent *event) override
Mouse release event for themed dialog.
void mouseMoveEvent(QMouseEvent *event) override
Mouse move event for themed titlebar (moves dialog with left mouse)
qfc_dialog(QWidget *parent)
Constructor for custom dialog with themed titlebar.
void mousePressEvent(QMouseEvent *event) override
Mouse press event - catches left click.
void paintEvent(QPaintEvent *event) override
Paint event for themed dialog.
void random_pressed()
Sets random nation.
void style_selected(const QItemSelection &sl, const QItemSelection &ds)
Sets selected style.
QTableWidget * selected_nation_tabs
QPushButton * random_button
~races_dialog() override
Destructor for races dialog.
void refresh()
Sets first index to call update of nation list.
void nation_selected(const QItemSelection &sl, const QItemSelection &ds)
Sets selected nation and updates style and leaders selector.
void nationset_changed(int index)
User changed nation_set.
void ok_pressed()
Button accepting all selection has been pressed, closes dialog if everything is ok.
void leader_selected(int index)
Sets selected leader.
void group_selected(const QItemSelection &sl, const QItemSelection &ds)
Selected group of nation.
void set_index(int index)
Sets new nations' group by current current selection, index is used only when there is no current sel...
void update_nationset_combo()
Updates nation_set combo ( usually called from option change )
races_dialog(struct player *pplayer, QWidget *parent=0)
Constructor for selecting nations.
QTableWidget * nation_tabs
QGridLayout * main_layout
void cancel_pressed()
Button canceling all selections has been pressed.
enum client_states client_state()
Return current client state.
struct player * client_player()
Either controlling or observing.
void client_unit_init_act_prob_cache(struct unit *punit)
Initialize the action probability cache.
void request_unit_non_action_move(struct unit *punit, struct tile *dest_tile)
Order a unit to move to a neighboring tile without performing an action.
void action_selection_no_longer_in_progress(const int old_actor_id)
The action selection process is no longer in progres for the specified unit.
void key_unit_wait()
Handle user 'wait' input.
void request_unit_load(struct unit *pcargo, struct unit *ptrans, struct tile *ptile)
Send a request to the server that the cargo be loaded into the transporter.
void request_do_action(action_id action, int actor_id, int target_id, int sub_tgt, const char *name)
Request an actor unit to do a specific action.
void request_unit_disband(struct unit *punit)
Send request to disband unit to server.
void request_action_details(action_id action, int actor_id, int target_id)
Request data for follow up questions about an action the unit can perform.
void request_new_unit_activity_targeted(struct unit *punit, enum unit_activity act, struct extra_type *tgt)
Send request for unit activity changing to server.
void action_decision_clear_want(const int old_actor_id)
Have the server record that a decision no longer is wanted for the specified unit.
void request_unit_upgrade(struct unit *punit)
Send request to upgrade unit to server.
void action_selection_next_in_focus(const int old_actor_id)
Move on to the next unit in focus that needs an action decision.
static void attack(QVariant data1, QVariant data2)
Action "Attack" for choice dialog.
static void action_entry_update(Choice_dialog_button *button, action_id act, const struct act_prob *act_probs, const QString custom, QVariant data1, QVariant data2)
Update an existing button.
int action_selection_target_extra(void)
Returns id of the target extra of the actions currently handled in action selection dialog when the a...
static void destroy_city(QVariant data1, QVariant data2)
Action destroy city for choice dialog.
static void spy_sabotage_unit(QVariant data1, QVariant data2)
Action sabotage unit for choice dialog.
static void pillage(QVariant data1, QVariant data2)
Action "Pillage" for choice dialog.
static void caravan_marketplace(QVariant data1, QVariant data2)
Action enter market place for choice dialog.
static void clean_pollution(QVariant data1, QVariant data2)
Action "Clean Pollution" for choice dialog.
static void spy_steal_shared(QVariant data1, QVariant data2, action_id act_id)
Action steal tech with spy for choice dialog.
static void clean_fallout(QVariant data1, QVariant data2)
Action "Clean Fallout" for choice dialog.
static void spy_sabotage(QVariant data1, QVariant data2)
Action sabotage with spy for choice dialog.
int action_selection_target_tile(void)
Returns id of the target tile of the actions currently handled in action selection dialog when the ac...
static void spy_investigate(QVariant data1, QVariant data2)
Action investigate city for choice dialog.
static void act_sel_wait(QVariant data1, QVariant data2)
Delay selection of what action to take.
static void nuke_units(QVariant data1, QVariant data2)
Action "Nuke Units" for choice dialog.
int action_selection_actor_unit(void)
Returns the id of the actor unit currently handled in action selection dialog when the action selecti...
static void capture_units(QVariant data1, QVariant data2)
Action capture units for choice dialog.
static void road(QVariant data1, QVariant data2)
Action "Build Road" for choice dialog.
static bool is_race_dialog_open
bool try_default_unit_action(QVariant q1, QVariant q2)
Try to pick up default unit action.
static void fortify(QVariant data1, QVariant data2)
Action "Fortify" for choice dialog.
static void transport_board(QVariant data1, QVariant data2)
Action "Transport Board" for choice dialog.
static void spy_sabotage_unit_esc(QVariant data1, QVariant data2)
Action Sabotage Unit Escape for choice dialog.
static const QHash< action_id, pfcn_void > af_map_init()
Initialize a mapping between an action and the function to call if the action's button is pushed.
bool handmade_scenario_warning()
Give a warning when user is about to edit scenario with manually set properties.
static void disband_unit(QVariant data1, QVariant data2)
Action Disband Unit for choice dialog.
static void spy_steal_gold(QVariant data1, QVariant data2)
Action steal gold for choice dialog.
void popdown_players_report()
Closes players report.
static void mine(QVariant data1, QVariant data2)
Action "Build Mine" for choice dialog.
static void user_action_2(QVariant data1, QVariant data2)
User Action 2 for choice dialog.
void popup_musicset_suggestion_dialog(void)
Ruleset (modpack) has suggested loading certain musicset.
static void spy_steal_gold_esc(QVariant data1, QVariant data2)
Action steal gold escape for choice dialog.
static void diplomat_embassy(QVariant data1, QVariant data2)
Action establish embassy for choice dialog.
void unit_select_dialog_popup(struct tile *ptile)
Popup a dialog window to select units on a particular tile.
void update_nationset_combo()
Updates nationset combobox.
static void user_action_unit_vs_city(int actor_id, int target_id, action_id act_id)
User action with target kind ATK_CITY.
void action_selection_close(void)
Closes the action selection dialog.
static void cultivate(QVariant data1, QVariant data2)
Action "Cultivate" for choice dialog.
void races_update_pickable(bool nationset_change)
The server has changed the set of selectable nations.
int action_selection_target_city(void)
Returns id of the target city of the actions currently handled in action selection dialog when the ac...
static void spy_steal_something(QVariant data1, QVariant data2)
Action steal given tech for choice dialog.
void popup_notify_goto_dialog(const char *headline, const char *lines, const struct text_tag_list *tags, struct tile *ptile)
Popup a dialog to display information about an event that has a specific location.
static void spy_poison(QVariant data1, QVariant data2)
Action Poison City for choice dialog.
void show_tech_gained_dialog(Tech_type_id tech)
Player has gained a new tech.
static void base(QVariant data1, QVariant data2)
Action "Build Base" for choice dialog.
static void spy_nuke_city_esc(QVariant data1, QVariant data2)
Action suitcase nuke escape for choice dialog.
void popup_soundset_suggestion_dialog(void)
Ruleset (modpack) has suggested loading certain soundset.
void popup_races_dialog(struct player *pplayer)
Popup the nation selection dialog.
static void expel_unit(QVariant data1, QVariant data2)
Action expel unit for choice dialog.
static void diplomat_sabotage(QVariant data1, QVariant data2)
Action sabotage for choice dialog.
static action_id get_non_targeted_action_id(action_id tgt_action_id)
Get the non targeted version of an action so it, if enabled, can appear in the target selection dialo...
static void caravan_help_build(QVariant data1, QVariant data2)
Action help build wonder for choice dialog.
static void bombard(QVariant data1, QVariant data2)
Action "Bombard" for choice dialog.
void popdown_races_dialog(void)
Close the nation selection dialog.
void popup_tileset_suggestion_dialog(void)
Ruleset (modpack) has suggested loading certain tileset.
static void conquer_city(QVariant data1, QVariant data2)
Action "Conquer City" for choice dialog.
void popdown_economy_report()
Closes economy report.
static void join_city(QVariant data1, QVariant data2)
Action join city for choice dialog.
void action_selection_no_longer_in_progress_gui_specific(int actor_id)
Let the non shared client code know that the action selection process no longer is in progress for th...
static void spy_request_sabotage_list(QVariant data1, QVariant data2)
Action request sabotage list for choice dialog.
static void diplomat_bribe(QVariant data1, QVariant data2)
Action bribe unit for choice dialog.
static void spy_steal(QVariant data1, QVariant data2)
Action "Targeted Steal Tech" for choice dialog.
static void airlift(QVariant data1, QVariant data2)
Action "Airlift Unit" for choice dialog.
void popup_pillage_dialog(struct unit *punit, bv_extras extras)
Popup a dialog asking the unit which improvement they would like to pillage.
void popup_sabotage_dialog(struct unit *actor, struct city *tcity, const struct action *paction)
Popup a dialog asking a diplomatic unit if it wishes to sabotage the given enemy city.
static void transport_alight(QVariant data1, QVariant data2)
Action "Transport Alight" for choice dialog.
static void plant(QVariant data1, QVariant data2)
Action "Plant" for choice dialog.
static void nuke(QVariant data1, QVariant data2)
Action "Explode Nuclear" for choice dialog.
static void disembark2(QVariant data1, QVariant data2)
Action "Transport Disembark 2" for choice dialog.
void popup_upgrade_dialog(const std::vector< unit * > &punits)
Popup dialog for upgrade units.
void popup_bribe_dialog(struct unit *actor, struct unit *tunit, int cost, const struct action *paction)
Popup a dialog asking a diplomatic unit if it wishes to bribe the given enemy unit.
static void transport_unload(QVariant data1, QVariant data2)
Action "Transport Unload" for choice dialog.
void popup_notify_dialog(const char *caption, const char *headline, const char *lines)
Popup a generic dialog to display some generic information.
void action_selection_refresh(struct unit *actor_unit, struct city *target_city, struct unit *target_unit, struct tile *target_tile, struct extra_type *target_extra, const struct act_prob *act_probs)
Updates the action selection dialog with new information.
void popdown_science_report()
Closes science report.
static void diplomat_steal(QVariant data1, QVariant data2)
Action steal with diplomat for choice dialog.
static void unit_upgrade(QVariant data1, QVariant data2)
Action "Upgrade Unit" for choice dialog.
bool popup_theme_suggestion_dialog(const char *theme_name)
Tileset (modpack) has suggested loading certain theme.
static void spy_request_strike_bld_list(QVariant data1, QVariant data2)
Action request "Surgical Strike Building" list for choice dialog.
static void diplomat_incite_escape(QVariant data1, QVariant data2)
Action incite revolt and escape for choice dialog.
static void found_city(QVariant data1, QVariant data2)
Action build city for choice dialog.
static void diplomat_investigate(QVariant data1, QVariant data2)
Action Investigate City Spend Unit for choice dialog.
static void bombard3(QVariant data1, QVariant data2)
Action "Bombard 3" for choice dialog.
static void action_entry(choice_dialog *cd, action_id act, const struct act_prob *act_probs, const QString custom, QVariant data1, QVariant data2)
Show the user the action if it is enabled.
static void diplomat_incite(QVariant data1, QVariant data2)
Action incite revolt for choice dialog.
bool request_transport(struct unit *pcargo, struct tile *ptile)
Unit wants to get into some transport on given tile.
void popdown_endgame_report()
Removes endgame report.
static void diplomat_steal_esc(QVariant data1, QVariant data2)
Action "Steal Tech Escape Expected" for choice dialog.
static bool is_more_user_input_needed
static void bombard2(QVariant data1, QVariant data2)
Action "Bombard 2" for choice dialog.
void popup_incite_dialog(struct unit *actor, struct city *tcity, int cost, const struct action *paction)
Popup a window asking a diplomatic unit if it wishes to incite the given enemy city.
void popdown_all_spaceships_dialogs()
Close all spaceships dialogs.
static void nuke_city(QVariant data1, QVariant data2)
Action "Nuke City" for choice dialog.
static void user_action(QVariant data1, QVariant data2, action_id act_id)
User action handler, dispatches on target kind.
void popup_connect_msg(const char *headline, const char *message)
Popup a dialog to display connection message from server.
static void diplomat_sabotage_esc(QVariant data1, QVariant data2)
Action sabotage and escape for choice dialog.
static void spy_nuke_city(QVariant data1, QVariant data2)
Action suitcase nuke for choice dialog.
static void unit_recycle(QVariant data1, QVariant data2)
Action Recycle Unit for choice dialog.
void unit_select_dialog_update_real(void *unused)
Update the dialog window to select units on a particular tile.
static void user_action_unit_vs_tile(int actor_id, int target_id, action_id act_id)
User action with target kind ATK_TILE or ATK_UNITS.
static void spy_steal_esc(QVariant data1, QVariant data2)
Action "Targeted Steal Tech Escape Expected" for choice dialog.
static void paradrop(QVariant data1, QVariant data2)
Action "Paradrop Unit" for choice dialog.
static void suicide_attack(QVariant data1, QVariant data2)
Action "Suicide Attack" for choice dialog.
void races_toggles_set_sensitive(void)
In the nation selection dialog, make already-taken nations unavailable.
static action_id get_production_targeted_action_id(action_id tgt_action_id)
Get the production targeted version of an action so it, if enabled, can appear in the target selectio...
static void convert_unit(QVariant data1, QVariant data2)
Action Convert Unit for choice dialog.
static bool did_not_decide
static void spy_poison_esc(QVariant data1, QVariant data2)
Action Poison City Escape for choice dialog.
void popup_action_selection(struct unit *actor_unit, struct city *target_city, struct unit *target_unit, struct tile *target_tile, struct extra_type *target_extra, const struct act_prob *act_probs)
Popup a dialog that allows the player to select what action a unit should take.
static void pillage_something(QVariant data1, QVariant data2)
Action pillage for choice dialog.
static void spy_request_sabotage_esc_list(QVariant data1, QVariant data2)
Action request sabotage (and escape) list for choice dialog.
static void act_sel_keep_moving(QVariant data1, QVariant data2)
Action keep moving with actor unit for choice dialog.
static void transform_terrain(QVariant data1, QVariant data2)
Action "Transform Terrain" for choice dialog.
void popup_combat_info(int attacker_unit_id, int defender_unit_id, int attacker_hp, int defender_hp, bool make_att_veteran, bool make_def_veteran)
Popup detailed information about battle or save information for some kind of statistics.
static void diplomat_queue_handle_primary(int actor_unit_id)
Move the queue of diplomats that need user input forward unless the current diplomat will need more i...
static void spy_embassy(QVariant data1, QVariant data2)
Action establish embassy for choice dialog.
static races_dialog * race_dialog
static void do_that_action(QVariant data1, QVariant data2, enum gen_action a)
static void user_action_unit_vs_self(int actor_id, int target_id, action_id act_id)
User action with target kind ATK_SELF.
void revolution_response(struct government *government)
Starts revolution with targeted government as target or anarchy otherwise.
static void user_action_3(QVariant data1, QVariant data2)
User Action 3 for choice dialog.
static void user_action_unit_vs_unit(int actor_id, int target_id, action_id act_id)
User action with target kind ATK_UNIT.
static void diplomat_queue_handle_secondary(int actor_id)
Move the queue of diplomats that need user input forward since the current diplomat got the extra inp...
QString forced_tileset_name
static void conquer_city2(QVariant data1, QVariant data2)
Action "Conquer City 2" for choice dialog.
int action_selection_target_unit(void)
Returns id of the target unit of the actions currently handled in action selection dialog when the ac...
static void irrigate(QVariant data1, QVariant data2)
Action "Build Irrigation" for choice dialog.
static void heal_unit(QVariant data1, QVariant data2)
Action "Heal Unit" for choice dialog.
void popdown_city_report()
Closes city report.
void popup_revolution_dialog(struct government *government)
Popup a dialog asking if the player wants to start a revolution.
static void unit_home_city(QVariant data1, QVariant data2)
Action Home City for choice dialog.
static void transport_embark(QVariant data1, QVariant data2)
Action "Transport Embark" for choice dialog.
bool try_default_city_action(QVariant q1, QVariant q2)
Try to pick up default city action.
static void keep_moving(QVariant data1, QVariant data2)
Empty action for choice dialog (just do nothing)
static void spy_steal_maps_esc(QVariant data1, QVariant data2)
Action steal maps escape for choice dialog.
static void disembark1(QVariant data1, QVariant data2)
Action "Transport Disembark" for choice dialog.
void popup_disband_dialog(const std::vector< unit * > &punits)
Pops up a dialog to confirm disband of the unit(s).
static bool is_showing_pillage_dialog
static const QHash< action_id, pfcn_void > af_map
static void caravan_establish_trade(QVariant data1, QVariant data2)
Action establish trade for choice dialog.
void popdown_all_game_dialogs(void)
This function is called when the client disconnects or the game is over.
static void spy_steal_maps(QVariant data1, QVariant data2)
Action steal maps for choice dialog.
static void user_action_1(QVariant data1, QVariant data2)
User Action 1 for choice dialog.
void(* pfcn_void)(QVariant, QVariant)
class fc_client * king()
Return fc_client instance.
#define IDENTITY_NUMBER_ZERO
#define PL_(String1, String2, n)
const struct ft_color ftc_client
struct unit * game_unit_by_number(int id)
Find unit out of all units in game: now uses fast idex method, instead of looking through all units o...
struct city * game_city_by_number(int id)
Often used function to get a city pointer from a city ID.
struct government * government_by_number(const Government_type_id gov)
Return the government with the given index.
Government_type_id government_number(const struct government *pgovern)
Return the government index.
void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
Returns nation legend and characteristics.
void popdown_help_dialog(void)
Close the help dialog.
Impr_type_id improvement_number(const struct impr_type *pimprove)
Return the improvement index.
#define fc_assert_msg(condition, message,...)
#define fc_assert_ret(condition)
#define fc_assert(condition)
#define fc_assert_action(condition, action)
bool same_pos(const struct tile *tile1, const struct tile *tile2)
Are (x1,y1) and (x2,y2) really the same when adjusted? This function might be necessary ALOT of place...
struct tile * index_to_tile(const struct civ_map *imap, int mindex)
Return the tile for the given index position.
bool can_unit_transport(const struct unit *transporter, const struct unit *transported)
Return true iff transporter has ability to transport transported.
bool unit_can_move_to_tile(const struct civ_map *nmap, const struct unit *punit, const struct tile *dst_tile, bool igzoc, bool enter_enemy_city)
Returns whether the unit can move from its current tile to the destination tile.
struct nation_type * nation_by_number(const Nation_type_id nation)
Return the nation with the given index.
struct nation_style * style_of_nation(const struct nation_type *pnation)
Returns nation's style.
const char * nation_set_name_translation(const struct nation_set *pset)
Return the translated name of a nation set.
const char * nation_group_name_translation(const struct nation_group *pgroup)
Return the translated name of a nation group.
bool nation_leader_is_male(const struct nation_leader *pleader)
Return the sex of the nation leader.
int nation_set_count()
Return the number of nation sets.
int nation_set_index(const struct nation_set *pset)
Return the nation set index.
bool is_nation_pickable(const struct nation_type *nation)
Return whether a nation is "pickable" – whether players can select it at game start.
std::vector< nation_type > nations
bool is_nation_playable(const struct nation_type *nation)
Return whether a nation is "playable"; i.e., whether a human player can choose this nation.
int nation_group_count()
Return the number of nation groups.
struct nation_set * nation_set_by_setting_value(const char *setting)
Returns the nation set that would be selected by the given value of the 'nationset' server setting.
const char * nation_adjective_translation(const struct nation_type *pnation)
Return the (translated) adjective for the given nation.
bool nation_is_in_group(const struct nation_type *pnation, const struct nation_group *pgroup)
Check if the given nation is in a given group.
const char * nation_set_rule_name(const struct nation_set *pset)
Return the (untranslated) rule name of a nation set.
const char * nation_adjective_for_player(const struct player *pplayer)
Return the (translated) adjective for the given nation of a player.
struct nation_group * nation_group_by_number(int id)
Return the nation group with the given index.
const char * nation_set_description(const struct nation_set *pset)
Return the (untranslated) user description of a nation set.
bool is_nation_group_hidden(struct nation_group *pgroup)
Return whether this group should appear in the nation selection UI.
Nation_type_id nation_index(const struct nation_type *pnation)
Return the nation index.
const char * nation_leader_name(const struct nation_leader *pleader)
Return the name of the nation leader.
const struct nation_leader_list * nation_leaders(const struct nation_type *pnation)
Returns the list the nation leader names.
struct nation_set * nation_set_by_rule_name(const char *name)
Return the nation set that has the given (untranslated) rule name.
#define nation_leader_list_iterate(leaderlist, pleader)
#define nation_sets_iterate_end
#define nation_sets_iterate(NAME_pset)
#define nation_leader_list_iterate_end
const struct option_set * server_optset
const char * option_str_get(const struct option *poption)
Returns the current value of this string option.
bool option_str_set(struct option *poption, const char *str)
Sets the value of this string option.
struct option * optset_option_by_name(const struct option_set *poptset, const char *name)
Returns the option corresponding of the name in this option set.
void set_government_choice(struct government *government)
Sets the target government.
void start_revolution()
Begin a revolution by telling the server to start it.
pageGame * queen()
Return game instandce.
int player_number(const struct player *pplayer)
Return the player index/number/id.
struct research * research_get(const struct player *pplayer)
Returns the research structure associated with the player.
QString research_advance_name_translation(const struct research *presearch, Tech_type_id tech)
Store the translated name of the given tech (including A_FUTURE) in 'buf'.
enum tech_state research_invention_state(const struct research *presearch, Tech_type_id tech)
Returns state of the tech for current research.
bool research_invention_gettable(const struct research *presearch, const Tech_type_id tech, bool allow_holes)
Returns TRUE iff the given tech can be given to the players sharing the research immediately.
struct packet_ruleset_control control
struct packet_game_info info
Functions for handling the nations.
The base class for options.
struct unit::@76::@78 client
int style_number(const struct nation_style *pstyle)
Return the style id.
int basic_city_style_for_style(struct nation_style *pstyle)
Return basic city style representing nation style.
const char * style_name_translation(const struct nation_style *pstyle)
Return the (translated) name of the style.
#define styles_iterate(_p)
#define styles_iterate_end
#define advance_index_iterate_end
#define advance_index_iterate(_start, _index)
struct extra_type * get_preferred_pillage(bv_extras extras)
Returns the highest-priority (best) extra to be pillaged from the terrain set.
const QString get_act_sel_action_custom_text(struct action *paction, const struct act_prob prob, const struct unit *actor_unit, const struct city *target_city)
Returns custom part of the action selection dialog button text for the specified action (given that t...
const QString act_sel_action_tool_tip(const struct action *paction, const struct act_prob prob)
Get information about starting the action in the current situation.
bool get_units_upgrade_info(char *buf, size_t bufsz, const std::vector< unit * > &punits)
Return text about upgrading these unit lists.
struct city * tile_city(const struct tile *ptile)
Return the city on this tile (or nullptr), checking for city center.
int tileset_unit_width(const struct tileset *t)
Return the unit tile width of the current tileset.
bool tilespec_reread(const QString &name, bool game_fully_initialized)
Read a new tilespec in from scratch.
int tileset_unit_height(const struct tileset *t)
Return the unit tile height of the current tileset.
const freeciv::layer_city * tileset_layer_city(const struct tileset *t)
Returns the layer_city of the tileset.
const char * tileset_basename(const struct tileset *t)
Return the name of the given tileset.
const QPixmap * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
Return the sprite for the nation.
int get_transporter_occupancy(const struct unit *ptrans)
Return how many units are in the transport.
struct unit * transporter_for_unit_at(const struct unit *pcargo, const struct tile *ptile)
Find the best transporter at the given location for the unit.
bool unit_can_do_action(const struct unit *punit, const action_id act_id)
Return TRUE iff this unit can do the specified generalized (ruleset defined) action enabler controlle...
int get_transporter_capacity(const struct unit *punit)
Return the number of units the transporter can hold (or 0).
#define unit_list_iterate(unitlist, punit)
#define unit_list_iterate_end
void toggle_unit_sel_widget(struct tile *ptile)
Shows/closes unit selection widget.
void update_unit_sel()
Update unit selection widget if open.
void popdown_unit_sel()
Closes unit selection widget.
const char * unit_name_translation(const struct unit *punit)
Return the (translated) name of the unit.
void put_unit(const struct unit *punit, QPixmap *pcanvas, const QPoint &canvas_loc)
Draw the given unit onto the canvas store at the given location.