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: crafted items no longer try to set default ammotype for items spawned empty #6009

Merged
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
4 changes: 4 additions & 0 deletions src/crafting.cpp
Original file line number Diff line number Diff line change
@@ -687,7 +687,7 @@
pgettext( "furniture, item", "Not enough space on the %s. <npcname> drops the %s on the ground." ),
vp->part().name(), newit->tname() );

return set_item_map( loc, std::move( newit ) );

Check warning on line 690 in src/crafting.cpp

GitHub Actions / build

return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]

} else {
if( here.has_furn( loc ) ) {
@@ -702,7 +702,7 @@
pgettext( "item", "<npcname> puts the %s on the ground." ),
newit->tname() );
}
return set_item_map( loc, std::move( newit ) );

Check warning on line 705 in src/crafting.cpp

GitHub Actions / build

return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
}
}

@@ -718,7 +718,7 @@
return;
}

return set_item_map_or_vehicle( p, p.pos(), std::move( newit ) );

Check warning on line 721 in src/crafting.cpp

GitHub Actions / build

return statement within a void function should not have a specified return value [readability-avoid-return-with-void-value]
}

item *player::start_craft( craft_command &command, const tripoint & )
@@ -1150,6 +1150,10 @@
food_contained.set_owner( p.get_faction()->id );
}

// If we created a tool that spawns empty, don't preset its ammotype.
if( !newit->ammo_remaining() ) {
newit->ammo_unset();
}
if( newit->made_of( LIQUID ) ) {
liquid_handler::handle_all_liquid( std::move( newit ), PICKUP_RANGE );
} else {
@@ -2377,7 +2381,7 @@
bench_type best_type = bench_here.first;
float best_bench_multi = bench_here.second;
tripoint best_loc = p.pos();
std::vector<tripoint> reachable( PICKUP_RANGE * PICKUP_RANGE );

Check warning on line 2384 in src/crafting.cpp

GitHub Actions / build

performing an implicit widening conversion to type 'size_type' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result]
g->m.reachable_flood_steps( reachable, p.pos(), PICKUP_RANGE, 1, 100 );
for( const tripoint &adj : reachable ) {
if( const cata::value_ptr<furn_workbench_info> &wb = g->m.furn( adj ).obj().workbench ) {
Loading