Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix dropping worn items from AIM #50452

Merged
merged 1 commit into from
Aug 4, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 6 additions & 12 deletions src/advanced_inv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1349,15 +1349,12 @@ bool advanced_inventory::action_move_item( advanced_inv_listitem *sitem,
// if worn, we need to fix with the worn index number (starts at -2, as -1 is weapon)
int idx = srcarea == AIM_INVENTORY ? sitem->idx : player::worn_position_to_index( sitem->idx ) + 1;

// make sure advanced inventory is reopened after activity completion.
do_return_entry();

if( srcarea == AIM_WORN && destarea == AIM_INVENTORY ) {
// this is ok because worn items are never stacked (can't move more than 1).
player_character.takeoff( idx );

// make sure advanced inventory is reopened after activity completion.
do_return_entry();

// exit so that the action can be carried out
exit = true;
} else {
// important if item is worn
if( player_character.can_drop( *sitem->items.front() ).success() ) {
Expand All @@ -1380,14 +1377,11 @@ bool advanced_inventory::action_move_item( advanced_inv_listitem *sitem,
player_character.assign_activity( player_activity( drop_activity_actor(
to_drop, placement, force_ground
) ) );

// make sure advanced inventory is reopened after activity completion.
do_return_entry();

// exit so that the activity can be carried out
exit = true;
}
}

// exit so that the activity can be carried out
exit = true;
} else {
bool can_stash = false;
if( sitem->items.front()->count_by_charges() ) {
Expand Down