summaryrefslogtreecommitdiffstats
path: root/src/Physics/Explodinator.cpp
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@outlook.com>2020-09-30 01:08:43 +0200
committerTiger Wang <ziwei.tiger@outlook.com>2020-09-30 01:08:43 +0200
commitecfb9a8f1efd7a826c9060acd2a68bcf2726092a (patch)
tree12d53a2eb349e1f7ee80e176a9b2ac2163193bb6 /src/Physics/Explodinator.cpp
parentRemove allocation in getting all the blocks to test (diff)
downloadcuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.tar
cuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.tar.gz
cuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.tar.bz2
cuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.tar.lz
cuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.tar.xz
cuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.tar.zst
cuberite-ecfb9a8f1efd7a826c9060acd2a68bcf2726092a.zip
Diffstat (limited to 'src/Physics/Explodinator.cpp')
-rw-r--r--src/Physics/Explodinator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Physics/Explodinator.cpp b/src/Physics/Explodinator.cpp
index ca8b82b9b..b3e8f58f1 100644
--- a/src/Physics/Explodinator.cpp
+++ b/src/Physics/Explodinator.cpp
@@ -67,7 +67,7 @@ namespace Explodinator
}
}
- return static_cast<float>(Unobstructed) / Total;
+ return (Total == 0) ? 0 : (static_cast<float>(Unobstructed) / Total);
}
/** Applies distance-based damage and knockback to all entities within the explosion's effect range. */
@@ -179,7 +179,7 @@ namespace Explodinator
// The total displacement the ray must travel.
const auto TraceDisplacement = (a_Destination - a_Origin);
- // The displacement that they ray in one iteration step should travel.
+ // The displacement that the ray in one iteration step should travel.
const auto Step = TraceDisplacement.NormalizeCopy() * StepUnit;
// Loop until we've reached the prescribed destination: