From 72a9cd836cc4155232e11a0c184a8041b9ae0a7d Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Mon, 11 Mar 2024 12:47:22 -0500 Subject: [PATCH 1/2] commit for remote --- data/json/flags.json | 2 +- src/item.cpp | 51 +++++++++++++++++++------------------------- 2 files changed, 23 insertions(+), 30 deletions(-) diff --git a/data/json/flags.json b/data/json/flags.json index 479ada30ac43..89dc6f55a815 100644 --- a/data/json/flags.json +++ b/data/json/flags.json @@ -990,7 +990,7 @@ "id": "MAGIC_FOCUS", "type": "json_flag", "context": [ "item" ], - "//": "You can cast spells with this item in your hand." + "info": "This item is a magical focus. You can cast spells with it in your hand." }, { "id": "HOSTILE_SUMMON", diff --git a/src/item.cpp b/src/item.cpp index aeb1fe18ef23..c4b3e954d374 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1655,11 +1655,6 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, } else if( idescription != item_vars.end() ) { info.emplace_back( "DESCRIPTION", idescription->second ); } else { - if( has_flag( flag_MAGIC_FOCUS ) ) { - info.emplace_back( "DESCRIPTION", - _( "This item is a magical focus. " - "You can cast spells with it in your hand." ) ); - } if( is_craft() ) { const std::string desc = _( "This is an in progress %s. " "It is %d percent complete." ); @@ -1671,7 +1666,28 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, info.emplace_back( "DESCRIPTION", type->description.translated() ); } } - insert_separation_line( info ); + std::map::const_iterator item_note = item_vars.find( "item_note" ); + std::map::const_iterator item_note_tool = + item_vars.find( "item_note_tool" ); + + if( item_note != item_vars.end() && parts->test( iteminfo_parts::DESCRIPTION_NOTES ) ) { + std::string ntext; + const inscribe_actor *use_actor = nullptr; + if( item_note_tool != item_vars.end() ) { + const use_function *use_func = itype_id( item_note_tool->second )->get_use( "inscribe" ); + use_actor = dynamic_cast( use_func->get_actor_ptr() ); + } + if( use_actor ) { + //~ %1$s: gerund (e.g. carved), %2$s: item name, %3$s: inscription text + ntext = string_format( pgettext( "carving", "%1$s on the %2$s is: %3$s" ), + use_actor->gerund, tname(), item_note->second ); + } else { + //~ %1$s: inscription text + ntext = string_format( pgettext( "carving", "Note: %1$s" ), item_note->second ); + } + info.emplace_back( "DESCRIPTION", ntext ); + } + insert_separation_line( info ); } insert_separation_line( info ); @@ -3879,29 +3895,6 @@ void item::final_info( std::vector &info, const iteminfo_query &parts_ } } - std::map::const_iterator item_note = item_vars.find( "item_note" ); - std::map::const_iterator item_note_tool = - item_vars.find( "item_note_tool" ); - - if( item_note != item_vars.end() && parts->test( iteminfo_parts::DESCRIPTION_NOTES ) ) { - insert_separation_line( info ); - std::string ntext; - const inscribe_actor *use_actor = nullptr; - if( item_note_tool != item_vars.end() ) { - const use_function *use_func = itype_id( item_note_tool->second )->get_use( "inscribe" ); - use_actor = dynamic_cast( use_func->get_actor_ptr() ); - } - if( use_actor ) { - //~ %1$s: gerund (e.g. carved), %2$s: item name, %3$s: inscription text - ntext = string_format( pgettext( "carving", "%1$s on the %2$s is: %3$s" ), - use_actor->gerund, tname(), item_note->second ); - } else { - //~ %1$s: inscription text - ntext = string_format( pgettext( "carving", "Note: %1$s" ), item_note->second ); - } - info.emplace_back( "DESCRIPTION", ntext ); - } - if( this->get_var( "die_num_sides", 0 ) != 0 ) { info.emplace_back( "DESCRIPTION", string_format( _( "* This item can be used as a die, " From 2a54b806d3d395e06aa4cf7a52093bee753bf4a9 Mon Sep 17 00:00:00 2001 From: Chaosvolt Date: Mon, 11 Mar 2024 15:08:19 -0500 Subject: [PATCH 2/2] Lil cleaning up --- src/item.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/item.cpp b/src/item.cpp index c4b3e954d374..e5e90d89ed4c 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -1679,7 +1679,7 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, } if( use_actor ) { //~ %1$s: gerund (e.g. carved), %2$s: item name, %3$s: inscription text - ntext = string_format( pgettext( "carving", "%1$s on the %2$s is: %3$s" ), + ntext = string_format( pgettext( "carving", "%1$s on the %2$s is: %3$s" ), use_actor->gerund, tname(), item_note->second ); } else { //~ %1$s: inscription text @@ -1687,7 +1687,7 @@ void item::basic_info( std::vector &info, const iteminfo_query *parts, } info.emplace_back( "DESCRIPTION", ntext ); } - insert_separation_line( info ); + insert_separation_line( info ); } insert_separation_line( info );