Skip to content

Commit

Permalink
Merge pull request #40237 from anothersimulacrum/exp-bl-1
Browse files Browse the repository at this point in the history
Expand blacklisting to all map item placement functions
  • Loading branch information
kevingranade authored May 6, 2020
2 parents f48ecfc + a8765aa commit 03af8b2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/map.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4128,6 +4128,10 @@ item &map::add_item_or_charges( const tripoint &pos, item obj, bool overflow )
return add_item( tile, obj );
};

if( item_is_blacklisted( obj.typeId() ) ) {
return null_item_reference();
}

// Some items never exist on map as a discrete item (must be contained by another item)
if( obj.has_flag( "NO_DROP" ) ) {
return null_item_reference();
Expand Down Expand Up @@ -4186,6 +4190,10 @@ item &map::add_item_or_charges( const tripoint &pos, item obj, bool overflow )

item &map::add_item( const tripoint &p, item new_item )
{
if( item_is_blacklisted( new_item.typeId() ) ) {
return null_item_reference();
}

if( !inbounds( p ) ) {
return null_item_reference();
}
Expand Down
4 changes: 3 additions & 1 deletion src/requirements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,9 @@ void inline_requirements( std::vector< std::vector<T> > &list, Getter getter )
iter = vec.erase( iter );

const auto &to_inline = getter( multiplied );
vec.insert( iter, to_inline.front().begin(), to_inline.front().end() );
if( !to_inline.empty() ) {
vec.insert( iter, to_inline.front().begin(), to_inline.front().end() );
}
}
}
}
Expand Down

0 comments on commit 03af8b2

Please sign in to comment.