Freeciv-3.1: /fast/freeciv/nightly/S3_1/client/gui-qt/helpdlg.cpp Source File

Freeciv-3.1

Loading...
Searching...
No Matches
helpdlg.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 <QApplication>
20#include <QGraphicsDropShadowEffect>
21#include <QGroupBox>
22#include <QHBoxLayout>
23#include <QProgressBar>
24#include <QPushButton>
25#include <QScreen>
26#include <QScrollArea>
27#include <QSplitter>
28#include <QStack>
29#include <QStringList>
30#include <QTextBrowser>
31#include <QTreeWidget>
32#include <QVBoxLayout>
33
34// utility
35#include "fcintl.h"
36
37// common
38#include "movement.h"
39#include "nation.h"
40#include "specialist.h"
41#include "terrain.h"
42#include "unit.h"
43
44// client
45#include "helpdata.h"
46
47// gui-qt
48#include "fc_client.h"
49#include "fonts.h"
50#include "helpdlg.h"
51#include "sprite.h"
52
53#define MAX_HELP_TEXT_SIZE 8192
54#define REQ_LABEL_NEVER _("(Never)")
55#define REQ_LABEL_NONE _("?tech:None")
56 static help_dialog *help_dlg = NULL;
57static canvas *terrain_canvas(struct terrain *terrain,
58 const struct extra_type *resource = NULL,
59 enum extra_cause cause = EC_COUNT);
60
61/**********************************************************************/
68 void popup_help_dialog_string(const char *item)
69{
70 popup_help_dialog_typed(Q_(item), HELP_ANY);
71}
72
73/**********************************************************************/
79 void popup_help_dialog_typed(const char *item, enum help_page_type htype)
80{
81 int pos;
82 const help_item *topic;
83
84 if (help_dlg == nullptr) {
85 help_dlg = new help_dialog();
86 } else {
87 help_dlg->reactivate();
88 }
89
90 topic = get_help_item_spec(item, htype, &pos);
91 if (pos >= 0) {
92 help_dlg->set_topic(topic);
93 }
94 help_dlg->setVisible(true);
95 help_dlg->activateWindow();
96}
97
98/**********************************************************************/
101 void popdown_help_dialog(void)
102{
103 if (help_dlg) {
104 help_dlg->setVisible(false);
105 help_dlg->deleteLater();
106 help_dlg = NULL;
107 }
108}
109
110/**********************************************************************/
113 void update_help_fonts()
114{
115 if (help_dlg) {
116 help_dlg->update_fonts();
117 }
118}
119
120/**********************************************************************/
123help_dialog::help_dialog(QWidget *parent) : qfc_dialog(parent)
124{
125 QHBoxLayout *hbox;
126 QPushButton *but;
127 QTreeWidgetItem *first;
128 QVBoxLayout *layout;
129 QWidget *buttons;
130
131 setWindowTitle(_("Freeciv Help Browser"));
132 history_pos = -1;
133 update_history = true;
134 layout = new QVBoxLayout(this);
135
136 splitter = new QSplitter(this);
137 layout->addWidget(splitter, 10);
138
139 tree_wdg = new QTreeWidget();
140 tree_wdg->setHeaderHidden(true);
141 make_tree();
142 splitter->addWidget(tree_wdg);
143
144 help_wdg = new help_widget(splitter);
145 connect(
146 tree_wdg,
147 &QTreeWidget::currentItemChanged,
148 this, &help_dialog::item_changed
149 );
150 help_wdg->layout()->setContentsMargins(0, 0, 0, 0);
151 splitter->addWidget(help_wdg);
152
153 buttons = new QWidget;
154 hbox = new QHBoxLayout;
155 prev_butt = new QPushButton(style()->standardIcon(
156 QStyle::QStyle::SP_ArrowLeft), (""));
157 connect(prev_butt, &QAbstractButton::clicked, this,
158 &help_dialog::history_back);
159 hbox->addWidget(prev_butt);
160 next_butt = new QPushButton(style()->standardIcon(
161 QStyle::QStyle::SP_ArrowRight), (""));
162 connect(next_butt, &QAbstractButton::clicked, this,
163 &help_dialog::history_forward);
164 hbox->addWidget(next_butt);
165 hbox->addStretch(20);
166 but = new QPushButton(style()->standardIcon(
167 QStyle::SP_DialogHelpButton), _("About Qt"));
168 connect(but, &QPushButton::pressed, &QApplication::aboutQt);
169 hbox->addWidget(but, Qt::AlignRight);
170 but = new QPushButton(style()->standardIcon(
171 QStyle::SP_DialogDiscardButton), _("Close"));
172 connect(but, &QPushButton::pressed, this, &QWidget::close);
173 hbox->addWidget(but, Qt::AlignRight);
174 buttons->setLayout(hbox);
175 layout->addWidget(buttons, 0, Qt::AlignBottom);
176
177
178 first = tree_wdg->topLevelItem(0);
179 if (first) {
180 tree_wdg->setCurrentItem(first);
181 }
182}
183
184/**********************************************************************/
187 void help_dialog::update_fonts()
188{
189 help_wdg->update_fonts();
190}
191
192/**********************************************************************/
195 void help_dialog::hideEvent(QHideEvent *event)
196{
197 gui()->qt_settings.help_geometry = saveGeometry();
198 gui()->qt_settings.help_splitter1 = splitter->saveState();
199}
200
201/**********************************************************************/
204 void help_dialog::showEvent(QShowEvent *event)
205{
206 QList<int> sizes;
207
208 if (!gui()->qt_settings.help_geometry.isNull()) {
209 restoreGeometry(gui()->qt_settings.help_geometry);
210 splitter->restoreState(gui()->qt_settings.help_splitter1);
211 } else {
212 QRect rect = QApplication::primaryScreen()->availableGeometry();
213
214 resize((rect.width() * 3) / 5, (rect.height() * 3) / 6);
215 sizes << rect.width() / 10 << rect.width() / 3;
216 splitter->setSizes(sizes);
217 }
218}
219
220/**********************************************************************/
223 void help_dialog::closeEvent(QCloseEvent *event)
224{
225 gui()->qt_settings.help_geometry = saveGeometry();
226 gui()->qt_settings.help_splitter1 = splitter->saveState();
227}
228
229/**********************************************************************/
232 void help_dialog::make_tree()
233{
234 char *title;
235 int dep;
236 int i;
237 QHash<int, QTreeWidgetItem *> hash;
238 QIcon icon;
239 QTreeWidgetItem *item;
240 sprite *spite;
241 struct advance *padvance;
242 struct canvas *pcan;
243 struct extra_type *pextra;
244 struct government *gov;
245 struct impr_type *imp;
246 struct nation_type *nation;
247 struct terrain *pterrain;
248 struct unit_type *f_type;
249 struct drawn_sprite sprs[80];
250
251 help_items_iterate(pitem) {
252 const char *s;
253 int last;
254 title = pitem->topic;
255
256 for (s = pitem->topic; *s == ' '; s++) {
257 /* nothing */
258 }
259
260 item = new QTreeWidgetItem(QStringList(title));
261 topics_map[item] = pitem;
262 dep = s - pitem->topic;
263 hash.insert(dep, item);
264
265 if (dep == 0) {
266 tree_wdg->addTopLevelItem(item);
267 } else {
268 last = dep - 1;
269 spite = nullptr;
270
271 switch (pitem->type) {
272 case HELP_EXTRA:
273 pextra = extra_type_by_translated_name(s);
274 fill_basic_extra_sprite_array(tileset, sprs, pextra);
275 icon = QIcon(*sprs->sprite->pm);
276 break;
277
278 case HELP_GOVERNMENT:
279 gov = government_by_translated_name(s);
280 spite = get_government_sprite(tileset, gov);
281 if (spite) {
282 icon = QIcon(*spite->pm);
283 }
284 break;
285
286 case HELP_IMPROVEMENT:
287 case HELP_WONDER:
288 imp = improvement_by_translated_name(s);
289 spite = get_building_sprite(tileset, imp);
290 if (spite) {
291 icon = QIcon(*spite->pm);
292 }
293 break;
294 case HELP_NATIONS:
295 nation = nation_by_translated_plural(s);
296 spite = get_nation_flag_sprite(tileset, nation);
297 if (spite) {
298 icon = QIcon(*spite->pm);
299 }
300 break;
301 case HELP_TECH:
302 padvance = advance_by_translated_name(s);
303 if (padvance && !is_future_tech(i = advance_number(padvance))) {
304 spite = get_tech_sprite(tileset, i);
305 if (spite) {
306 icon = QIcon(*spite->pm);
307 }
308 }
309 break;
310
311 case HELP_TERRAIN:
312 pterrain = terrain_by_translated_name(s);
313 pcan = terrain_canvas(pterrain);
314 if (pcan) {
315 icon = QIcon(pcan->map_pixmap);
316 delete pcan;
317 }
318 break;
319
320 case HELP_UNIT:
321 f_type = unit_type_by_translated_name(s);
322 if (f_type) {
323 spite = get_unittype_sprite(tileset, f_type, direction8_invalid());
324 }
325 if (spite) {
326 icon = QIcon(*spite->pm);
327 }
328 break;
329
330 default:
331 break;
332 }
333
334 if (!icon.isNull()) {
335 item->setIcon(0, icon);
336 }
337
338 hash.value(last)->addChild(item);
339 }
340 } help_items_iterate_end;
341}
342
343/**********************************************************************/
346 void help_dialog::set_topic(const help_item *topic)
347{
348 help_wdg->set_topic(topic);
349 // Reverse search of the item to select.
350 QHash<QTreeWidgetItem *, const help_item *>::const_iterator
351 i = topics_map.cbegin();
352 for ( ; i != topics_map.cend(); ++i) {
353 if (i.value() == topic) {
354 tree_wdg->setCurrentItem(i.key());
355 break;
356 }
357 }
358}
359
360/**********************************************************************/
363 void help_dialog::history_forward()
364{
365 QTreeWidgetItem *i;
366
367 update_history = false;
368 if (history_pos < item_history.count()) {
369 history_pos++;
370 }
371 i = item_history.value(history_pos);
372 if (i != nullptr) {
373 tree_wdg->setCurrentItem(i);
374 }
375}
376
377/**********************************************************************/
380 void help_dialog::history_back()
381{
382 QTreeWidgetItem *i;
383
384 update_history = false;
385 if (history_pos > 0) {
386 history_pos--;
387 }
388 i = item_history.value(history_pos);
389 if (i != nullptr) {
390 tree_wdg->setCurrentItem(i);
391 }
392}
393
394/**********************************************************************/
397 void help_dialog::update_buttons()
398{
399 if (history_pos == 0) {
400 prev_butt->setEnabled(false);
401 } else {
402 prev_butt->setEnabled(true);
403 }
404 if (history_pos >= item_history.size() - 1) {
405 next_butt->setEnabled(false);
406 } else {
407 next_butt->setEnabled(true);
408 }
409}
410
411/**********************************************************************/
414 void help_dialog::item_changed(QTreeWidgetItem *item, QTreeWidgetItem *prev)
415{
416
417 if (prev == item) {
418 return;
419 }
420
421 help_wdg->set_topic(topics_map[item]);
422
423 if (update_history) {
424 history_pos++;
425 item_history.append(item);
426 } else {
427 update_history = true;
428 }
429 update_buttons();
430}
431
432/**********************************************************************/
435help_widget::help_widget(QWidget *parent) :
436 QWidget(parent),
437 main_widget(NULL), text_browser(NULL), bottom_panel(NULL),
438 info_panel(NULL), splitter(NULL), info_layout(NULL)
439{
440 setup_ui();
441}
442
443/**********************************************************************/
446 help_widget::help_widget(const help_item *topic, QWidget *parent) :
447 QWidget(parent),
448 main_widget(NULL), text_browser(NULL), bottom_panel(NULL),
449 info_panel(NULL), splitter(NULL), info_layout(NULL)
450{
451 setup_ui();
452 set_topic(topic);
453}
454
455/**********************************************************************/
458help_widget::~help_widget() {
459 // Nothing to do here
460}
461
462/**********************************************************************/
465 void help_widget::setup_ui()
466{
467 QVBoxLayout *layout;
468 QHBoxLayout *group_layout;
469
470 layout = new QVBoxLayout();
471 setLayout(layout);
472
473 box_wdg = new QFrame(this);
474 layout->addWidget(box_wdg);
475 group_layout = new QHBoxLayout(box_wdg);
476 box_wdg->setLayout(group_layout);
477 box_wdg->setFrameShape(QFrame::StyledPanel);
478 box_wdg->setFrameShadow(QFrame::Raised);
479
480 title_label = new QLabel(box_wdg);
481 title_label->setProperty(fonts::default_font, "true");
482 group_layout->addWidget(title_label);
483
484 text_browser = new QTextBrowser(this);
485 text_browser->setProperty(fonts::help_text, "true");
486 layout->addWidget(text_browser);
487 main_widget = text_browser;
488
489 update_fonts();
490 splitter_sizes << 200 << 400;
491}
492
493/**********************************************************************/
516 void help_widget::do_layout(bool horizontal)
517{
518 QWidget *right;
519 enum Qt::Orientation main_layout;
520 enum Qt::Orientation bottom_layout;
521
522 if (horizontal) {
523 main_layout = Qt::Horizontal;
524 bottom_layout = Qt::Vertical;
525 } else {
526 main_layout = Qt::Vertical;
527 bottom_layout = Qt::Horizontal;
528 }
529
530 layout()->removeWidget(main_widget);
531 main_widget->setParent(NULL);
532
533 if (bottom_panel) {
534 splitter = new QSplitter(bottom_layout);
535 splitter->addWidget(text_browser);
536 splitter->setStretchFactor(0, 100);
537 splitter->addWidget(bottom_panel);
538 splitter->setStretchFactor(1, 0);
539 right = splitter;
540 } else {
541 right = text_browser;
542 }
543
544 if (info_panel) {
545 splitter = new QSplitter(main_layout);
546 splitter->addWidget(info_panel);
547 splitter->setStretchFactor(0, 25);
548 splitter->addWidget(right);
549 splitter->setStretchFactor(1, 75);
550 splitter->setSizes(splitter_sizes);
551 main_widget = splitter;
552 info_panel->setLayout(info_layout);
553 } else {
554 main_widget = right;
555 }
556
557 layout()->addWidget(main_widget);
558 qobject_cast<QVBoxLayout *>(layout())->setStretchFactor(main_widget, 100);
559}
560
561/**********************************************************************/
564 void help_widget::update_fonts()
565{
566 QList<QWidget *> l;
567 QFont *f;
568
569 l = findChildren<QWidget *>();
570
571 f = fc_font::instance()->get_font(fonts::notify_label);
572 for (int i = 0; i < l.size(); ++i) {
573 if (l.at(i)->property(fonts::help_label).isValid()) {
574 l.at(i)->setFont(*f);
575 }
576 }
577 f = fc_font::instance()->get_font(fonts::help_text);
578 for (int i = 0; i < l.size(); ++i) {
579 if (l.at(i)->property(fonts::help_text).isValid()) {
580 l.at(i)->setFont(*f);
581 }
582 }
583 f = fc_font::instance()->get_font(fonts::default_font);
584 for (int i = 0; i < l.size(); ++i) {
585 if (l.at(i)->property(fonts::default_font).isValid()) {
586 l.at(i)->setFont(*f);
587 }
588 }
589}
590
591/**********************************************************************/
594 void help_widget::undo_layout()
595{
596 // Save the splitter sizes to avoid jumps
597 if (info_panel) {
598 splitter_sizes = splitter->sizes();
599 }
600 // Unparent the widget we want to keep
601 text_browser->setParent(NULL);
602 // Delete everything else
603 if (text_browser != main_widget) {
604 main_widget->deleteLater();
605 }
606 // Reset pointers to defaults
607 main_widget = text_browser;
608 bottom_panel = NULL;
609 info_panel = NULL;
610 splitter = NULL;
611 info_layout = NULL;
612}
613
614/**********************************************************************/
617 void help_widget::show_info_panel()
618{
619 info_panel = new QWidget();
620 info_layout = new QVBoxLayout();
621}
622
623/**********************************************************************/
626 void help_widget::add_info_pixmap(QPixmap *pm, bool shadow)
627{
628 QLabel *label = new QLabel();
629 QGraphicsDropShadowEffect *effect;
630
631 label->setAlignment(Qt::AlignHCenter);
632 label->setPixmap(*pm);
633
634 if (shadow) {
635 effect = new QGraphicsDropShadowEffect(label);
636 effect->setBlurRadius(3);
637 effect->setOffset(0, 2);
638 label->setGraphicsEffect(effect);
639 }
640
641 info_layout->addWidget(label);
642}
643
644/**********************************************************************/
647 void help_widget::add_info_label(const QString &text)
648{
649 QLabel *label = new QLabel(text);
650 label->setWordWrap(true);
651 label->setTextFormat(Qt::RichText);
652 label->setProperty(fonts::help_label, "true");
653 info_layout->addWidget(label);
654}
655
656/**********************************************************************/
664 void help_widget::add_info_progress(const QString &text, int progress,
665 int min, int max, const QString &value)
666{
667 QGridLayout *layout;
668 QLabel *label;
669 QProgressBar *bar;
670 QWidget *wdg;
671
672 wdg = new QWidget();
673 layout = new QGridLayout(wdg);
674 layout->setContentsMargins(0, 0, 0, 0);
675 layout->setVerticalSpacing(0);
676
677 label = new QLabel(text, wdg);
678 layout->addWidget(label, 0, 0);
679 label->setProperty(fonts::help_label, "true");
680 label = new QLabel(wdg);
681 if (value.isEmpty()) {
682 label->setNum(progress);
683 } else {
684 label->setText(value);
685 }
686 label->setProperty(fonts::help_label, "true");
687 layout->addWidget(label, 0, 1, Qt::AlignRight);
688
689 bar = new QProgressBar(wdg);
690 bar->setMaximumHeight(4);
691 bar->setRange(min, max != min ? max : min + 1);
692 bar->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Fixed);
693 bar->setTextVisible(false);
694 bar->setValue(progress);
695 layout->addWidget(bar, 1, 0, 1, 2);
696
697 info_layout->addWidget(wdg);
698}
699
700/**********************************************************************/
703 void help_widget::add_extras_of_act_for_terrain(struct terrain *pterr,
704 enum unit_activity act,
705 const char *label)
706{
707 struct universal for_terr;
708 enum extra_cause cause = activity_to_extra_cause(act);
709
710 for_terr.kind = VUT_TERRAIN;
711 for_terr.value.terrain = pterr;
712
713 extra_type_by_cause_iterate(cause, pextra) {
714 if (pextra->buildable
715 && universal_fulfills_requirements(FALSE, &(pextra->reqs),
716 &for_terr)) {
717 QLabel *tb;
718 QString str;
719
720 tb = new QLabel(this);
721 tb->setProperty(fonts::help_label, "true");
722 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
723 tb->setTextFormat(Qt::RichText);
724
725 str = str + QString(label)
726 + link_me(extra_name_translation(pextra), HELP_EXTRA)
727 + QString(helptext_extra_for_terrain_str(pextra, pterr, act))
728 .toHtmlEscaped()
729 + "\n";
730 tb->setText(str.trimmed());
731 connect(tb, &QLabel::linkActivated,
732 this, &help_widget::anchor_clicked);
733 info_layout->addWidget(tb);
734 }
735 } extra_type_by_cause_iterate_end;
736}
737
738/**********************************************************************/
741QString help_widget::link_me(const char *str, help_page_type hpt)
742{
743 QString s;
744 s = QString(str).toHtmlEscaped().replace(" ", "&nbsp;");
745 return " <a href=" + QString::number(hpt)
746 + "," + s + ">" + s + "</a> ";
747}
748
749/**********************************************************************/
752 void help_widget::add_info_separator()
753{
754 info_layout->addSpacing(2 * info_layout->spacing());
755}
756
757/**********************************************************************/
760 void help_widget::info_panel_done()
761{
762 info_layout->addStretch();
763}
764
765/**********************************************************************/
769 void help_widget::anchor_clicked(const QString &link)
770{
771 QStringList sl;
772 int n;
773 QString st;
774 enum help_page_type type;
775
776 sl = link.split(",");
777 n = sl.at(0).toInt();
778 type = static_cast< help_page_type>(n);
779 st = sl.at(1);
780 st = st.replace("\u00A0", " ");
781
782 if (strcmp(qPrintable(st), REQ_LABEL_NEVER) != 0
783 && strcmp(qPrintable(st),
784 skip_intl_qualifier_prefix(REQ_LABEL_NONE)) != 0
785 && strcmp(qPrintable(st),
786 advance_name_translation(advance_by_number(A_NONE))) != 0) {
787 popup_help_dialog_typed(qPrintable(st), type);
788 }
789}
790
791/**********************************************************************/
794 void help_widget::set_topic(const help_item *topic)
795{
796 char *title = topic->topic;
797 bool orient = true;
798
799 for ( ; *title == ' '; ++title) {
800 // Do nothing
801 }
802 title_label->setTextFormat(Qt::PlainText);
803 title_label->setText(title);
804
805 undo_layout();
806
807 switch (topic->type) {
808 case HELP_ANY:
809 case HELP_MULTIPLIER:
810 case HELP_RULESET:
811 case HELP_TILESET:
812 case HELP_TEXT:
813 set_topic_other(topic, title);
814 break;
815 case HELP_EXTRA:
816 orient = set_topic_extra(topic, title);
817 break;
818 case HELP_GOODS:
819 set_topic_goods(topic, title);
820 break;
821 case HELP_GOVERNMENT:
822 set_topic_government(topic, title);
823 break;
824 case HELP_IMPROVEMENT:
825 case HELP_WONDER:
826 set_topic_building(topic, title);
827 break;
828 case HELP_NATIONS:
829 set_topic_nation(topic, title);
830 break;
831 case HELP_SPECIALIST:
832 set_topic_specialist(topic, title);
833 break;
834 case HELP_TECH:
835 set_topic_tech(topic, title);
836 break;
837 case HELP_TERRAIN:
838 set_topic_terrain(topic, title);
839 break;
840 case HELP_UNIT:
841 set_topic_unit(topic, title);
842 break;
843 case HELP_LAST: // Just to avoid warning
844 break;
845 }
846
847 do_layout(orient);
848}
849
850/**********************************************************************/
853 void help_widget::set_bottom_panel(QWidget *widget) {
854 bottom_panel = widget;
855}
856
857/**********************************************************************/
860 void help_widget::set_topic_other(const help_item *topic,
861 const char *title)
862{
863 if (topic->text) {
864 text_browser->setPlainText(topic->text);
865 } else {
866 text_browser->setPlainText(""); // Something better to do ?
867 }
868}
869
870/**********************************************************************/
873 void help_widget::set_topic_unit(const help_item *topic,
874 const char *title)
875{
876 char buffer[MAX_HELP_TEXT_SIZE];
877 int upkeep, max_upkeep;
878 struct advance *tech;
879 struct canvas *canvas;
880 const struct unit_type *obsolete;
881 struct unit_type *utype, *max_utype;
882 QList<int> list;
883 QString str;
884
885 utype = unit_type_by_translated_name(title);
886 if (utype) {
887 helptext_unit(buffer, sizeof(buffer), client.conn.playing,
888 topic->text, utype);
889 text_browser->setPlainText(buffer);
890
891 // Create information panel
892 show_info_panel();
893 max_utype = uclass_max_values(utype->uclass);
894
895 // Unit icon
896 canvas = qtg_canvas_create(
897 tileset_full_tile_width(tileset),
898 tileset_full_tile_height(tileset)
899 );
900 canvas->map_pixmap.fill(Qt::transparent);
901 put_unittype(utype, canvas, 1.0f, 0, 0);
902 add_info_pixmap(&canvas->map_pixmap);
903 qtg_canvas_free(canvas);
904
905 add_info_progress(_("Attack:"), utype->attack_strength, 0,
906 max_utype->attack_strength);
907 add_info_progress(_("Defense:"), utype->defense_strength,
908 0, max_utype->defense_strength);
909 add_info_progress(_("Moves:"), utype->move_rate, 0, max_utype->move_rate,
910 move_points_text(utype->move_rate, true));
911
912 add_info_separator();
913
914 add_info_progress(_("Hitpoints:"), utype->hp, 0, max_utype->hp);
915 add_info_progress(_("Cost:"), utype_build_shield_cost_base(utype),
916 0, utype_build_shield_cost_base(max_utype));
917 add_info_progress(_("Firepower:"), utype->firepower, 0,
918 max_utype->firepower);
919
920 // Upkeep
921 upkeep = utype->upkeep[O_FOOD] + utype->upkeep[O_GOLD]
922 + utype->upkeep[O_LUXURY] + utype->upkeep[O_SCIENCE]
923 + utype->upkeep[O_SHIELD] + utype->upkeep[O_TRADE]
924 + utype->happy_cost;
925 max_upkeep = max_utype->upkeep[O_FOOD] + max_utype->upkeep[O_GOLD]
926 + max_utype->upkeep[O_LUXURY] + max_utype->upkeep[O_SCIENCE]
927 + max_utype->upkeep[O_SHIELD] + max_utype->upkeep[O_TRADE]
928 + max_utype->happy_cost;
929 add_info_progress(_("Basic upkeep:"), upkeep, 0, max_upkeep,
930 helptext_unit_upkeep_str(utype));
931
932 add_info_separator();
933
934 // Tech requirement
935 tech = utype->require_advance;
936 if (tech && tech != advance_by_number(A_NONE)) {
937 QLabel *tb;
938
939 tb = new QLabel(this);
940 /* TRANS: this and similar literal strings interpreted as (Qt) HTML */
941 str = _("Requires");
942 str = "<b>" + str + "</b> "
943 + link_me(advance_name_translation(tech), HELP_TECH);
944
945 tb->setProperty(fonts::help_label, "true");
946 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
947 tb->setTextFormat(Qt::RichText);
948 tb->setText(str.trimmed());
949 connect(tb, &QLabel::linkActivated,
950 this, &help_widget::anchor_clicked);
951 info_layout->addWidget(tb);
952 } else {
953 add_info_label(_("No technology required."));
954 }
955
956 // Obsolescence
957 obsolete = utype->obsoleted_by;
958 if (obsolete) {
959 tech = obsolete->require_advance;
960 if (tech && tech != advance_by_number(A_NONE)) {
961 QLabel *tb;
962
963 tb = new QLabel(this);
964 str = _("Obsoleted by");
965 str = "<b>" + str + "</b> "
966 + link_me(utype_name_translation(obsolete), HELP_UNIT)
967 + "(" + link_me(advance_name_translation(tech), HELP_TECH)
968 + ")";
969 tb->setProperty(fonts::help_label, "true");
970 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
971 tb->setTextFormat(Qt::RichText);
972 tb->setText(str.trimmed());
973 connect(tb, &QLabel::linkActivated,
974 this, &help_widget::anchor_clicked);
975 info_layout->addWidget(tb);
976 } else {
977 add_info_label(
978 // TRANS: Current unit obsoleted by other unit
979 QString(_("Obsoleted by %1."))
980 .arg(utype_name_translation(obsolete))
981 .toHtmlEscaped());
982 }
983 } else {
984 add_info_label(_("Never obsolete."));
985 }
986
987 info_panel_done();
988
989 delete max_utype;
990 } else {
991 set_topic_other(topic, title);
992 }
993}
994
995/**********************************************************************/
998 void help_widget::set_topic_building(const help_item *topic,
999 const char *title)
1000{
1001 char buffer[MAX_HELP_TEXT_SIZE];
1002 int type, value;
1003 struct sprite *spr;
1004 struct impr_type *itype = improvement_by_translated_name(title);
1005 char req_buf[512];
1006 QString str, s1, s2;
1007 QLabel *tb;
1008
1009 if (itype) {
1010 helptext_building(buffer, sizeof(buffer), client.conn.playing,
1011 topic->text, itype);
1012 text_browser->setPlainText(buffer);
1013 show_info_panel();
1014 spr = get_building_sprite(tileset, itype);
1015 if (spr) {
1016 add_info_pixmap(spr->pm);
1017 }
1018 str = _("Base Cost:");
1019 str = "<b>" + str + "</b>" + " "
1020 + QString::number(impr_base_build_shield_cost(itype))
1021 .toHtmlEscaped();
1022 add_info_label(str);
1023 if (!is_great_wonder(itype)) {
1024 str = _("Upkeep:");
1025 str = "<b>" + str + "</b>" + " "
1026 + QString::number(itype->upkeep).toHtmlEscaped();
1027 add_info_label(str);
1028 }
1029
1030 requirement_vector_iterate(&itype->reqs, preq) {
1031 if (!preq->present) {
1032 continue;
1033 }
1034 universal_extraction(&preq->source, &type, &value);
1035 if (type == VUT_ADVANCE) {
1036 s1 = link_me(universal_name_translation(&preq->source, req_buf,
1037 sizeof(req_buf)), HELP_TECH);
1038 } else if (type == VUT_GOVERNMENT) {
1039 s1 = link_me(universal_name_translation(&preq->source, req_buf,
1040 sizeof(req_buf)), HELP_GOVERNMENT);
1041 } else if (type == VUT_TERRAIN) {
1042 s1 = link_me(universal_name_translation(&preq->source, req_buf,
1043 sizeof(req_buf)), HELP_TERRAIN);
1044 }
1045 break;
1046 } requirement_vector_iterate_end;
1047
1048 if (!s1.isEmpty()) {
1049 tb = new QLabel(this);
1050 str = _("Requirement:");
1051 str = "<b>" + str + "</b> " + s1;
1052 tb->setProperty(fonts::help_label, "true");
1053 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1054 tb->setTextFormat(Qt::RichText);
1055 tb->setText(str.trimmed());
1056 connect(tb, &QLabel::linkActivated,
1057 this, &help_widget::anchor_clicked);
1058 info_layout->addWidget(tb);
1059 }
1060
1061 requirement_vector_iterate(&itype->obsolete_by, pobs) {
1062 if (pobs->source.kind == VUT_ADVANCE) {
1063 s2 = link_me(advance_name_translation(pobs->source.value.advance),
1064 HELP_TECH);
1065 break;
1066 }
1067 } requirement_vector_iterate_end;
1068
1069 str = _("Obsolete by:");
1070 str = "<b>" + str + "</b> " + s2;
1071 if (!s2.isEmpty()) {
1072 tb = new QLabel(this);
1073 tb->setProperty(fonts::help_label, "true");
1074 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1075 tb->setTextFormat(Qt::RichText);
1076 tb->setText(str.trimmed());
1077 connect(tb, &QLabel::linkActivated,
1078 this, &help_widget::anchor_clicked);
1079 info_layout->addWidget(tb);
1080 }
1081 info_panel_done();
1082 } else {
1083 set_topic_other(topic, title);
1084 }
1085}
1086
1087/**********************************************************************/
1090 void help_widget::set_topic_tech(const help_item *topic,
1091 const char *title)
1092{
1093 char buffer[MAX_HELP_TEXT_SIZE];
1094 struct sprite *spr;
1095 QLabel *tb;
1096 struct advance *padvance = advance_by_translated_name(title);
1097 QString str;
1098
1099 if (padvance) {
1100 int n = advance_number(padvance);
1101 if (!is_future_tech(n)) {
1102
1103 show_info_panel();
1104 spr = get_tech_sprite(tileset, n);
1105 if (spr) {
1106 add_info_pixmap(spr->pm);
1107 }
1108
1109 governments_iterate(pgov) {
1110 requirement_vector_iterate(&pgov->reqs, preq) {
1111 if (VUT_ADVANCE == preq->source.kind
1112 && preq->source.value.advance == padvance) {
1113 tb = new QLabel(this);
1114 tb->setProperty(fonts::help_label, "true");
1115 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1116 tb->setTextFormat(Qt::RichText);
1117 str = _("Allows");
1118 str = "<b>" + str + "</b> "
1119 + link_me(government_name_translation(pgov), HELP_GOVERNMENT);
1120 tb->setText(str.trimmed());
1121 connect(tb, &QLabel::linkActivated,
1122 this, &help_widget::anchor_clicked);
1123 info_layout->addWidget(tb);
1124 }
1125 } requirement_vector_iterate_end;
1126 } governments_iterate_end;
1127
1128 improvement_iterate(pimprove) {
1129 if (valid_improvement(pimprove)) {
1130 requirement_vector_iterate(&pimprove->reqs, preq) {
1131 if (VUT_ADVANCE == preq->source.kind
1132 && preq->source.value.advance == padvance) {
1133 str = _("Allows");
1134 str = "<b>" + str + "</b> "
1135 + link_me(improvement_name_translation(pimprove),
1136 is_great_wonder(pimprove) ? HELP_WONDER
1137 : HELP_IMPROVEMENT);
1138 tb = new QLabel(this);
1139 tb->setProperty(fonts::help_label, "true");
1140 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1141 tb->setTextFormat(Qt::RichText);
1142 tb->setText(str.trimmed());
1143 connect(tb, &QLabel::linkActivated,
1144 this, &help_widget::anchor_clicked);
1145 info_layout->addWidget(tb);
1146 }
1147 } requirement_vector_iterate_end;
1148
1149 requirement_vector_iterate(&pimprove->obsolete_by, pobs) {
1150 if (pobs->source.kind == VUT_ADVANCE
1151 && pobs->source.value.advance == padvance) {
1152 str = _("Obsoletes");
1153 str = "<b>" + str + "</b> "
1154 + link_me(improvement_name_translation(pimprove),
1155 is_great_wonder(pimprove) ? HELP_WONDER
1156 : HELP_IMPROVEMENT);
1157 tb = new QLabel(this);
1158 tb->setProperty(fonts::help_label, "true");
1159 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1160 tb->setTextFormat(Qt::RichText);
1161 tb->setText(str.trimmed());
1162 connect(tb, &QLabel::linkActivated,
1163 this, &help_widget::anchor_clicked);
1164 info_layout->addWidget(tb);
1165 }
1166 } requirement_vector_iterate_end;
1167 }
1168 } improvement_iterate_end;
1169
1170 unit_type_iterate(punittype) {
1171 if (padvance != punittype->require_advance) {
1172 continue;
1173 }
1174 str = _("Allows");
1175 str = "<b>" + str + "</b> "
1176 + link_me(utype_name_translation(punittype), HELP_UNIT);
1177 tb = new QLabel(this);
1178 tb->setProperty(fonts::help_label, "true");
1179 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1180 tb->setTextFormat(Qt::RichText);
1181 tb->setText(str.trimmed());
1182 connect(tb, &QLabel::linkActivated,
1183 this, &help_widget::anchor_clicked);
1184 info_layout->addWidget(tb);
1185 } unit_type_iterate_end;
1186
1187 info_panel_done();
1188 helptext_advance(buffer, sizeof(buffer), client.conn.playing,
1189 topic->text, n);
1190 text_browser->setPlainText(buffer);
1191
1192 }
1193 } else {
1194 set_topic_other(topic, title);
1195 }
1196}
1197
1198/**********************************************************************/
1201 static canvas *terrain_canvas(struct terrain *terrain,
1202 const struct extra_type *resource,
1203 enum extra_cause cause)
1204{
1205 struct canvas *canvas;
1206 struct drawn_sprite sprs[80];
1207 int canvas_y, count, i, width, height;
1208 struct extra_type *pextra;
1209
1210 width = tileset_full_tile_width(tileset);
1211 height = tileset_full_tile_height(tileset);
1212 canvas_y = height - tileset_tile_height(tileset);
1213
1214 canvas = qtg_canvas_create(width, height);
1215 canvas->map_pixmap.fill(Qt::transparent);
1216 for (i = 0; i < 3; ++i) {
1217 count = fill_basic_terrain_layer_sprite_array(tileset, sprs,
1218 i, terrain);
1219 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1220 }
1221
1222 pextra = NULL;
1223 if (cause != EC_COUNT) {
1224 extra_type_by_cause_iterate(cause, e) {
1225 pextra = e;
1226 break;
1227 } extra_type_by_cause_iterate_end;
1228
1229 count = fill_basic_extra_sprite_array(tileset, sprs, pextra);
1230 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1231 }
1232
1233 if (resource != NULL) {
1234 count = fill_basic_extra_sprite_array(tileset, sprs, resource);
1235 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1236 }
1237
1238 return canvas;
1239}
1240
1241/**********************************************************************/
1245QLayout *help_widget::create_terrain_widget(const QString &title,
1246 const struct canvas *image,
1247 const QString &legend,
1248 const QString &tooltip)
1249{
1250 QGraphicsDropShadowEffect *effect;
1251 QLabel *label;
1252 QGridLayout *layout = new QGridLayout();
1253
1254 label = new QLabel();
1255 effect = new QGraphicsDropShadowEffect(label);
1256 effect->setBlurRadius(3);
1257 effect->setOffset(0, 2);
1258 label->setGraphicsEffect(effect);
1259 label->setPixmap(image->map_pixmap);
1260 layout->addWidget(label, 0, 0, 2, 1);
1261
1262 label = new QLabel(title);
1263 label->setTextFormat(Qt::PlainText);
1264 layout->addWidget(label, 0, 1, Qt::AlignBottom);
1265 label->setProperty(fonts::default_font, "true");
1266
1267 label = new QLabel(legend);
1268 label->setTextFormat(Qt::PlainText);
1269 layout->addWidget(label, 1, 1, Qt::AlignTop);
1270 label->setProperty(fonts::help_label, "true");
1271
1272 if (!tooltip.isEmpty()) {
1273 label->setToolTip(tooltip);
1274 label->setCursor(Qt::WhatsThisCursor);
1275 }
1276
1277 layout->setColumnStretch(0, 0);
1278 layout->setColumnStretch(1, 100);
1279
1280 return layout;
1281}
1282
1283/**********************************************************************/
1286 void help_widget::set_topic_terrain(const help_item *topic,
1287 const char *title)
1288{
1289 char buffer[MAX_HELP_TEXT_SIZE];
1290 struct terrain *pterrain, *max;
1291 QVBoxLayout *vbox;
1292 bool show_panel = false;
1293 QScrollArea *area;
1294 QWidget *panel;
1295 QString str;
1296
1297 pterrain = terrain_by_translated_name(title);
1298 if (pterrain) {
1299 struct universal for_terr;
1300 canvas *canvas;
1301
1302 for_terr.kind = VUT_TERRAIN;
1303 for_terr.value.terrain = pterrain;
1304
1305 helptext_terrain(buffer, sizeof(buffer), client.conn.playing,
1306 topic->text, pterrain);
1307 text_browser->setPlainText(buffer);
1308
1309 // Create information panel
1310 show_info_panel();
1311 max = terrain_max_values();
1312
1313 // Create terrain icon. Use shadow to help distinguish terrain.
1314 canvas = terrain_canvas(pterrain);
1315 add_info_pixmap(&canvas->map_pixmap, true);
1316 qtg_canvas_free(canvas);
1317
1318 add_info_progress(_("Food:"), pterrain->output[O_FOOD],
1319 0, max->output[O_FOOD]);
1320 add_info_progress(_("Production:"), pterrain->output[O_SHIELD],
1321 0, max->output[O_SHIELD]);
1322 add_info_progress(_("Trade:"), pterrain->output[O_TRADE],
1323 0, max->output[O_TRADE]);
1324
1325 add_info_separator();
1326
1327 add_info_progress(_("Move cost:"), pterrain->movement_cost,
1328 0, max->movement_cost);
1329 add_info_progress(_("Defense bonus:"), MIN(100, pterrain->defense_bonus),
1330 0, 100,
1331 // TRANS: Display a percentage, eg "50%".
1332 QString(_("%1%")).arg(pterrain->defense_bonus));
1333
1334 add_info_separator();
1335
1336 if (pterrain->cultivate_result != T_NONE
1337 && action_id_univs_not_blocking(ACTION_CULTIVATE,
1338 NULL, &for_terr)) {
1339 QLabel *tb;
1340 char cult_buffer[1024];
1341
1342 fc_snprintf(cult_buffer, sizeof(cult_buffer), PL_("%d turn", "%d turns",
1343 pterrain->cultivate_time),
1344 pterrain->cultivate_time);
1345 str = N_("Cultiv. Rslt/Time:");;
1346 str = str + link_me(terrain_name_translation(pterrain->cultivate_result),
1347 HELP_TERRAIN)
1348 + QString(cult_buffer).toHtmlEscaped();
1349 tb = new QLabel(this);
1350 tb->setProperty(fonts::help_label, "true");
1351 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1352 tb->setTextFormat(Qt::RichText);
1353 tb->setText(str.trimmed());
1354 connect(tb, &QLabel::linkActivated,
1355 this, &help_widget::anchor_clicked);
1356 info_layout->addWidget(tb);
1357 }
1358
1359 if (pterrain->plant_result != T_NONE
1360 && action_id_univs_not_blocking(ACTION_PLANT, NULL, &for_terr)) {
1361 QLabel *tb;
1362 char plant_buffer[1024];
1363
1364 fc_snprintf(plant_buffer, sizeof(plant_buffer), PL_("%d turn", "%d turns",
1365 pterrain->plant_time),
1366 pterrain->plant_time);
1367 str = N_("Plant Rslt/Time:");;
1368 str = str + link_me(terrain_name_translation(pterrain->plant_result),
1369 HELP_TERRAIN)
1370 + QString(plant_buffer).toHtmlEscaped();
1371 tb = new QLabel(this);
1372 tb->setProperty(fonts::help_label, "true");
1373 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1374 tb->setTextFormat(Qt::RichText);
1375 tb->setText(str.trimmed());
1376 connect(tb, &QLabel::linkActivated,
1377 this, &help_widget::anchor_clicked);
1378 info_layout->addWidget(tb);
1379 }
1380
1381 if (pterrain->transform_result != T_NONE
1382 && action_id_univs_not_blocking(ACTION_TRANSFORM_TERRAIN,
1383 NULL, &for_terr)) {
1384 QLabel *tb;
1385 char tf_buffer[1024];
1386
1387 fc_snprintf(tf_buffer, sizeof(tf_buffer), PL_("%d turn", "%d turns",
1388 pterrain->transform_time),
1389 pterrain->transform_time);
1390 str = N_("Trans. Rslt/Time:");
1391 str = str + link_me(terrain_name_translation(pterrain->transform_result),
1392 HELP_TERRAIN)
1393 + QString(tf_buffer).toHtmlEscaped();
1394 tb = new QLabel(this);
1395 tb->setProperty(fonts::help_label, "true");
1396 tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse);
1397 tb->setTextFormat(Qt::RichText);
1398 tb->setText(str.trimmed());
1399 connect(tb, &QLabel::linkActivated,
1400 this, &help_widget::anchor_clicked);
1401 info_layout->addWidget(tb);
1402 }
1403
1404 if (action_id_univs_not_blocking(ACTION_IRRIGATE, NULL, &for_terr)) {
1405 /* TRANS: this and similar literal strings interpreted as (Qt) HTML */
1406 add_extras_of_act_for_terrain(pterrain, ACTIVITY_IRRIGATE, _("Build as irrigation"));
1407 }
1408 if (action_id_univs_not_blocking(ACTION_MINE, NULL, &for_terr)) {
1409 add_extras_of_act_for_terrain(pterrain, ACTIVITY_MINE, _("Build as mine"));
1410 }
1411 if (pterrain->road_time != 0
1412 && action_id_univs_not_blocking(ACTION_ROAD, NULL, &for_terr)) {
1413 add_extras_of_act_for_terrain(pterrain, ACTIVITY_GEN_ROAD, _("Build as road"));
1414 }
1415 if (pterrain->base_time != 0
1416 && action_id_univs_not_blocking(ACTION_BASE, NULL, &for_terr)) {
1417 add_extras_of_act_for_terrain(pterrain, ACTIVITY_BASE, _("Build as base"));
1418 }
1419
1420 info_panel_done();
1421
1422 // Create bottom widget
1423 panel = new QWidget();
1424 vbox = new QVBoxLayout(panel);
1425
1426 if (*(pterrain->resources)) {
1427 struct extra_type **r;
1428
1429 for (r = pterrain->resources; *r; r++) {
1430 canvas = terrain_canvas(pterrain, *r);
1431 vbox->addLayout(create_terrain_widget(
1432 extra_name_translation(*r),
1433 canvas,
1434 // TRANS: %1 food, %2 shields, %3 trade
1435 QString(_("Tile output becomes %1, %2, %3."))
1436 .arg(pterrain->output[O_FOOD] + (*r)->data.resource->output[O_FOOD])
1437 .arg(pterrain->output[O_SHIELD] + (*r)->data.resource->output[O_SHIELD])
1438 .arg(pterrain->output[O_TRADE] + (*r)->data.resource->output[O_TRADE]),
1439 // TRANS: Tooltip decorating strings like "1, 2, 3".
1440 _("Output (Food, Shields, Trade) of a tile where the resource is "
1441 "present.")));
1442 qtg_canvas_free(canvas);
1443 show_panel = true;
1444 }
1445 }
1446
1447 vbox->addStretch(100);
1448 vbox->setSizeConstraint(QLayout::SetMinimumSize);
1449 if (show_panel) {
1450 area = new QScrollArea();
1451 area->setWidget(panel);
1452 set_bottom_panel(area);
1453 } else {
1454 panel->deleteLater();
1455 }
1456
1457 delete max;
1458 } else {
1459 set_topic_other(topic, title);
1460 }
1461}
1462
1463/**********************************************************************/
1468 bool help_widget::set_topic_extra(const help_item *topic,
1469 const char *title)
1470{
1471 char buffer[MAX_HELP_TEXT_SIZE];
1472 struct extra_type *pextra = extra_type_by_translated_name(title);
1473
1474 if (pextra) {
1475 canvas *canvas;
1476 int canvas_y, count, width, height;
1477 struct drawn_sprite sprs[80];
1478
1479 helptext_extra(buffer, sizeof(buffer), client.conn.playing,
1480 topic->text, pextra);
1481 text_browser->setPlainText(buffer);
1482
1483 // Create information panel
1484 show_info_panel();
1485
1486 // Create extra icon.
1487 width = tileset_full_tile_width(tileset);
1488 height = tileset_full_tile_height(tileset);
1489 canvas_y = height - tileset_tile_height(tileset);
1490 canvas = qtg_canvas_create(width, height);
1491 canvas->map_pixmap.fill(Qt::transparent);
1492 count = fill_basic_extra_sprite_array(tileset, sprs, pextra);
1493 put_drawn_sprites(canvas, 1.0f, 0, canvas_y, count, sprs, false);
1494 add_info_pixmap(&canvas->map_pixmap, true);
1495 qtg_canvas_free(canvas);
1496
1497 return false;
1498 } else {
1499 set_topic_other(topic, title);
1500
1501 return true;
1502 }
1503}
1504
1505/**********************************************************************/
1508 void help_widget::set_topic_specialist(const help_item *topic,
1509 const char *title)
1510{
1511 char buffer[MAX_HELP_TEXT_SIZE];
1512 struct specialist *pspec = specialist_by_translated_name(title);
1513 if (pspec) {
1514 helptext_specialist(buffer, sizeof(buffer), client.conn.playing,
1515 topic->text, pspec);
1516 text_browser->setPlainText(buffer);
1517 } else {
1518 set_topic_other(topic, title);
1519 }
1520}
1521
1522/**********************************************************************/
1525 void help_widget::set_topic_government(const help_item *topic,
1526 const char *title)
1527{
1528 char buffer[MAX_HELP_TEXT_SIZE];
1529 struct government *pgov = government_by_translated_name(title);
1530 if (pgov) {
1531 helptext_government(buffer, sizeof(buffer), client.conn.playing,
1532 topic->text, pgov);
1533 text_browser->setPlainText(buffer);
1534 } else {
1535 set_topic_other(topic, title);
1536 }
1537}
1538
1539/**********************************************************************/
1542 void help_widget::set_topic_nation(const help_item *topic,
1543 const char *title)
1544{
1545 char buffer[MAX_HELP_TEXT_SIZE];
1546 struct nation_type *pnation = nation_by_translated_plural(title);
1547 if (pnation) {
1548 helptext_nation(buffer, sizeof(buffer), pnation, topic->text);
1549 text_browser->setPlainText(buffer);
1550 } else {
1551 set_topic_other(topic, title);
1552 }
1553}
1554
1555/**********************************************************************/
1558 void help_widget::set_topic_goods(const help_item* topic,
1559 const char *title)
1560{
1561 char buffer[MAX_HELP_TEXT_SIZE];
1562 struct goods_type *pgood = goods_by_translated_name(title);
1563 if (pgood) {
1564 helptext_goods(buffer, sizeof(buffer), client.conn.playing,
1565 topic->text, pgood);
1566 text_browser->setText(buffer);
1567 } else {
1568 set_topic_other(topic, title);
1569 }
1570}
1571
1572/**********************************************************************/
1582 struct terrain *help_widget::terrain_max_values()
1583{
1584 Terrain_type_id i, count;
1585 struct terrain *terrain;
1586 struct terrain *max = new struct terrain;
1587 max->base_time = 0;
1588 max->clean_fallout_time = 0;
1589 max->clean_pollution_time = 0;
1590 max->defense_bonus = 0;
1591 max->irrigation_food_incr = 0;
1592 max->irrigation_time = 0;
1593 max->mining_shield_incr = 0;
1594 max->mining_time = 0;
1595 max->movement_cost = 0;
1596 max->output[O_FOOD] = 0;
1597 max->output[O_GOLD] = 0;
1598 max->output[O_LUXURY] = 0;
1599 max->output[O_SCIENCE] = 0;
1600 max->output[O_SHIELD] = 0;
1601 max->output[O_TRADE] = 0;
1602 max->pillage_time = 0;
1603 max->road_output_incr_pct[O_FOOD] = 0;
1604 max->road_output_incr_pct[O_GOLD] = 0;
1605 max->road_output_incr_pct[O_LUXURY] = 0;
1606 max->road_output_incr_pct[O_SCIENCE] = 0;
1607 max->road_output_incr_pct[O_SHIELD] = 0;
1608 max->road_output_incr_pct[O_TRADE] = 0;
1609 max->road_time = 0;
1610 max->transform_time = 0;
1611 count = terrain_count();
1612 for (i = 0; i < count; ++i) {
1613 terrain = terrain_by_number(i);
1614#define SET_MAX(v) \
1615 max->v = max->v > terrain->v ? max->v : terrain->v
1616 SET_MAX(base_time);
1617 SET_MAX(clean_fallout_time);
1618 SET_MAX(clean_pollution_time);
1619 SET_MAX(defense_bonus);
1620 SET_MAX(irrigation_food_incr);
1621 SET_MAX(irrigation_time);
1622 SET_MAX(mining_shield_incr);
1623 SET_MAX(mining_time);
1624 SET_MAX(movement_cost);
1625 SET_MAX(output[O_FOOD]);
1626 SET_MAX(output[O_GOLD]);
1627 SET_MAX(output[O_LUXURY]);
1628 SET_MAX(output[O_SCIENCE]);
1629 SET_MAX(output[O_SHIELD]);
1630 SET_MAX(output[O_TRADE]);
1631 SET_MAX(pillage_time);
1632 SET_MAX(road_output_incr_pct[O_FOOD]);
1633 SET_MAX(road_output_incr_pct[O_GOLD]);
1634 SET_MAX(road_output_incr_pct[O_LUXURY]);
1635 SET_MAX(road_output_incr_pct[O_SCIENCE]);
1636 SET_MAX(road_output_incr_pct[O_SHIELD]);
1637 SET_MAX(road_output_incr_pct[O_TRADE]);
1638 SET_MAX(road_time);
1639 SET_MAX(transform_time);
1640#undef SET_MAX
1641 }
1642 return max;
1643}
1644
1645/**********************************************************************/
1654 struct unit_type *help_widget::uclass_max_values(struct unit_class *uclass)
1655{
1656 struct unit_type *max = new struct unit_type;
1657
1658 max->uclass = uclass;
1659 max->attack_strength = 0;
1660 max->bombard_rate = 0;
1661 max->build_cost = 0;
1662 max->city_size = 0;
1663 max->convert_time = 0;
1664 max->defense_strength = 0;
1665 max->firepower = 0;
1666 max->fuel = 0;
1667 max->happy_cost = 0;
1668 max->hp = 0;
1669 max->move_rate = 0;
1670 max->pop_cost = 0;
1671 max->upkeep[O_FOOD] = 0;
1672 max->upkeep[O_GOLD] = 0;
1673 max->upkeep[O_LUXURY] = 0;
1674 max->upkeep[O_SCIENCE] = 0;
1675 max->upkeep[O_SHIELD] = 0;
1676 max->upkeep[O_TRADE] = 0;
1677 max->vision_radius_sq = 0;
1678
1679 unit_type_iterate(utype) {
1680 if (utype->uclass == uclass) {
1681
1682#define SET_MAX(v) \
1683 max->v = max->v > utype->v ? max->v : utype->v
1684
1685 SET_MAX(attack_strength);
1686 SET_MAX(bombard_rate);
1687 SET_MAX(build_cost);
1688 SET_MAX(city_size);
1689 SET_MAX(convert_time);
1690 SET_MAX(defense_strength);
1691 SET_MAX(firepower);
1692 SET_MAX(fuel);
1693 SET_MAX(happy_cost);
1694 SET_MAX(hp);
1695 SET_MAX(move_rate);
1696 SET_MAX(pop_cost);
1697 SET_MAX(upkeep[O_FOOD]);
1698 SET_MAX(upkeep[O_GOLD]);
1699 SET_MAX(upkeep[O_LUXURY]);
1700 SET_MAX(upkeep[O_SCIENCE]);
1701 SET_MAX(upkeep[O_SHIELD]);
1702 SET_MAX(upkeep[O_TRADE]);
1703 SET_MAX(vision_radius_sq);
1704
1705#undef SET_MAX
1706
1707 }
1708 } unit_type_iterate_end
1709
1710 return max;
1711}
action_id_univs_not_blocking
#define action_id_univs_not_blocking(act_id, act_uni, tgt_uni)
Definition actions.h:950
str
#define str
Definition astring.c:76
n
#define n
Definition astring.c:77
qtg_canvas_free
void qtg_canvas_free(struct canvas *store)
Definition canvas.cpp:47
qtg_canvas_create
struct canvas * qtg_canvas_create(int width, int height)
Definition canvas.cpp:35
height
struct canvas int int struct sprite int int int int height
Definition canvas_g.h:44
canvas_y
struct canvas int int canvas_y
Definition canvas_g.h:43
width
struct canvas int int struct sprite int int int width
Definition canvas_g.h:44
fc_font::instance
static fc_font * instance()
Definition fonts.cpp:41
fc_font::get_font
QFont * get_font(QString name)
Definition fonts.cpp:63
help_dialog
Definition helpdlg.h:47
help_dialog::tree_wdg
QTreeWidget * tree_wdg
Definition helpdlg.h:51
help_dialog::hideEvent
void hideEvent(QHideEvent *event)
Definition helpdlg.cpp:195
help_dialog::history_pos
int history_pos
Definition helpdlg.h:56
help_dialog::update_history
bool update_history
Definition helpdlg.h:61
help_dialog::prev_butt
QPushButton * prev_butt
Definition helpdlg.h:49
help_dialog::help_dialog
help_dialog(QWidget *parent=0)
Definition helpdlg.cpp:123
help_dialog::history_forward
void history_forward()
Definition helpdlg.cpp:363
help_dialog::next_butt
QPushButton * next_butt
Definition helpdlg.h:50
help_dialog::set_topic
void set_topic(const help_item *item)
Definition helpdlg.cpp:346
help_dialog::help_wdg
help_widget * help_wdg
Definition helpdlg.h:52
help_dialog::make_tree
void make_tree()
Definition helpdlg.cpp:232
help_dialog::showEvent
void showEvent(QShowEvent *event)
Definition helpdlg.cpp:204
help_dialog::topics_map
QHash< QTreeWidgetItem *, const help_item * > topics_map
Definition helpdlg.h:55
help_dialog::item_changed
void item_changed(QTreeWidgetItem *item, QTreeWidgetItem *prev)
Definition helpdlg.cpp:414
help_dialog::update_fonts
void update_fonts()
Definition helpdlg.cpp:187
help_dialog::splitter
QSplitter * splitter
Definition helpdlg.h:53
help_dialog::closeEvent
void closeEvent(QCloseEvent *event)
Definition helpdlg.cpp:223
help_dialog::update_buttons
void update_buttons()
Definition helpdlg.cpp:397
help_dialog::item_history
QList< QTreeWidgetItem * > item_history
Definition helpdlg.h:54
help_dialog::history_back
void history_back()
Definition helpdlg.cpp:380
help_widget
Definition helpdlg.h:80
help_widget::add_info_separator
void add_info_separator()
Definition helpdlg.cpp:752
help_widget::link_me
QString link_me(const char *str, help_page_type hpt)
Definition helpdlg.cpp:741
help_widget::show_info_panel
void show_info_panel()
Definition helpdlg.cpp:617
help_widget::update_fonts
void update_fonts()
Definition helpdlg.cpp:564
help_widget::set_topic_specialist
void set_topic_specialist(const help_item *item, const char *title)
Definition helpdlg.cpp:1508
help_widget::info_panel_done
void info_panel_done()
Definition helpdlg.cpp:760
help_widget::add_info_progress
void add_info_progress(const QString &label, int progress, int min, int max, const QString &value=QString())
Definition helpdlg.cpp:664
help_widget::splitter
QSplitter * splitter
Definition helpdlg.h:89
help_widget::anchor_clicked
void anchor_clicked(const QString &link)
Definition helpdlg.cpp:769
help_widget::set_bottom_panel
void set_bottom_panel(QWidget *widget)
Definition helpdlg.cpp:853
help_widget::~help_widget
~help_widget()
Definition helpdlg.cpp:458
help_widget::main_widget
QWidget * main_widget
Definition helpdlg.h:85
help_widget::setup_ui
void setup_ui()
Definition helpdlg.cpp:465
help_widget::add_info_pixmap
void add_info_pixmap(QPixmap *pm, bool shadow=false)
Definition helpdlg.cpp:626
help_widget::add_info_label
void add_info_label(const QString &text)
Definition helpdlg.cpp:647
help_widget::info_layout
QVBoxLayout * info_layout
Definition helpdlg.h:90
help_widget::set_topic_tech
void set_topic_tech(const help_item *item, const char *title)
Definition helpdlg.cpp:1090
help_widget::add_extras_of_act_for_terrain
void add_extras_of_act_for_terrain(struct terrain *pterr, enum unit_activity act, const char *label)
Definition helpdlg.cpp:703
help_widget::box_wdg
QFrame * box_wdg
Definition helpdlg.h:82
help_widget::set_topic_other
void set_topic_other(const help_item *item, const char *title)
Definition helpdlg.cpp:860
help_widget::set_topic
void set_topic(const help_item *item)
Definition helpdlg.cpp:794
help_widget::set_topic_extra
bool set_topic_extra(const help_item *item, const char *title)
Definition helpdlg.cpp:1468
help_widget::set_topic_nation
void set_topic_nation(const help_item *item, const char *title)
Definition helpdlg.cpp:1542
help_widget::create_terrain_widget
QLayout * create_terrain_widget(const QString &title, const struct canvas *image, const QString &legend, const QString &tooltip=QString())
Definition helpdlg.cpp:1245
help_widget::undo_layout
void undo_layout()
Definition helpdlg.cpp:594
help_widget::splitter_sizes
QList< int > splitter_sizes
Definition helpdlg.h:91
help_widget::uclass_max_values
struct unit_type * uclass_max_values(struct unit_class *uclass)
Definition helpdlg.cpp:1654
help_widget::text_browser
QTextBrowser * text_browser
Definition helpdlg.h:86
help_widget::help_widget
help_widget(QWidget *parent=0)
Definition helpdlg.cpp:435
help_widget::set_topic_terrain
void set_topic_terrain(const help_item *item, const char *title)
Definition helpdlg.cpp:1286
help_widget::do_layout
void do_layout(bool horizontal)
Definition helpdlg.cpp:516
help_widget::set_topic_goods
void set_topic_goods(const help_item *item, const char *title)
Definition helpdlg.cpp:1558
help_widget::info_panel
QWidget * info_panel
Definition helpdlg.h:88
help_widget::set_topic_building
void set_topic_building(const help_item *item, const char *title)
Definition helpdlg.cpp:998
help_widget::set_topic_government
void set_topic_government(const help_item *item, const char *title)
Definition helpdlg.cpp:1525
help_widget::set_topic_unit
void set_topic_unit(const help_item *item, const char *title)
Definition helpdlg.cpp:873
help_widget::bottom_panel
QWidget * bottom_panel
Definition helpdlg.h:87
help_widget::title_label
QLabel * title_label
Definition helpdlg.h:83
help_widget::terrain_max_values
struct terrain * terrain_max_values()
Definition helpdlg.cpp:1582
qfc_dialog
Definition dialogs.h:74
qfc_dialog::reactivate
void reactivate()
Definition dialogs.cpp:322
client
struct civclient client
Definition client_main.c:149
list
static struct fc_sockaddr_list * list
Definition clinet.c:102
event
enum event_type event
Definition events.c:81
extra_type_by_translated_name
struct extra_type * extra_type_by_translated_name(const char *name)
Definition extras.c:227
activity_to_extra_cause
enum extra_cause activity_to_extra_cause(enum unit_activity act)
Definition extras.c:1028
extra_name_translation
const char * extra_name_translation(const struct extra_type *pextra)
Definition extras.c:186
extra_type_by_cause_iterate_end
#define extra_type_by_cause_iterate_end
Definition extras.h:315
extra_type_by_cause_iterate
#define extra_type_by_cause_iterate(_cause, _extra)
Definition extras.h:309
fc_client.h
Terrain_type_id
int Terrain_type_id
Definition fc_types.h:343
O_SHIELD
@ O_SHIELD
Definition fc_types.h:91
O_FOOD
@ O_FOOD
Definition fc_types.h:91
O_TRADE
@ O_TRADE
Definition fc_types.h:91
O_SCIENCE
@ O_SCIENCE
Definition fc_types.h:91
O_LUXURY
@ O_LUXURY
Definition fc_types.h:91
O_GOLD
@ O_GOLD
Definition fc_types.h:91
skip_intl_qualifier_prefix
const char * skip_intl_qualifier_prefix(const char *str)
Definition fcintl.c:48
fcintl.h
Q_
#define Q_(String)
Definition fcintl.h:70
PL_
#define PL_(String1, String2, n)
Definition fcintl.h:71
_
#define _(String)
Definition fcintl.h:67
N_
#define N_(String)
Definition fcintl.h:69
fonts.h
government_name_translation
const char * government_name_translation(const struct government *pgovern)
Definition government.c:142
government_by_translated_name
struct government * government_by_translated_name(const char *name)
Definition government.c:39
governments_iterate
#define governments_iterate(NAME_pgov)
Definition government.h:120
governments_iterate_end
#define governments_iterate_end
Definition government.h:123
layout
static PangoLayout * layout
Definition canvas.c:331
pos
static struct tile * pos
Definition finddlg.c:53
popup_help_dialog_typed
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
Definition helpdlg.c:195
REQ_LABEL_NEVER
#define REQ_LABEL_NEVER
Definition helpdlg.c:143
REQ_LABEL_NONE
#define REQ_LABEL_NONE
Definition helpdlg.c:142
tooltip
const char * tooltip
Definition repodlgs.c:1314
title
const char * title
Definition repodlgs.c:1313
type
GType type
Definition repodlgs.c:1312
hash
static GHashTable * hash
Definition wldlg.c:320
terrain_canvas
static struct canvas * terrain_canvas
Definition mapview.c:78
helpdlg.h
sprite.h
helptext_government
void helptext_government(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct government *gov)
Definition helpdata.c:4175
helptext_advance
void helptext_advance(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, int i)
Definition helpdata.c:3115
helptext_extra
void helptext_extra(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct extra_type *pextra)
Definition helpdata.c:3619
helptext_goods
void helptext_goods(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct goods_type *pgood)
Definition helpdata.c:4094
helptext_unit_upkeep_str
char * helptext_unit_upkeep_str(const struct unit_type *utype)
Definition helpdata.c:4834
helptext_extra_for_terrain_str
const char * helptext_extra_for_terrain_str(struct extra_type *pextra, struct terrain *pterrain, enum unit_activity act)
Definition helpdata.c:3585
helptext_specialist
void helptext_specialist(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct specialist *pspec)
Definition helpdata.c:4140
get_help_item_spec
const struct help_item * get_help_item_spec(const char *name, enum help_page_type htype, int *pos)
Definition helpdata.c:1223
helptext_building
char * helptext_building(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct impr_type *pimprove)
Definition helpdata.c:1316
helptext_terrain
void helptext_terrain(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, struct terrain *pterrain)
Definition helpdata.c:3338
helptext_unit
char * helptext_unit(char *buf, size_t bufsz, struct player *pplayer, const char *user_text, const struct unit_type *utype)
Definition helpdata.c:1763
helptext_nation
void helptext_nation(char *buf, size_t bufsz, struct nation_type *pnation, const char *user_text)
Definition helpdata.c:4871
helpdata.h
help_items_iterate
#define help_items_iterate(pitem)
Definition helpdata.h:70
help_items_iterate_end
#define help_items_iterate_end
Definition helpdata.h:74
popdown_help_dialog
void popdown_help_dialog(void)
Definition helpdlg.cpp:101
SET_MAX
#define SET_MAX(v)
popup_help_dialog_string
void popup_help_dialog_string(const char *item)
Definition helpdlg.cpp:68
help_dlg
static help_dialog * help_dlg
Definition helpdlg.cpp:56
update_help_fonts
void update_help_fonts()
Definition helpdlg.cpp:113
popup_help_dialog_typed
void popup_help_dialog_typed(const char *item, enum help_page_type htype)
Definition helpdlg.cpp:79
MAX_HELP_TEXT_SIZE
#define MAX_HELP_TEXT_SIZE
Definition helpdlg.cpp:53
help_page_type
help_page_type
Definition helpdlg_g.h:20
HELP_ANY
@ HELP_ANY
Definition helpdlg_g.h:20
HELP_MULTIPLIER
@ HELP_MULTIPLIER
Definition helpdlg_g.h:24
HELP_TERRAIN
@ HELP_TERRAIN
Definition helpdlg_g.h:21
HELP_EXTRA
@ HELP_EXTRA
Definition helpdlg_g.h:21
HELP_NATIONS
@ HELP_NATIONS
Definition helpdlg_g.h:23
HELP_LAST
@ HELP_LAST
Definition helpdlg_g.h:24
HELP_IMPROVEMENT
@ HELP_IMPROVEMENT
Definition helpdlg_g.h:20
HELP_UNIT
@ HELP_UNIT
Definition helpdlg_g.h:20
HELP_SPECIALIST
@ HELP_SPECIALIST
Definition helpdlg_g.h:22
HELP_GOVERNMENT
@ HELP_GOVERNMENT
Definition helpdlg_g.h:22
HELP_GOODS
@ HELP_GOODS
Definition helpdlg_g.h:22
HELP_WONDER
@ HELP_WONDER
Definition helpdlg_g.h:21
HELP_TECH
@ HELP_TECH
Definition helpdlg_g.h:21
HELP_RULESET
@ HELP_RULESET
Definition helpdlg_g.h:23
HELP_TEXT
@ HELP_TEXT
Definition helpdlg_g.h:20
HELP_TILESET
@ HELP_TILESET
Definition helpdlg_g.h:23
valid_improvement
const struct impr_type * valid_improvement(const struct impr_type *pimprove)
Definition improvement.c:209
impr_base_build_shield_cost
int impr_base_build_shield_cost(const struct impr_type *pimprove)
Definition improvement.c:259
is_great_wonder
bool is_great_wonder(const struct impr_type *pimprove)
Definition improvement.c:767
improvement_by_translated_name
struct impr_type * improvement_by_translated_name(const char *name)
Definition improvement.c:350
improvement_name_translation
const char * improvement_name_translation(const struct impr_type *pimprove)
Definition improvement.c:241
improvement_iterate_end
#define improvement_iterate_end
Definition improvement.h:211
improvement_iterate
#define improvement_iterate(_p)
Definition improvement.h:205
put_drawn_sprites
void put_drawn_sprites(struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y, int count, struct drawn_sprite *pdrawn, bool fog)
Definition mapview_common.c:1313
put_unittype
void put_unittype(const struct unit_type *putype, struct canvas *pcanvas, float zoom, int canvas_x, int canvas_y)
Definition mapview_common.c:1388
move_points_text
const char * move_points_text(int mp, bool reduce)
Definition movement.c:973
movement.h
gui
static mpgui * gui
Definition mpgui_qt.cpp:52
fonts::default_font
const char *const default_font
Definition fonts.h:27
fonts::notify_label
const char *const notify_label
Definition fonts.h:28
fonts::help_label
const char *const help_label
Definition fonts.h:29
fonts::help_text
const char *const help_text
Definition fonts.h:30
nation_by_translated_plural
struct nation_type * nation_by_translated_plural(const char *name)
Definition nation.c:105
nation.h
universal_extraction
void universal_extraction(const struct universal *source, int *kind, int *value)
Definition requirements.c:780
universal_fulfills_requirements
bool universal_fulfills_requirements(bool check_necessary, const struct requirement_vector *reqs, const struct universal *source)
Definition requirements.c:5971
universal_name_translation
const char * universal_name_translation(const struct universal *psource, char *buf, size_t bufsz)
Definition requirements.c:5529
requirement_vector_iterate_end
#define requirement_vector_iterate_end
Definition requirements.h:93
requirement_vector_iterate
#define requirement_vector_iterate(req_vec, preq)
Definition requirements.h:91
MIN
#define MIN(x, y)
Definition shared.h:55
specialist_by_translated_name
struct specialist * specialist_by_translated_name(const char *name)
Definition specialist.c:130
specialist.h
advance
Definition tech.h:124
canvas
Definition canvas.h:21
canvas::map_pixmap
QPixmap map_pixmap
Definition canvas.h:25
civclient::conn
struct connection conn
Definition client_main.h:96
connection::playing
struct player * playing
Definition connection.h:156
drawn_sprite
Definition tilespec.h:109
drawn_sprite::sprite
struct sprite * sprite
Definition tilespec.h:111
effect
Definition effects.h:340
extra_type
Definition extras.h:85
extra_type::resource
struct resource_type * resource
Definition extras.h:150
goods_type
Definition traderoutes.h:180
government
Definition government.h:52
help_item
Definition helpdata.h:25
help_item::topic
char * topic
Definition helpdata.h:26
help_item::type
enum help_page_type type
Definition helpdata.h:27
help_item::text
char * text
Definition helpdata.h:26
impr_type
Definition improvement.h:68
impr_type::upkeep
int upkeep
Definition improvement.h:78
impr_type::obsolete_by
struct requirement_vector obsolete_by
Definition improvement.h:76
impr_type::reqs
struct requirement_vector reqs
Definition improvement.h:75
item
Definition climisc.h:80
nation_type
Definition nation.h:97
specialist
Definition specialist.h:29
sprite
Definition sprite.h:22
sprite::pm
QPixmap * pm
Definition sprite.h:25
terrain
Definition terrain.h:176
terrain::cultivate_result
struct terrain * cultivate_result
Definition terrain.h:203
terrain::resources
struct extra_type ** resources
Definition terrain.h:197
terrain::road_time
int road_time
Definition terrain.h:201
terrain::plant_time
int plant_time
Definition terrain.h:207
terrain::plant_result
struct terrain * plant_result
Definition terrain.h:206
terrain::irrigation_food_incr
int irrigation_food_incr
Definition terrain.h:209
terrain::clean_fallout_time
int clean_fallout_time
Definition terrain.h:220
terrain::defense_bonus
int defense_bonus
Definition terrain.h:193
terrain::cultivate_time
int cultivate_time
Definition terrain.h:204
terrain::movement_cost
int movement_cost
Definition terrain.h:192
terrain::pillage_time
int pillage_time
Definition terrain.h:221
terrain::output
int output[O_LAST]
Definition terrain.h:195
terrain::transform_time
int transform_time
Definition terrain.h:218
terrain::mining_time
int mining_time
Definition terrain.h:213
terrain::clean_pollution_time
int clean_pollution_time
Definition terrain.h:219
terrain::road_output_incr_pct
int road_output_incr_pct[O_LAST]
Definition terrain.h:199
terrain::transform_result
struct terrain * transform_result
Definition terrain.h:217
terrain::irrigation_time
int irrigation_time
Definition terrain.h:210
terrain::base_time
int base_time
Definition terrain.h:200
terrain::mining_shield_incr
int mining_shield_incr
Definition terrain.h:212
tileset
Definition tilespec.c:459
unit_class
Definition unittype.h:136
unit_type
Definition unittype.h:481
unit_type::uclass
struct unit_class * uclass
Definition unittype.h:537
unit_type::pop_cost
int pop_cost
Definition unittype.h:493
unit_type::defense_strength
int defense_strength
Definition unittype.h:496
unit_type::firepower
int firepower
Definition unittype.h:506
unit_type::build_cost
int build_cost
Definition unittype.h:492
unit_type::convert_time
int convert_time
Definition unittype.h:512
unit_type::city_size
int city_size
Definition unittype.h:531
unit_type::obsoleted_by
const struct unit_type * obsoleted_by
Definition unittype.h:510
unit_type::vision_radius_sq
int vision_radius_sq
Definition unittype.h:503
unit_type::move_rate
int move_rate
Definition unittype.h:497
unit_type::require_advance
struct advance * require_advance
Definition unittype.h:500
unit_type::bombard_rate
int bombard_rate
Definition unittype.h:528
unit_type::hp
int hp
Definition unittype.h:505
unit_type::fuel
int fuel
Definition unittype.h:513
unit_type::upkeep
int upkeep[O_LAST]
Definition unittype.h:519
unit_type::attack_strength
int attack_strength
Definition unittype.h:495
unit_type::happy_cost
int happy_cost
Definition unittype.h:518
universal
Definition fc_types.h:756
universal::kind
enum universals_n kind
Definition fc_types.h:758
universal::value
universals_u value
Definition fc_types.h:757
widget
Definition widget.h:112
fc_snprintf
int fc_snprintf(char *str, size_t n, const char *format,...)
Definition support.c:969
FALSE
#define FALSE
Definition support.h:47
advance_by_number
struct advance * advance_by_number(const Tech_type_id atype)
Definition tech.c:107
is_future_tech
bool is_future_tech(Tech_type_id tech)
Definition tech.c:281
advance_by_translated_name
struct advance * advance_by_translated_name(const char *name)
Definition tech.c:185
advance_name_translation
const char * advance_name_translation(const struct advance *padvance)
Definition tech.c:290
advance_number
Tech_type_id advance_number(const struct advance *padvance)
Definition tech.c:98
A_NONE
#define A_NONE
Definition tech.h:43
terrain_count
Terrain_type_id terrain_count(void)
Definition terrain.c:106
terrain_by_translated_name
struct terrain * terrain_by_translated_name(const char *name)
Definition terrain.c:190
terrain_name_translation
const char * terrain_name_translation(const struct terrain *pterrain)
Definition terrain.c:226
terrain_by_number
struct terrain * terrain_by_number(const Terrain_type_id type)
Definition terrain.c:144
terrain.h
T_NONE
#define T_NONE
Definition terrain.h:56
get_government_sprite
struct sprite * get_government_sprite(const struct tileset *t, const struct government *gov)
Definition tilespec.c:6508
get_building_sprite
struct sprite * get_building_sprite(const struct tileset *t, const struct impr_type *pimprove)
Definition tilespec.c:6498
get_unittype_sprite
struct sprite * get_unittype_sprite(const struct tileset *t, const struct unit_type *punittype, enum direction8 facing)
Definition tilespec.c:6520
tileset_full_tile_height
int tileset_full_tile_height(const struct tileset *t)
Definition tilespec.c:752
fill_basic_extra_sprite_array
int fill_basic_extra_sprite_array(const struct tileset *t, struct drawn_sprite *sprs, const struct extra_type *pextra)
Definition tilespec.c:6901
fill_basic_terrain_layer_sprite_array
int fill_basic_terrain_layer_sprite_array(struct tileset *t, struct drawn_sprite *sprs, int layer, struct terrain *pterrain)
Definition tilespec.c:6868
tileset_tile_height
int tileset_tile_height(const struct tileset *t)
Definition tilespec.c:728
tileset_full_tile_width
int tileset_full_tile_width(const struct tileset *t)
Definition tilespec.c:739
get_nation_flag_sprite
struct sprite * get_nation_flag_sprite(const struct tileset *t, const struct nation_type *pnation)
Definition tilespec.c:6471
get_tech_sprite
struct sprite * get_tech_sprite(const struct tileset *t, Tech_type_id tech)
Definition tilespec.c:6489
goods_by_translated_name
struct goods_type * goods_by_translated_name(const char *name)
Definition traderoutes.c:652
universals_u::terrain
struct terrain * terrain
Definition fc_types.h:602
unit.h
utype_build_shield_cost_base
int utype_build_shield_cost_base(const struct unit_type *punittype)
Definition unittype.c:1520
unit_type_by_translated_name
struct unit_type * unit_type_by_translated_name(const char *name)
Definition unittype.c:1804
utype_name_translation
const char * utype_name_translation(const struct unit_type *punittype)
Definition unittype.c:1612
unit_type_iterate
#define unit_type_iterate(_p)
Definition unittype.h:838
unit_type_iterate_end
#define unit_type_iterate_end
Definition unittype.h:845