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

Fixed "Wielding MBR vest with magazines allow to duplicate magazines #33189" #33422

Merged
merged 1 commit into from
Aug 21, 2019
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
12 changes: 8 additions & 4 deletions src/pickup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,10 @@ bool pick_one_up( item_location &loc, int quantity, bool &got_water, bool &offer
// We already checked in do_pickup if this was a nullptr
// Make copies so the original remains untouched if we bail out
item_location newloc = loc;
item newit = *newloc.get_item();
//original item reference
item &it = *newloc.get_item();
//new item (copy)
item newit = it;
item leftovers = newit;

const auto wield_check = u.can_wield( newit );
Expand Down Expand Up @@ -263,7 +266,8 @@ bool pick_one_up( item_location &loc, int quantity, bool &got_water, bool &offer
break;
case WIELD:
if( wield_check.success() ) {
picked_up = u.wield( newit );
//using original item, possibly modifying it
picked_up = u.wield( it );
if( u.weapon.invlet ) {
add_msg( m_info, _( "Wielding %c - %s" ), u.weapon.invlet,
u.weapon.display_name() );
Expand All @@ -279,8 +283,8 @@ bool pick_one_up( item_location &loc, int quantity, bool &got_water, bool &offer
debugmsg( "Tried to spill contents from an empty container" );
break;
}

picked_up = loc.get_item()->spill_contents( u );
//using original item, possibly modifying it
picked_up = it.spill_contents( u );
if( !picked_up ) {
break;
}
Expand Down