Skip to content

Commit b66c66d

Browse files
author
mqrause
committed
use semicolon for column separators in iteminfo table drawing
1 parent 47d0bb1 commit b66c66d

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/item.cpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3861,24 +3861,24 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
38613861

38623862
std::string coverage_table;
38633863
//~ Limb-specific coverage (%s = name of limb)
3864-
coverage_table += string_format( _( "<bold>Coverage</bold>,%s\n" ), layering );
3864+
coverage_table += string_format( _( "<bold>Coverage</bold>;%s\n" ), layering );
38653865
//~ Regular/Default coverage
3866-
coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Default" ),
3866+
coverage_table += string_format( "%s;<color_c_yellow>%d</color>\n", _( "Default" ),
38673867
get_coverage( sbp ) );
38683868
if( get_coverage( sbp ) != get_coverage( sbp, item::cover_type::COVER_MELEE ) ) {
38693869
//~ Melee coverage
3870-
coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Melee" ), get_coverage( sbp,
3870+
coverage_table += string_format( "%s;<color_c_yellow>%d</color>\n", _( "Melee" ), get_coverage( sbp,
38713871
item::cover_type::COVER_MELEE ) );
38723872
}
38733873
if( get_coverage( sbp ) != get_coverage( sbp, item::cover_type::COVER_RANGED ) ) {
38743874
//~ Ranged coverage
3875-
coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Ranged" ),
3875+
coverage_table += string_format( "%s;<color_c_yellow>%d</color>\n", _( "Ranged" ),
38763876
get_coverage( sbp,
38773877
item::cover_type::COVER_RANGED ) );
38783878
}
38793879
if( get_coverage( sbp, item::cover_type::COVER_VITALS ) > 0 ) {
38803880
//~ Vitals coverage
3881-
coverage_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Vitals" ),
3881+
coverage_table += string_format( "%s;<color_c_yellow>%d</color>\n", _( "Vitals" ),
38823882
get_coverage( sbp,
38833883
item::cover_type::COVER_VITALS ) );
38843884
}
@@ -3908,11 +3908,11 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
39083908
std::string protection_table;
39093909
if( display_median ) {
39103910
protection_table +=
3911-
string_format( "<bold>%s</bold>,<bad>%d%%</bad> chance,<color_c_yellow>Median</color> chance,<good>%d%%</good> chance\n",
3911+
string_format( "<bold>%s</bold>;<bad>%d%%</bad> chance;<color_c_yellow>Median</color> chance;<good>%d%%</good> chance\n",
39123912
_( "Protection" ), percent_worst, percent_best );
39133913
} else if( percent_worst > 0 ) {
39143914
protection_table +=
3915-
string_format( "<bold>%s</bold>,<bad>%d%%</bad> chance,<good>%d%%</good> chance\n",
3915+
string_format( "<bold>%s</bold>;<bad>%d%%</bad> chance;<good>%d%%</good> chance\n",
39163916
_( "Protection" ), percent_worst, percent_best );
39173917
} else {
39183918
protection_table += string_format( "<bold>%s</bold>\n", _( "Protection" ) );
@@ -3928,12 +3928,12 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
39283928
if( dio.info_display == damage_info_order::info_disp::DETAILED ) {
39293929
if( display_median ) {
39303930
protection_table +=
3931-
string_format( "%s,<bad>%.2f</bad>,<color_c_yellow>%.2f</color>,<good>%.2f</good>\n",
3931+
string_format( "%s;<bad>%.2f</bad>;<color_c_yellow>%.2f</color>;<good>%.2f</good>\n",
39323932
uppercase_first_letter( dio.dmg_type->name.translated() ), worst_res.type_resist( dio.dmg_type ),
39333933
median_res.type_resist( dio.dmg_type ), best_res.type_resist( dio.dmg_type ) );
39343934
printed_any = true;
39353935
} else if( percent_worst > 0 ) {
3936-
protection_table += string_format( "%s,<bad>%.2f</bad>,<good>%.2f</good>\n",
3936+
protection_table += string_format( "%s;<bad>%.2f</bad>;<good>%.2f</good>\n",
39373937
uppercase_first_letter( dio.dmg_type->name.translated() ), worst_res.type_resist( dio.dmg_type ),
39383938
best_res.type_resist( dio.dmg_type ) );
39393939
printed_any = true;
@@ -3942,14 +3942,14 @@ void item::armor_protection_info( std::vector<iteminfo> &info, const iteminfo_qu
39423942
}
39433943
}
39443944
if( skipped_detailed || dio.info_display == damage_info_order::info_disp::BASIC ) {
3945-
protection_table += string_format( "%s,<color_c_yellow>%.2f</color>\n",
3945+
protection_table += string_format( "%s;<color_c_yellow>%.2f</color>\n",
39463946
uppercase_first_letter( dio.dmg_type->name.translated() ),
39473947
best_res.type_resist( dio.dmg_type ) );
39483948
printed_any = true;
39493949
}
39503950
}
39513951
if( get_base_env_resist( *this ) >= 1 ) {
3952-
protection_table += string_format( "%s,<color_c_yellow>%d</color>\n", _( "Environmental" ),
3952+
protection_table += string_format( "%s;<color_c_yellow>%d</color>\n", _( "Environmental" ),
39533953
get_base_env_resist( *this ) );
39543954
printed_any = true;
39553955
}

src/output.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1163,7 +1163,7 @@ static std::string format_table( std::string_view s )
11631163
return table;
11641164
}
11651165

1166-
std::vector<std::string> header = string_split( rows[0], ',' );
1166+
std::vector<std::string> header = string_split( rows[0], ';' );
11671167
table += header[0] + ":";
11681168
for( size_t col = 1; col < header.size(); col++ ) {
11691169
table += ( col == 1 ? " " : ", " ) + header[col];
@@ -1176,7 +1176,7 @@ static std::string format_table( std::string_view s )
11761176
if( rows[row].empty() ) {
11771177
continue;
11781178
}
1179-
std::vector<std::string> cols = string_split( rows[row], ',' );
1179+
std::vector<std::string> cols = string_split( rows[row], ';' );
11801180
table += " " + cols[0] + ":";
11811181
for( size_t i = 1; i < cols.size(); i++ ) {
11821182
table += ( i == 1 ? " " : ", " ) + cols[i];
@@ -1311,7 +1311,7 @@ static int get_num_cols( std::vector<std::string> &rows )
13111311
int cols = 0;
13121312

13131313
for( const std::string &row : rows ) {
1314-
cols = std::max( cols, static_cast<int>( string_split( row, ',' ).size() ) );
1314+
cols = std::max( cols, static_cast<int>( string_split( row, ';' ).size() ) );
13151315
}
13161316

13171317
return cols;
@@ -1328,7 +1328,7 @@ static void draw_table( std::string_view s )
13281328

13291329
if( ImGui::BeginTable( "##ITEMINFO_TABLE", num_cols,
13301330
ImGuiTableFlags_BordersH | ImGuiTableFlags_BordersV ) ) {
1331-
const std::vector<std::string> chopped_up = string_split( rows.front(), ',' );
1331+
const std::vector<std::string> chopped_up = string_split( rows.front(), ';' );
13321332
for( const std::string &cell_text : chopped_up ) {
13331333
// this prefix prevents imgui from drawing the text. We still have color tags, which imgui won't parse, so we don't want those exposed to the user.
13341334
// But we still want proper column IDs. So we put them in, but we *hide them* with this.
@@ -1352,7 +1352,7 @@ static void draw_table( std::string_view s )
13521352
continue;
13531353
}
13541354
ImGui::TableNextRow();
1355-
const std::vector<std::string> delimited_strings = string_split( rows[i], ',' );
1355+
const std::vector<std::string> delimited_strings = string_split( rows[i], ';' );
13561356
for( const std::string &text : delimited_strings ) {
13571357
ImGui::TableNextColumn();
13581358
cataimgui::draw_colored_text( text, c_unset );

0 commit comments

Comments
 (0)