@@ -3852,30 +3852,39 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
3852
3852
3853
3853
// get the layers this bit of the armor covers if its unique compared to the rest of the armor
3854
3854
for( const layer_level &ll : get_layer( sbp ) ) {
3855
- layering += string_format( " <stat>%s</stat>.", item::layer_to_string( ll ) );
3855
+ layering += string_format( "<stat>%s</stat>. ", item::layer_to_string( ll ) );
3856
3856
}
3857
+ // remove extra space from the end
3858
+ if( !layering.empty() ) {
3859
+ layering.pop_back();
3860
+ }
3861
+
3862
+ std::string coverage_table;
3857
3863
//~ Limb-specific coverage (%s = name of limb)
3858
- info.emplace_back( "SPECIAL_ARMOR_GRAPH", string_format( _( "<bold>Coverage</bold>:%s" ),
3859
- layering ) );
3864
+ coverage_table += string_format( _( "<bold>Coverage</bold>,%s\n" ), layering );
3860
3865
//~ Regular/Default coverage
3861
- info.emplace_back( bp_cat, string_format( "%s%s%s ", space, _( "Default: " ), space ), "" ,
3862
- iteminfo::no_flags, get_coverage( sbp ) );
3866
+ coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n ", _( "Default" ),
3867
+ get_coverage( sbp ) );
3863
3868
if( get_coverage( sbp ) != get_coverage( sbp, item::cover_type::COVER_MELEE ) ) {
3864
3869
//~ Melee coverage
3865
- info.emplace_back( bp_cat, string_format( "%s%s%s ", space, _( "Melee: " ), space ), "" ,
3866
- iteminfo::no_flags, get_coverage( sbp, item::cover_type::COVER_MELEE ) );
3870
+ coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n ", _( "Melee" ), get_coverage( sbp ,
3871
+ item::cover_type::COVER_MELEE ) );
3867
3872
}
3868
3873
if( get_coverage( sbp ) != get_coverage( sbp, item::cover_type::COVER_RANGED ) ) {
3869
3874
//~ Ranged coverage
3870
- info.emplace_back( bp_cat, string_format( "%s%s%s", space, _( "Ranged:" ), space ), "",
3871
- iteminfo::no_flags, get_coverage( sbp, item::cover_type::COVER_RANGED ) );
3875
+ coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Ranged" ),
3876
+ get_coverage( sbp,
3877
+ item::cover_type::COVER_RANGED ) );
3872
3878
}
3873
3879
if( get_coverage( sbp, item::cover_type::COVER_VITALS ) > 0 ) {
3874
3880
//~ Vitals coverage
3875
- info.emplace_back( bp_cat, string_format( "%s%s%s", space, _( "Vitals:" ), space ), "",
3876
- iteminfo::no_flags, get_coverage( sbp, item::cover_type::COVER_VITALS ) );
3881
+ coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Vitals" ),
3882
+ get_coverage( sbp,
3883
+ item::cover_type::COVER_VITALS ) );
3877
3884
}
3878
3885
3886
+ info.emplace_back( bp_cat, coverage_table, iteminfo::is_table );
3887
+
3879
3888
bool printed_any = false;
3880
3889
3881
3890
// gather all the protection data
@@ -3896,17 +3905,17 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
3896
3905
3897
3906
bool display_median = percent_best < 50 && percent_worst < 50;
3898
3907
3908
+ std::string protection_table;
3899
3909
if( display_median ) {
3900
- info.emplace_back( "SPECIAL_ARMOR_GRAPH",
3901
- string_format( "<bold>%s</bold>: <bad>%d%%</bad> chance, <color_c_yellow>Median</color> chance, <good>%d%%</good> chance",
3902
- _( "Protection" ), percent_worst, percent_best ) );
3910
+ protection_table +=
3911
+ string_format( "<bold>%s</bold>, <bad>%d%%</bad> chance,<color_c_yellow>Median</color> chance,<good>%d%%</good> chance\n ",
3912
+ _( "Protection" ), percent_worst, percent_best );
3903
3913
} else if( percent_worst > 0 ) {
3904
- info.emplace_back( "SPECIAL_ARMOR_GRAPH",
3905
- string_format( "<bold>%s</bold>: <bad>%d%%</bad> chance, <good>%d%%</good> chance",
3906
- _( "Protection" ),
3907
- percent_worst, percent_best ) );
3914
+ protection_table +=
3915
+ string_format( "<bold>%s</bold>,<bad>%d%%</bad> chance,<good>%d%%</good> chance\n",
3916
+ _( "Protection" ), percent_worst, percent_best );
3908
3917
} else {
3909
- info.emplace_back( "SPECIAL_ARMOR_GRAPH", string_format( "<bold>%s</bold>: ", _( "Protection" ) ) );
3918
+ protection_table += string_format( "<bold>%s</bold>\n ", _( "Protection" ) );
3910
3919
}
3911
3920
3912
3921
for( const damage_info_order &dio : damage_info_order::get_all(
@@ -3918,34 +3927,39 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
3918
3927
bool skipped_detailed = false;
3919
3928
if( dio.info_display == damage_info_order::info_disp::DETAILED ) {
3920
3929
if( display_median ) {
3921
- info.emplace_back( bp_cat,
3922
- string_format( "%s%s: <bad>%.2f</bad>, <color_c_yellow>%.2f</color>, <good>%.2f</good>", space,
3923
- uppercase_first_letter( dio.dmg_type->name.translated() ), worst_res.type_resist( dio.dmg_type ),
3924
- median_res.type_resist( dio.dmg_type ), best_res.type_resist( dio.dmg_type ) ), "",
3925
- iteminfo::no_flags );
3930
+ protection_table +=
3931
+ string_format( "%s,<bad>%.2f</bad>,<color_c_yellow>%.2f</color>,<good>%.2f</good>\n",
3932
+ uppercase_first_letter( dio.dmg_type->name.translated() ), worst_res.type_resist( dio.dmg_type ),
3933
+ median_res.type_resist( dio.dmg_type ), best_res.type_resist( dio.dmg_type ) );
3926
3934
printed_any = true;
3927
3935
} else if( percent_worst > 0 ) {
3928
- info.emplace_back( bp_cat, string_format( "%s%s: <bad>%.2f</bad>, <good>%.2f</good>", space,
3929
- uppercase_first_letter( dio.dmg_type->name.translated() ),
3930
- worst_res.type_resist( dio.dmg_type ), best_res.type_resist( dio.dmg_type ) ), "",
3931
- iteminfo::no_flags );
3936
+ protection_table += string_format( "%s,<bad>%.2f</bad>,<good>%.2f</good>\n",
3937
+ uppercase_first_letter( dio.dmg_type->name.translated() ), worst_res.type_resist( dio.dmg_type ),
3938
+ best_res.type_resist( dio.dmg_type ) );
3932
3939
printed_any = true;
3933
3940
} else {
3934
3941
skipped_detailed = true;
3935
3942
}
3936
3943
}
3937
3944
if( skipped_detailed || dio.info_display == damage_info_order::info_disp::BASIC ) {
3938
- info.emplace_back( bp_cat, string_format( "%s%s: ", space ,
3939
- uppercase_first_letter( dio.dmg_type->name.translated() ) ), "" ,
3940
- iteminfo::is_decimal, best_res.type_resist( dio.dmg_type ) );
3945
+ protection_table += string_format( "%s,<color_c_yellow>%.2f</color>\n" ,
3946
+ uppercase_first_letter( dio.dmg_type->name.translated() ),
3947
+ best_res.type_resist( dio.dmg_type ) );
3941
3948
printed_any = true;
3942
3949
}
3943
3950
}
3944
3951
if( get_base_env_resist( *this ) >= 1 ) {
3945
- info.emplace_back( bp_cat, string_format( "%s%s ", space, _( "Environmental: " ) ),
3946
- get_base_env_resist( *this ) );
3952
+ protection_table += string_format( "%s,<color_c_yellow>%d</color>\n ", _( "Environmental" ),
3953
+ get_base_env_resist( *this ) );
3947
3954
printed_any = true;
3948
3955
}
3956
+
3957
+ iteminfo::flags info_flags = iteminfo::is_table;
3958
+ if( !printed_any ) {
3959
+ info_flags = info_flags | iteminfo::no_newline;
3960
+ }
3961
+ info.emplace_back( bp_cat, protection_table, info_flags );
3962
+
3949
3963
// if we haven't printed any armor data acknowledge that
3950
3964
if( !printed_any ) {
3951
3965
info.emplace_back( bp_cat, string_format( "%s%s", space, _( "Negligible Protection" ) ) );
@@ -13287,6 +13301,7 @@ iteminfo::iteminfo( const std::string &Type, const std::string &Name, const std:
13287
13301
bLowerIsBetter = static_cast<bool>( Flags & lower_is_better );
13288
13302
bDrawName = !( Flags & no_name );
13289
13303
bIsArt = Flags & is_art;
13304
+ this->isTable = Flags & is_table;
13290
13305
}
13291
13306
13292
13307
iteminfo::iteminfo( const std::string &Type, const std::string &Name, flags Flags )
0 commit comments