From b8fee8e9c07cd268db06df1cfce5ae8213d28086 Mon Sep 17 00:00:00 2001 From: moxian Date: Mon, 9 Dec 2024 01:57:10 -0800 Subject: [PATCH 1/2] Display item variant base type (if it differs) --- src/item.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/item.cpp b/src/item.cpp index 607694cc5cb22..b4d611455a60e 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -2495,6 +2495,16 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, info.emplace_back( "DESCRIPTION", type->description.translated() ); } } + + 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 ) { + insert_separation_line( info ); + info.emplace_back( "DESCRIPTION", string_format( _( "It is a kind of a %s." ), type->nname( 1 ) ) ); + } + } + insert_separation_line( info ); } From 559e03c410df240e537844f93044173464d45ae8 Mon Sep 17 00:00:00 2001 From: moxian Date: Mon, 9 Dec 2024 02:31:22 -0800 Subject: [PATCH 2/2] a more civilized approach --- src/item.cpp | 6 ++++-- src/iteminfo_query.h | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/item.cpp b/src/item.cpp index b4d611455a60e..afac14ae9524d 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -2495,7 +2495,10 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, info.emplace_back( "DESCRIPTION", type->description.translated() ); } } + 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; @@ -2503,9 +2506,8 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, insert_separation_line( info ); info.emplace_back( "DESCRIPTION", string_format( _( "It is a kind of a %s." ), type->nname( 1 ) ) ); } + insert_separation_line( info ); } - - insert_separation_line( info ); } insert_separation_line( info ); diff --git a/src/iteminfo_query.h b/src/iteminfo_query.h index 269da704902f3..257561cb5f3a9 100644 --- a/src/iteminfo_query.h +++ b/src/iteminfo_query.h @@ -184,6 +184,7 @@ enum class iteminfo_parts : size_t { ACTIONS, DESCRIPTION, + DESCRIPTION_VARIANT_BASETYPE, DESCRIPTION_TECHNIQUES, DESCRIPTION_GUNMOD_ADDREACHATTACK, DESCRIPTION_MELEEDMG,