Skip to content

Commit

Permalink
Merge pull request #38503 from davidpwbrown/stop_crashy_pickup_activity
Browse files Browse the repository at this point in the history
Stop crashing when NPC picks up item in fetching activity
  • Loading branch information
ZhilkinSerg authored Mar 2, 2020
2 parents f76b2fe + 8ba4250 commit 8aff074
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/activity_item_handling.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1991,18 +1991,18 @@ static void fetch_activity( player &p, const tripoint &src_loc,
}
it.set_var( "activity_var", p.name );
p.i_add( it );
items_there.erase( item_iter );
// If we didn't pick up a whole stack, put the remainder back where it came from.
if( leftovers.charges > 0 ) {
g->m.add_item_or_charges( src_loc, leftovers );
}
if( p.is_npc() ) {
if( pickup_count == 1 ) {
add_msg( _( "%1$s picks up a %2$s." ), p.disp_name(), it.tname() );
} else {
add_msg( _( "%s picks up several items." ), p.disp_name() );
}
}
items_there.erase( item_iter );
// If we didn't pick up a whole stack, put the remainder back where it came from.
if( leftovers.charges > 0 ) {
g->m.add_item_or_charges( src_loc, leftovers );
}
return;
}
}
Expand Down

0 comments on commit 8aff074

Please sign in to comment.