Skip to content

Commit

Permalink
game: allow collapsing all standard pockets
Browse files Browse the repository at this point in the history
from the item menu too for consitency
  • Loading branch information
andrei8l committed Apr 13, 2022
1 parent d51ef06 commit 666790f
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1709,23 +1709,17 @@ static hint_rating rate_action_eat( const avatar &you, const item &it )

static hint_rating rate_action_collapse( const item &it )
{
if( it.is_container() ) {
for( const item_pocket *pocket : it.get_all_contained_pockets().value() ) {
if( !pocket->settings.is_collapsed() ) {
return hint_rating::good;
}
for( const item_pocket *pocket : it.get_all_standard_pockets().value() ) {
if( !pocket->settings.is_collapsed() ) {
return hint_rating::good;
}
return hint_rating::cant;
}
return hint_rating::cant;
}

static hint_rating rate_action_expand( const item &it )
{
if( !it.is_container() ) {
return hint_rating::cant;
}
for( const item_pocket *pocket : it.get_all_contained_pockets().value() ) {
for( const item_pocket *pocket : it.get_all_standard_pockets().value() ) {
if( pocket->settings.is_collapsed() ) {
return hint_rating::good;
}
Expand Down Expand Up @@ -2131,10 +2125,8 @@ int game::inventory_item_menu( item_location locThisItem,
break;
case '<':
case '>':
if( oThisItem.is_container() ) {
for( item_pocket *pocket : oThisItem.get_all_contained_pockets().value() ) {
pocket->settings.set_collapse( cMenu == '>' );
}
for( item_pocket *pocket : oThisItem.get_all_standard_pockets().value() ) {
pocket->settings.set_collapse( cMenu == '>' );
}
break;
default:
Expand Down

0 comments on commit 666790f

Please sign in to comment.