Skip to content

Commit

Permalink
Merge pull request #37079 from ipcyborg/fix-36638-smash-vehicle
Browse files Browse the repository at this point in the history
Fixed overlapping vehicle parts check
  • Loading branch information
ZhilkinSerg authored Jan 16, 2020
2 parents 33e9a7f + c946aed commit de7416a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/vehicle.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -997,9 +997,11 @@ void vehicle::smash( map &m, float hp_percent_loss_min, float hp_percent_loss_ma
if( p == other_p ) {
continue;
}
if( ( part_info( p ).location.empty() &&
part_info( p ).get_id() == part_info( other_p ).get_id() ) ||
( part_info( p ).location == part_info( other_p ).location ) ) {
const vpart_info &p_info = part_info( p );
const vpart_info &other_p_info = part_info( other_p );

if( p_info.get_id() == other_p_info.get_id() ||
( !p_info.location.empty() && p_info.location == other_p_info.location ) ) {
// Deferred creation of the handler to here so it is only created when actually needed.
if( !handler_ptr ) {
// This is a heuristic: we just assume the default handler is good enough when called
Expand Down

0 comments on commit de7416a

Please sign in to comment.