Skip to content

Commit

Permalink
Fix mine explosion radius check
Browse files Browse the repository at this point in the history
  • Loading branch information
commandblockguy committed Jan 14, 2021
1 parent 11239e1 commit 1a50187
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/objects/physicsbody.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,10 @@ bool PhysicsBody::center_distance_less_than(PhysicsBody *other, uint dis) const
if((uint)abs((int) other->center_x() - (int) center_x()) > dis) return false;
if((uint)abs((int) other->center_y() - (int) center_y()) > dis) return false;

int delta_x = (other->center_x() - center_x()) >> 8;
int delta_y = (other->center_y() - center_y()) >> 8;
int delta_x = ((int)other->center_x() - (int)center_x());
int delta_y = ((int)other->center_y() - (int)center_y());

return (uint)(delta_x * delta_x + delta_y * delta_y) < (dis >> 8) * (dis >> 8);
return (uint)(delta_x * delta_x + delta_y * delta_y) < dis * dis;
}

// todo: optimize
Expand Down

0 comments on commit 1a50187

Please sign in to comment.