From 9d74fe42847cf65e728f7878b7be788d018a3225 Mon Sep 17 00:00:00 2001 From: Dino Date: Tue, 29 Jul 2025 17:22:18 -0400 Subject: [PATCH] #1266 Qt, show more help info for terrain extras --- client/gui-qt/helpdlg.cpp | 69 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/client/gui-qt/helpdlg.cpp b/client/gui-qt/helpdlg.cpp index c87401297f..2868f62ac0 100644 --- a/client/gui-qt/helpdlg.cpp +++ b/client/gui-qt/helpdlg.cpp @@ -1502,6 +1502,75 @@ bool help_widget::set_topic_extra(const help_item *topic, add_info_pixmap(&canvas->map_pixmap, true); qtg_canvas_free(canvas); + QString str; + + /* Cost to build */ + str = N_("Build:"); + str = "" + str + "" + " "; + if (pextra->buildable) { + if (pextra->build_time != 0) { + /* TRANS: "MP" = movement points */ + str = str + QString::number(pextra->build_time).toHtmlEscaped() + + _(" MP"); + } else { + /* TRANS: Build time depends on terrain. */ + str = str + _("Terrain specific"); + } + add_info_label(str); + } + + /* Conflicting extras */ + str = N_("Conflicts with:"); + str = "" + str + "" + " "; + bool is_resource = is_extra_caused_by(pextra, EC_RESOURCE); + if (is_resource) { + /* TRANS: (Resource extra) Conflicts with: */ + str = str + _("Other Resources"); + } + extra_type_iterate(pextra2) { + if (!can_extras_coexist(pextra, pextra2) + && (!is_resource || !is_extra_caused_by(pextra2, EC_RESOURCE))) { + str = str + extra_name_translation(pextra2) + "/"; + } + } extra_type_iterate_end; + if (str[str.length() - 1] == '/') { + str[str.length() - 1] = '\0'; + } else if (! is_resource) { + str = str + _("(none)"); + } + add_info_label(str); + + /* Bonus for road type extras */ + struct road_type *proad = extra_road_get(pextra); + if (proad != NULL) { + const char *bonus = NULL; + str = N_("Bonus (F/P/T):"); + str = "" + str + "" + " "; + + // cpp doesn't like the output_type_iterate() macro, gets - + // error: assigning to 'Output_type_id' (aka 'output_type_id') + // from incompatible type 'int' + // so do it the hard way + if ((proad->tile_incr[O_FOOD] > 0) + || (proad->tile_incr[O_SHIELD] > 0) + || (proad->tile_incr[O_TRADE] > 0) + || (proad->tile_incr[O_GOLD] > 0) + || (proad->tile_incr[O_LUXURY] > 0) + || (proad->tile_incr[O_SCIENCE] > 0)) { + /* TRANS: Road bonus depends on terrain. */ + bonus = _("Terrain specific"); + } + if (!bonus) { + bonus = helptext_road_bonus_str(NULL, proad); + } + if (!bonus) { + /* TRANS: No output bonus from a road */ + bonus = Q_("?bonus:None"); + } + str = str + bonus; + add_info_label(str); + } + return false; } else { set_topic_other(topic, title); -- 2.31.0