Skip to content

Commit

Permalink
Merge pull request #76498 from Brambor/rm-parameter-avatar
Browse files Browse the repository at this point in the history
Refactor: Remove unnecessary parameter `avatar`
  • Loading branch information
Maleclypse authored Sep 19, 2024
2 parents 1fca5fa + 86dc093 commit edd4099
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 96 deletions.
2 changes: 1 addition & 1 deletion src/activity_actor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6352,7 +6352,7 @@ void pickup_menu_activity_actor::do_turn( player_activity &, Character &who )
std::optional<tripoint_bub_ms> p( where );
std::vector<drop_location> s( selection );
who.cancel_activity();
who.pick_up( game_menus::inv::pickup( *who.as_avatar(), p, s ) );
who.pick_up( game_menus::inv::pickup( p, s ) );
}

void pickup_menu_activity_actor::serialize( JsonOut &jsout ) const
Expand Down
8 changes: 4 additions & 4 deletions src/activity_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2804,27 +2804,27 @@ void activity_handlers::eat_menu_do_turn( player_activity *, Character *you )
}

avatar &player_character = get_avatar();
avatar_action::eat_or_use( player_character, game_menus::inv::consume( player_character ) );
avatar_action::eat_or_use( player_character, game_menus::inv::consume() );
}

void activity_handlers::consume_food_menu_do_turn( player_activity *, Character * )
{
avatar &player_character = get_avatar();
item_location loc = game_menus::inv::consume_food( player_character );
item_location loc = game_menus::inv::consume_food();
avatar_action::eat( player_character, loc );
}

void activity_handlers::consume_drink_menu_do_turn( player_activity *, Character * )
{
avatar &player_character = get_avatar();
item_location loc = game_menus::inv::consume_drink( player_character );
item_location loc = game_menus::inv::consume_drink();
avatar_action::eat( player_character, loc );
}

void activity_handlers::consume_meds_menu_do_turn( player_activity *, Character * )
{
avatar &player_character = get_avatar();
avatar_action::eat_or_use( player_character, game_menus::inv::consume_meds( player_character ) );
avatar_action::eat_or_use( player_character, game_menus::inv::consume_meds() );
}

void activity_handlers::move_loot_do_turn( player_activity *act, Character *you )
Expand Down
2 changes: 1 addition & 1 deletion src/avatar_action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ void avatar_action::use_item( avatar &you, item_location &loc, std::string const
bool use_in_place = false;

if( !loc ) {
loc = game_menus::inv::use( you );
loc = game_menus::inv::use();

if( !loc ) {
add_msg( _( "Never mind." ) );
Expand Down
22 changes: 11 additions & 11 deletions src/game.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ int game::inventory_item_menu( item_location locThisItem,
if( !locThisItem.get_item()->is_container() ) {
avatar_action::eat( u, locThisItem );
} else {
avatar_action::eat_or_use( u, game_menus::inv::consume( u, locThisItem ) );
avatar_action::eat_or_use( u, game_menus::inv::consume( locThisItem ) );
}
break;
case 'W': {
Expand Down Expand Up @@ -2355,16 +2355,16 @@ int game::inventory_item_menu( item_location locThisItem,
}
case 'i':
if( oThisItem.is_container() ) {
game_menus::inv::insert_items( u, locThisItem );
game_menus::inv::insert_items( locThisItem );
}
break;
case 'o':
if( oThisItem.is_container() && oThisItem.num_item_stacks() > 0 ) {
game_menus::inv::common( locThisItem, u );
game_menus::inv::common( locThisItem );
}
break;
case '=':
game_menus::inv::reassign_letter( u, oThisItem );
game_menus::inv::reassign_letter( oThisItem );
break;
case KEY_PPAGE:
iScrollPos -= iScrollHeight;
Expand Down Expand Up @@ -6056,13 +6056,13 @@ void game::pickup()
return;
}
// Pick up items only from the selected tile
u.pick_up( game_menus::inv::pickup( u, *where_ ) );
u.pick_up( game_menus::inv::pickup( *where_ ) );
}

void game::pickup_all()
{
// Pick up items from current and all adjacent tiles
u.pick_up( game_menus::inv::pickup( u ) );
u.pick_up( game_menus::inv::pickup() );
}

void game::pickup( const tripoint &p )
Expand All @@ -6079,7 +6079,7 @@ void game::pickup( const tripoint_bub_ms &p )
add_draw_callback( hilite_cb );

// Pick up items only from the selected tile
u.pick_up( game_menus::inv::pickup( u, p ) );
u.pick_up( game_menus::inv::pickup( p ) );
}

//Shift player by one tile, look_around(), then restore previous position.
Expand Down Expand Up @@ -8447,7 +8447,7 @@ game::vmenu_ret game::list_items( const std::vector<map_item_stack> &item_list )
do {
bool recalc_unread = false;
if( action == "COMPARE" && activeItem ) {
game_menus::inv::compare( u, active_pos );
game_menus::inv::compare( active_pos );
recalc_unread = highlight_unread_items;
} else if( action == "FILTER" ) {
ui.invalidate_ui();
Expand Down Expand Up @@ -9077,13 +9077,13 @@ void game::insert_item()
return;
}

game_menus::inv::insert_items( u, item_loc );
game_menus::inv::insert_items( item_loc );
}

void game::unload_container()
{
if( const std::optional<tripoint> pnt = choose_adjacent( _( "Unload where?" ) ) ) {
u.drop( game_menus::inv::unload_container( u ), *pnt );
u.drop( game_menus::inv::unload_container(), *pnt );
}
}

Expand Down Expand Up @@ -10044,7 +10044,7 @@ void game::wield( item_location loc )

void game::wield()
{
item_location loc = game_menus::inv::wield( u );
item_location loc = game_menus::inv::wield();

if( loc ) {
wield( loc );
Expand Down
Loading

0 comments on commit edd4099

Please sign in to comment.