Skip to content

Commit 3e04a29

Browse files
authored
Merge pull request #75737 from db48x/wrap-text-in-martial-arts-window
wrap the text in the martial arts selection window
2 parents 74006ee + 6a74ebd commit 3e04a29

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/character.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13349,6 +13349,11 @@ bool Character::can_lift( const T &obj ) const
1334913349
template bool Character::can_lift<item>( const item &obj ) const;
1335013350
template bool Character::can_lift<vehicle>( const vehicle &obj ) const;
1335113351

13352+
static std::string wrap60( const std::string &text )
13353+
{
13354+
return string_join( foldstring( text, 60 ), "\n" );
13355+
}
13356+
1335213357
bool character_martial_arts::pick_style( const Character &you ) // Style selection menu
1335313358
{
1335413359
enum style_selection {
@@ -13379,9 +13384,8 @@ bool character_martial_arts::pick_style( const Character &you ) // Style selecti
1337913384
ctxt.register_action( "SHOW_DESCRIPTION" );
1338013385

1338113386
uilist kmenu;
13382-
kmenu.text = string_format( _( "Select a style.\n"
13383-
"\n"
13384-
"STR: <color_white>%d</color>, DEX: <color_white>%d</color>, "
13387+
kmenu.title = _( "Select a style.\n" );
13388+
kmenu.text = string_format( _( "STR: <color_white>%d</color>, DEX: <color_white>%d</color>, "
1338513389
"PER: <color_white>%d</color>, INT: <color_white>%d</color>\n"
1338613390
"Press [<color_yellow>%s</color>] for technique details and compatible weapons.\n" ),
1338713391
you.get_str(), you.get_dex(), you.get_per(), you.get_int(),
@@ -13393,7 +13397,7 @@ bool character_martial_arts::pick_style( const Character &you ) // Style selecti
1339313397
kmenu.desc_enabled = true;
1339413398
kmenu.addentry_desc( KEEP_HANDS_FREE, true, 'h',
1339513399
keep_hands_free ? _( "Keep hands free (on)" ) : _( "Keep hands free (off)" ),
13396-
_( "When this is enabled, player won't wield things unless explicitly told to." ) );
13400+
wrap60( _( "When this is enabled, player won't wield things unless explicitly told to." ) ) );
1339713401

1339813402
kmenu.selected = STYLE_OFFSET;
1339913403

@@ -13412,7 +13416,8 @@ bool character_martial_arts::pick_style( const Character &you ) // Style selecti
1341213416
kmenu.selected = i + STYLE_OFFSET;
1341313417
entry_text = colorize( entry_text, c_pink );
1341413418
}
13415-
kmenu.addentry_desc( i + STYLE_OFFSET, true, -1, entry_text, style.description.translated() );
13419+
kmenu.addentry_desc( i + STYLE_OFFSET, true, -1, entry_text,
13420+
wrap60( style.description.translated() ) );
1341613421
}
1341713422

1341813423
kmenu.query();

src/newcharacter.cpp

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,11 @@ void Character::pick_name( bool bUseDefault )
378378
}
379379
}
380380

381+
static std::string wrap60( const std::string &text )
382+
{
383+
return string_join( foldstring( text, 60 ), "\n" );
384+
}
385+
381386
static matype_id choose_ma_style( const character_type type, const std::vector<matype_id> &styles,
382387
const avatar &u )
383388
{
@@ -393,9 +398,8 @@ static matype_id choose_ma_style( const character_type type, const std::vector<m
393398

394399
uilist menu;
395400
menu.allow_cancel = false;
396-
menu.text = string_format( _( "Select a style.\n"
397-
"\n"
398-
"STR: <color_white>%d</color>, DEX: <color_white>%d</color>, "
401+
menu.title = _( "Select a style.\n" );
402+
menu.text = string_format( _( "STR: <color_white>%d</color>, DEX: <color_white>%d</color>, "
399403
"PER: <color_white>%d</color>, INT: <color_white>%d</color>\n"
400404
"Press [<color_yellow>%s</color>] for technique details and compatible weapons.\n" ),
401405
u.get_str(), u.get_dex(), u.get_per(), u.get_int(),
@@ -408,7 +412,7 @@ static matype_id choose_ma_style( const character_type type, const std::vector<m
408412

409413
for( const matype_id &s : styles ) {
410414
const martialart &style = s.obj();
411-
menu.addentry_desc( style.name.translated(), style.description.translated() );
415+
menu.addentry_desc( style.name.translated(), wrap60( style.description.translated() ) );
412416
}
413417
while( true ) {
414418
menu.query( true );

0 commit comments

Comments
 (0)