Skip to content

Commit 0854dcb

Browse files
committed
Expand widget clauses: JSONify bp_status_sym_text
1 parent cd588e0 commit 0854dcb

File tree

6 files changed

+4
-35
lines changed

6 files changed

+4
-35
lines changed

data/json/ui/bodypart_status.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,7 @@
8585
"id": "bodypart_status_sym_text",
8686
"//": "Base widget for body part status symbols; needs bodypart field defined in derived widget.",
8787
"type": "widget",
88-
"style": "text",
89-
"var": "bp_status_sym_text",
88+
"style": "symbol",
9089
"text_align": "left",
9190
"copy-from": "bodypart_status_indicator_template"
9291
},

data/mods/TEST_DATA/widgets.json

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -425,17 +425,15 @@
425425
{
426426
"id": "test_status_sym_torso_text",
427427
"type": "widget",
428-
"style": "text",
429-
"var": "bp_status_sym_text",
428+
"style": "symbol",
430429
"label": "TORSO",
431430
"bodypart": "torso",
432431
"copy-from": "test_bp_status_indicator_template"
433432
},
434433
{
435434
"id": "test_status_sym_left_arm_text",
436435
"type": "widget",
437-
"style": "text",
438-
"var": "bp_status_sym_text",
436+
"style": "symbol",
439437
"label": "L ARM",
440438
"bodypart": "arm_l",
441439
"copy-from": "test_bp_status_indicator_template"

src/display.cpp

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,23 +1089,6 @@ static const std::string &sym_for_bp_status( const bodypart_status &stat )
10891089
return sym == symmap.end() ? none : sym->second;
10901090
}
10911091

1092-
std::string display::colorized_bodypart_status_sym_text( const Character &u, const bodypart_id &bp,
1093-
const std::string &wgt_id )
1094-
{
1095-
std::string ret;
1096-
widget_id wid( wgt_id );
1097-
for( const auto &bpcol : bodypart_status_colors( u, bp, wgt_id ) ) {
1098-
std::string sym;
1099-
if( wid.is_valid() ) {
1100-
// Check if there's a phrase defining this status' symbol
1101-
sym = widget_phrase::get_sym_for_id( io::enum_to_string( bpcol.first ), wid );
1102-
}
1103-
sym = sym.empty() ? sym_for_bp_status( bpcol.first ) : sym;
1104-
ret += colorize( sym, bpcol.second );
1105-
}
1106-
return ret;
1107-
}
1108-
11091092
std::string display::colorized_bodypart_status_legend_text( const Character &u,
11101093
const std::set<bodypart_id> &bplist, const std::string &wgt_id, int width, int max_height,
11111094
int &height )

src/display.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,6 @@ std::pair<std::string, nc_color> move_mode_letter_color( const Character &u );
102102
std::pair<std::string, nc_color> move_mode_text_color( const Character &u );
103103
// Movement counter and mode letter, like "50(R)" or "100(W)"
104104
std::pair<std::string, nc_color> move_count_and_mode_text_color( const avatar &u );
105-
// Current body part status (bleeding, bitten, infected) phrase, fully colorized
106-
std::string colorized_bodypart_status_sym_text( const Character &u, const bodypart_id &bp,
107-
const std::string &wgt_id );
108105
std::string colorized_bodypart_status_legend_text( const Character &u,
109106
const std::set<bodypart_id> &bplist, const std::string &wgt_id, int width, int max_height,
110107
int &height );

src/widget.cpp

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,6 @@ std::string enum_to_string<widget_var>( widget_var data )
124124
return "body_temp_text";
125125
case widget_var::bp_armor_outer_text:
126126
return "bp_armor_outer_text";
127-
case widget_var::bp_status_sym_text:
128-
return "bp_status_sym_text";
129127
case widget_var::bp_status_legend_text:
130128
return "bp_status_legend_text";
131129
case widget_var::date_text:
@@ -839,7 +837,6 @@ bool widget::uses_text_function()
839837
case widget_var::activity_text:
840838
case widget_var::body_temp_text:
841839
case widget_var::bp_armor_outer_text:
842-
case widget_var::bp_status_sym_text:
843840
case widget_var::bp_status_legend_text:
844841
case widget_var::compass_text:
845842
case widget_var::compass_legend_text:
@@ -895,7 +892,7 @@ static std::set<bodypart_id> get_bodyparts_from_status_widgets()
895892
{
896893
std::set<bodypart_id> ret;
897894
for( const widget &w : widget::get_all() ) {
898-
if( w._var == widget_var::bp_status_sym_text ) {
895+
if( !w._bps.empty() ) {
899896
ret.emplace( w.only_bp() );
900897
}
901898
}
@@ -928,10 +925,6 @@ std::string widget::color_text_function_string( const avatar &ava, unsigned int
928925
desc.first = display::colorized_bodypart_outer_armor( ava, only_bp() );
929926
apply_color = false; // Item name already colorized by tname
930927
break;
931-
case widget_var::bp_status_sym_text:
932-
desc.first = display::colorized_bodypart_status_sym_text( ava, only_bp(), id.str() );
933-
apply_color = false; // Already colorized
934-
break;
935928
case widget_var::bp_status_legend_text:
936929
desc.first = display::colorized_bodypart_status_legend_text( ava,
937930
get_bodyparts_from_status_widgets(), id.str(),

src/widget.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ enum class widget_var : int {
4646
activity_text, // Activity level text, color string
4747
body_temp_text, // Felt body temperature, color string
4848
bp_armor_outer_text, // Outermost armor on body part, with color/damage bars
49-
bp_status_sym_text, // Status of bodypart (same as above, but shortened to 1 char per status)
5049
bp_status_legend_text, // Legend describing the status indicators from bp_status_sym_text
5150
compass_text, // Compass / visible threats by cardinal direction
5251
compass_legend_text, // Names of visible creatures that appear on the compass

0 commit comments

Comments
 (0)