Large diffs are not rendered by default.

@@ -203,8 +203,8 @@ void mutation_branch::load( JsonObject &jsobj )
mutation_branch &new_mut = mutation_data[id];

JsonArray jsarr;
new_mut.name = _( jsobj.get_string( "name" ).c_str() );
new_mut.description = _( jsobj.get_string( "description" ).c_str() );
new_mut.raw_name = jsobj.get_string( "name" );
new_mut.raw_desc = jsobj.get_string( "description" );
new_mut.points = jsobj.get_int( "points" );
new_mut.visibility = jsobj.get_int( "visibility", 0 );
new_mut.ugliness = jsobj.get_int( "ugliness", 0 );
@@ -366,6 +366,16 @@ void mutation_branch::load( JsonObject &jsobj )
}
}

const char *mutation_branch::name() const
{
return _( raw_name.c_str() );
}

const char *mutation_branch::desc() const
{
return _( raw_desc.c_str() );
}

static void check_consistency( const std::vector<trait_id> &mvec, const trait_id &mid,
const std::string &what )
{
@@ -415,9 +425,9 @@ nc_color mutation_branch::get_display_color() const
}
}

const std::string &mutation_branch::get_name( const trait_id &mutation_id )
const char *mutation_branch::get_name( const trait_id &mutation_id )
{
return mutation_id->name;
return mutation_id->name();
}

const mutation_branch::MutationMap &mutation_branch::get_all()
@@ -452,7 +462,7 @@ void load_dream( JsonObject &jsobj )

bool trait_display_sort( const trait_id &a, const trait_id &b ) noexcept
{
return a->name < b->name;
return a->name() < b->name();
}

void mutation_branch::load_trait_blacklist( JsonObject &jsobj )
@@ -167,7 +167,7 @@ void player::power_mutations()
break;
}
type = ( has_base_trait( passive[i] ) ? c_cyan : c_light_cyan );
mvwprintz( wBio, list_start_y + i, 2, type, "%c %s", td.key, md.name.c_str() );
mvwprintz( wBio, list_start_y + i, 2, type, "%c %s", td.key, md.name() );
}
}

@@ -189,7 +189,7 @@ void player::power_mutations()
// TODO: track resource(s) used and specify
mvwputch( wBio, list_start_y + i, second_column, type, td.key );
std::ostringstream mut_desc;
mut_desc << md.name;
mut_desc << md.name();
if( md.cost > 0 && md.cooldown > 0 ) {
//~ RU means Resource Units
mut_desc << string_format( _( " - %d RU / %d turns" ),
@@ -230,7 +230,7 @@ void player::power_mutations()
}
redraw = true;
const long newch = popup_getkey( _( "%s; enter new letter." ),
mutation_branch::get_name( mut_id ).c_str() );
mutation_branch::get_name( mut_id ) );
wrefresh( wBio );
if( newch == ch || newch == ' ' || newch == KEY_ESCAPE ) {
continue;
@@ -276,7 +276,7 @@ void player::power_mutations()
if( menu_mode == "activating" ) {
if( mut_data.activated ) {
if( my_mutations[mut_id].powered ) {
add_msg_if_player( m_neutral, _( "You stop using your %s." ), mut_data.name.c_str() );
add_msg_if_player( m_neutral, _( "You stop using your %s." ), mut_data.name() );

deactivate_mutation( mut_id );
// Action done, leave screen
@@ -286,19 +286,19 @@ void player::power_mutations()
( !mut_data.fatigue || get_fatigue() <= 400 ) ) {

g->draw();
add_msg_if_player( m_neutral, _( "You activate your %s." ), mut_data.name.c_str() );
add_msg_if_player( m_neutral, _( "You activate your %s." ), mut_data.name() );
activate_mutation( mut_id );
// Action done, leave screen
break;
} else {
popup( _( "You don't have enough in you to activate your %s!" ), mut_data.name.c_str() );
popup( _( "You don't have enough in you to activate your %s!" ), mut_data.name() );
redraw = true;
continue;
}
} else {
popup( _( "\
You cannot activate %s! To read a description of \
%s, press '!', then '%c'." ), mut_data.name.c_str(), mut_data.name.c_str(),
%s, press '!', then '%c'." ), mut_data.name(), mut_data.name(),
my_mutations[mut_id].key );
redraw = true;
}
@@ -307,7 +307,7 @@ You cannot activate %s! To read a description of \
draw_exam_window( wBio, DESCRIPTION_LINE_Y );
// Clear the lines first
werase( w_description );
fold_and_print( w_description, 0, 0, WIDTH - 2, c_light_blue, mut_data.description );
fold_and_print( w_description, 0, 0, WIDTH - 2, c_light_blue, mut_data.desc() );
wrefresh( w_description );
}
}
@@ -1138,12 +1138,12 @@ tab_direction set_traits( const catacurses::window &w, player &u, points_left &p
points *= -1;
}
mvwprintz( w, 3, 41, col_tr, ngettext( "%s %s %d point", "%s %s %d points", points ),
mdata.name.c_str(),
mdata.name(),
negativeTrait ? _( "earns" ) : _( "costs" ),
points );
fold_and_print( w_description, 0, 0,
TERMX - 2, col_tr,
mdata.description );
mdata.desc() );
}

nc_color cLine = col_off_pas;
@@ -1175,7 +1175,8 @@ tab_direction set_traits( const catacurses::window &w, player &u, points_left &p
int cur_line_y = 5 + i - start_y;
int cur_line_x = 2 + iCurrentPage * page_width;
mvwprintz( w, cur_line_y, cur_line_x, c_light_gray, std::string( page_width, ' ' ).c_str() );
mvwprintz( w, cur_line_y, cur_line_x, cLine, utf8_truncate( mdata.name, page_width - 2 ).c_str() );
mvwprintz( w, cur_line_y, cur_line_x, cLine,
utf8_truncate( mdata.name(), page_width - 2 ).c_str() );
}

for( int i = 0; i < used_pages; i++ ) {
@@ -2212,7 +2213,7 @@ tab_direction set_description( const catacurses::window &w, player &u, const boo
} else {
for( auto &current_trait : current_traits ) {
wprintz( w_traits, c_light_gray, "\n" );
wprintz( w_traits, current_trait->get_display_color(), current_trait->name.c_str() );
wprintz( w_traits, current_trait->get_display_color(), current_trait->name() );
}
}
wrefresh( w_traits );
@@ -1795,7 +1795,7 @@ int npc::print_info( const catacurses::window &w, int line, int vLines, int colu
// @todo: Balance this formula
if( mut_branch.visibility > 0 && mut_branch.visibility >= visibility_cap )
{
return mut_branch.name;
return mut_branch.name();
}

return std::string();
@@ -5026,21 +5026,21 @@ void player::suffer()
if (mdata.hunger){
mod_hunger(mdata.cost);
if (get_hunger() >= 700) { // Well into Famished
add_msg_if_player(m_warning, _("You're too famished to keep your %s going."), mdata.name.c_str());
add_msg_if_player( m_warning, _( "You're too famished to keep your %s going." ), mdata.name() );
tdata.powered = false;
}
}
if (mdata.thirst){
mod_thirst(mdata.cost);
if (get_thirst() >= 260) { // Well into Dehydrated
add_msg_if_player(m_warning, _("You're too dehydrated to keep your %s going."), mdata.name.c_str());
add_msg_if_player( m_warning, _( "You're too dehydrated to keep your %s going." ), mdata.name() );
tdata.powered = false;
}
}
if (mdata.fatigue){
mod_fatigue(mdata.cost);
if (get_fatigue() >= EXHAUSTED) { // Exhausted
add_msg_if_player(m_warning, _("You're too exhausted to keep your %s going."), mdata.name.c_str());
add_msg_if_player( m_warning, _( "You're too exhausted to keep your %s going." ), mdata.name() );
tdata.powered = false;
}
}
@@ -7511,7 +7511,7 @@ ret_val<bool> player::can_wear( const item& it ) const
const auto &branch = mut.obj();
if( branch.conflicts_with_item( it ) ) {
return ret_val<bool>::make_failure( _( "Your %s mutation prevents you from wearing your %s." ),
branch.name.c_str(), it.type_name().c_str() );
branch.name(), it.type_name().c_str() );
}
}
if( it.covers(bp_head) &&
@@ -496,7 +496,7 @@ Strength - 4; Dexterity - 4; Intelligence - 4; Perception - 4" ) );
for( auto &mut : my_mutations ) {
const auto &mdata = mut.first.obj();
if( mdata.threshold ) {
race = mdata.name;
race = mdata.name();
break;
}
}
@@ -573,7 +573,7 @@ Strength - 4; Dexterity - 4; Intelligence - 4; Perception - 4" ) );
for( size_t i = 0; i < traitslist.size() && i < trait_win_size_y; i++ ) {
const auto &mdata = traitslist[i].obj();
const auto color = mdata.get_display_color();
trim_and_print( w_traits, int( i ) + 1, 1, getmaxx( w_traits ) - 1, color, mdata.name );
trim_and_print( w_traits, int( i ) + 1, 1, getmaxx( w_traits ) - 1, color, mdata.name() );
}
wrefresh( w_traits );

@@ -943,13 +943,13 @@ Strength - 4; Dexterity - 4; Intelligence - 4; Perception - 4" ) );
const auto &mdata = traitslist[i].obj();
const auto color = mdata.get_display_color();
trim_and_print( w_traits, int( 1 + i - min ), 1, getmaxx( w_traits ) - 1,
i == line ? hilite( color ) : color, mdata.name );
i == line ? hilite( color ) : color, mdata.name() );
}
if( line < traitslist.size() ) {
const auto &mdata = traitslist[line].obj();
fold_and_print( w_info, 0, 1, FULL_SCREEN_WIDTH - 2, c_magenta, string_format(
"<color_%s>%s</color>: %s", string_from_color( mdata.get_display_color() ),
mdata.name, traitslist[line]->description ) );
mdata.name(), traitslist[line]->desc() ) );
}
wrefresh( w_traits );
wrefresh( w_info );
@@ -972,7 +972,7 @@ Strength - 4; Dexterity - 4; Intelligence - 4; Perception - 4" ) );
mvwprintz( w_traits, int( i + 1 ), 1, c_black, " " );
const auto color = mdata.get_display_color();
trim_and_print( w_traits, int( i + 1 ), 1, getmaxx( w_traits ) - 1,
color, mdata.name );
color, mdata.name() );
}
wrefresh( w_traits );
line = 0;
@@ -168,7 +168,7 @@ class wish_mutate_callback: public uimenu_callback
);
line2 += 2;

std::vector<std::string> desc = foldstring( mdata.description,
std::vector<std::string> desc = foldstring( mdata.desc(),
menu->pad_right - 1 );
for( auto &elem : desc ) {
mvwprintz( menu->window, line2, startx, c_light_gray, elem );
@@ -194,7 +194,7 @@ void debug_menu::wishmutate( player *p )
int c = 0;

for( auto &traits_iter : mutation_branch::get_all() ) {
wmenu.addentry( -1, true, -2, traits_iter.second.name );
wmenu.addentry( -1, true, -2, traits_iter.second.name() );
wmenu.entries[ c ].extratxt.left = 1;
wmenu.entries[ c ].extratxt.txt.clear();
wmenu.entries[ c ].extratxt.color = c_light_green;