Project

General

Profile

Actions

Bug #1606

open

Gtk4 client help -> units should show >1 tech requirement

Added by Dean Brown 7 months ago. Updated about 1 month ago.

Status:
New
Priority:
Normal
Assignee:
-
Category:
gtk4-client
Target version:
-
Start date:
07/14/2025
Due date:
% Done:

0%

Estimated time:

Description

Spun off from #1604.
New in 3.2, units now have general requirement vectors and a unit can require >1 techs. Clients should show that info.


Files

1606_gtk4.patch (4.45 KB) 1606_gtk4.patch corrected Dean Brown, 07/20/2025 02:39 AM
Actions #1

Updated by Dean Brown 7 months ago

  • File 1606_gtk4.patch added
Actions #2

Updated by Marko Lindqvist 7 months ago

Having multiple techs (or anything else than a single tech name) in the same button breaks it. It leads to no legal help location.

You would need to dynamically create a separate button for each tech req.

Actions #3

Updated by Dean Brown 7 months ago

  • File deleted (1606_gtk4.patch)
Actions #4

Updated by Dean Brown 7 months ago

Yes, more work was needed.

The grid help_utable is usually 5 rows and 5 cols - (zero based) row 4 col 2 was not used. That now gets the 2nd requirement (if needed). Any more requirements start a new row (row 5) and cols 0-2, then row 6 and cols 0-2, etc. The next time thru help_update_unit_type(), the added rows get removed and row 4 col 2 gets hidden before iterating the reqs.

Not relevant to this fix, just curious, I wasn't able to figure out while digging thru the code - how do the labels and buttons get their font & color?

Actions #5

Updated by Marko Lindqvist 2 months ago

Dean Brown wrote in #note-4:

Not relevant to this fix, just curious, I wasn't able to figure out while digging thru the code - how do the labels and buttons get their font & color?

I guess data/themes/gtk4/Freeciv/gtk-4.0/gtk.css

Actions #6

Updated by Marko Lindqvist 2 months ago

These tickets have been stuck because I've meant to check if there's an easy way to provide more complete info, containing also other requirement types in addition to tech reqs.

I did some related work not so long ago resulting in struct help_page_selection that might be useful here.

Actions #7

Updated by Dean Brown about 1 month ago

Did some more thinking and researching, my thoughts:

- all the reqs get auto-generated help text already (unless "quiet" is TRUE), so the linkable info in the non-text pane is a nice-to-have but technically redundant extra. One option would be to remove that and then there's no problem, but I don't recommend that. It's fine as is for all currently supplied standard rulesets, so another option is to leave it that way. I'd rather improve it for the benefit to custom rulesets.

- Handling all reqs in the non-text pane would be problematic - there's too many req types (>50?), ranges would be difficult, have to deal with negated. It would get very wordy and duplicate the info in the auto-generated help text. I don't recommend that option.

- Similar issue with the improvements/wonders help - it currently just lists 1 tech req. Whatever is done to unit help should also be done for improvements/wonders help. In the file .../gui-gtk-3.22/helpdlg.c routines help_update_improvement() & help_update_wonder() there's a FIXME: about > 1 req.

- I'm OK with just showing tech reqs in the non-text pane, but an argument could be made that a few more req types should be shown - e.g. the Qt client may show VUT_GOVERNMENT or VUT_TERRAIN in the improvements/wonders help.

- My research led me to look at reqtext.c - I would like to re-write/improve that file, going to create a new issue for that.

Actions

Also available in: Atom PDF