From 309f147cfe8eab353ad92504cca38d97a1ab3606 Mon Sep 17 00:00:00 2001 From: Dino Date: Sun, 13 Jul 2025 21:33:03 -0400 Subject: [PATCH] #1604 make help -> units show >1 tech requirement --- client/gui-qt/helpdlg.cpp | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/client/gui-qt/helpdlg.cpp b/client/gui-qt/helpdlg.cpp index c87401297f..3863424c0c 100644 --- a/client/gui-qt/helpdlg.cpp +++ b/client/gui-qt/helpdlg.cpp @@ -882,7 +882,6 @@ void help_widget::set_topic_unit(const help_item *topic, struct canvas *canvas; const struct unit_type *obsolete; struct unit_type *utype, *max_utype; - QList list; QString str; utype = unit_type_by_translated_name(title); @@ -934,17 +933,24 @@ void help_widget::set_topic_unit(const help_item *topic, add_info_separator(); - // Tech requirement - tech = utype_primary_tech_req(utype); - if (advance_number(tech) != A_NONE) { - QLabel *tb; - - tb = new QLabel(this); + // Tech requirements + // see if any reqs + if (utype->build_reqs.size == 0) { + add_info_label(_("No technology required.")); + } else { + // there is >= 1 req // TRANS: this and similar literal strings interpreted as (Qt) HTML str = _("Requires"); - str = "" + str + " " - + link_me(advance_name_translation(tech), HELP_TECH); + str = "" + str + " "; + + // iterate all the reqs, building the str + unit_tech_reqs_iterate(utype, padv) { + str = str + link_me(advance_name_translation(padv), HELP_TECH); + } unit_tech_reqs_iterate_end; + QLabel *tb; + + tb = new QLabel(this); tb->setProperty(fonts::help_label, "true"); tb->setTextInteractionFlags(Qt::LinksAccessibleByMouse); tb->setTextFormat(Qt::RichText); @@ -952,8 +958,6 @@ void help_widget::set_topic_unit(const help_item *topic, connect(tb, &QLabel::linkActivated, this, &help_widget::anchor_clicked); info_layout->addWidget(tb); - } else { - add_info_label(_("No technology required.")); } // Obsolescence -- 2.31.0