Deduplicate item name in info window #38610
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
SUMMARY: Interface "Remove duplicate item name in item info panel"
Purpose of change
Many items (clothing, stuff in containers, fresh food, tools marked as favorite) display a duplicate name in the item description panel. The duplicate item name adds no information (since the first line always includes the text of the second) and it takes up a potentially quite valuable line of screen space.
Describe the solution
Slightly changes the conditional in
src/output.cpp
in thedraw_item_info
function, so thattype_name
is only output iftname
does not already include it. Normally,tname
includestype_name
anyway, thanks to this bit inside thetname
function:Cataclysm-DDA/src/item.cpp
Lines 3883 to 3884 in 6bb5b9d
In the few cases where it does not, both lines will be shown - such as when an item has a custom label.
Describe alternatives you've considered
Considered leaving as-is, and also considered fixing as part of #38030 , but seems worth doing on its own.
Testing
Checked descriptions of various items and saw the duplicate line removed. Checked items that had no duplicate before (guns, regular tools and weapons) and saw they still have the name intact.
Additional context
Any item that previously duplicated the exact same text in both lines, now has the duplicate second line removed. This includes:
*
next to themSince
type_name
is responsible for adding the descriptive modifiers (when a food has human or mutant meat as an ingredient, for example), I tested a few of those as well:Any item whose first line does not include the exact text of the second line, has both lines displayed. This includes items that have been re-labeled using a marker or knife. The display of such items remains unchanged: