Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display item variant's base type (if relevant) #78442

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2498,6 +2498,18 @@
insert_separation_line( info );
}

if( parts->test( iteminfo_parts::DESCRIPTION_VARIANT_BASETYPE ) ) {
if( has_itype_variant() ) {
const std::string typ_name = type->get_id().str();
const std::string var_name = itype_variant().id;
if( var_name != "" && typ_name != var_name ) {

Check failure on line 2505 in src/item.cpp

View workflow job for this annotation

GitHub Actions / build (src)

the 'empty' method should be used to check for emptiness instead of comparing to an empty object [readability-container-size-empty,-warnings-as-errors]
insert_separation_line( info );
info.emplace_back( "DESCRIPTION", string_format( _( "It is a kind of a %s." ), type->nname( 1 ) ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick: if anyone nows how to generate the correct article a/an.

Example: It is a kind of a apron. is not right.

}
insert_separation_line( info );
}
}

insert_separation_line( info );

if( parts->test( iteminfo_parts::BASE_REQUIREMENTS ) ) {
Expand Down
1 change: 1 addition & 0 deletions src/iteminfo_query.h
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ enum class iteminfo_parts : size_t {
ACTIONS,

DESCRIPTION,
DESCRIPTION_VARIANT_BASETYPE,
DESCRIPTION_TECHNIQUES,
DESCRIPTION_GUNMOD_ADDREACHATTACK,
DESCRIPTION_MELEEDMG,
Expand Down
Loading