Skip to content

Commit 4acd344

Browse files
authored
Default lowest moves option in dispose dialogue (#82547)
2 parents aefd0fa + 897f21e commit 4acd344

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/character_inventory.cpp

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,11 +813,21 @@ bool Character::dispose_item( item_location &&obj, const std::string &prompt )
813813
menu.text += std::string( w + 2 - utf8_width( menu.text, true ), ' ' );
814814
menu.text += _( " | Moves " );
815815

816+
int min_moves = INT_MAX;
817+
int min_moves_i = 0;
818+
int index = 0;
816819
for( const dispose_option &e : opts ) {
820+
if( e.moves > 0 && e.moves < min_moves ) {
821+
min_moves = e.moves;
822+
min_moves_i = index;
823+
}
817824
menu.addentry( -1, e.enabled, e.invlet, string_format( e.enabled ? "%s | %-7d" : "%s |",
818825
e.prompt, e.moves ) );
826+
index++;
819827
}
820828

829+
menu.set_selected( min_moves_i );
830+
821831
menu.query();
822832
if( menu.ret >= 0 ) {
823833
return opts[menu.ret].action();

0 commit comments

Comments
 (0)