Skip to content

Commit

Permalink
Fixed overlapping vehicle parts check.
Browse files Browse the repository at this point in the history
  • Loading branch information
ipcyborg committed Jan 15, 2020
1 parent cd00378 commit c946aed
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 c946aed

Please sign in to comment.