Skip to content

Commit

Permalink
Backporting CleverRaven#51096 Prevent inserting an item with NO_UNWIE…
Browse files Browse the repository at this point in the history
…LD into a container
  • Loading branch information
BrettDong authored and ZhilkinSerg committed Nov 27, 2021
1 parent 0d755db commit 4c58201
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/item_pocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,6 +997,11 @@ void item_pocket::favorite_info( std::vector<iteminfo> &info )

ret_val<item_pocket::contain_code> item_pocket::can_contain( const item &it ) const
{
if( it.has_flag( flag_NO_UNWIELD ) ) {
return ret_val<item_pocket::contain_code>::make_failure(
contain_code::ERR_MOD, _( "cannot unwield item" ) );
}

// To prevent debugmsg. Casings can only be inserted in a magazine during firing.
if( data->type == item_pocket::pocket_type::MAGAZINE && it.has_flag( flag_CASING ) ) {
return ret_val<item_pocket::contain_code>::make_success();
Expand Down

0 comments on commit 4c58201

Please sign in to comment.