diff options
author | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-30 01:08:43 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@outlook.com> | 2020-09-30 01:08:43 +0200 |
commit | ecfb9a8f1efd7a826c9060acd2a68bcf2726092a (patch) | |
tree | 12d53a2eb349e1f7ee80e176a9b2ac2163193bb6 | |
parent | Remove allocation in getting all the blocks to test (diff) | |
download | cuberite-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 |
-rw-r--r-- | src/Physics/Explodinator.cpp | 4 | ||||
-rw-r--r-- | src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h | 2 |
2 files changed, 3 insertions, 3 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: diff --git a/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h b/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h index 2ac3ec869..8bf09c9eb 100644 --- a/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h +++ b/src/Simulator/IncrementalRedstoneSimulator/TNTHandler.h @@ -24,7 +24,7 @@ namespace TNTHandler if (Power != 0) { a_Chunk.SetBlock(a_Position, E_BLOCK_AIR, 0); - a_Chunk.GetWorld()->SpawnPrimedTNT(Vector3d(0.5, 0.5, 0.5) + cChunkDef::RelativeToAbsolute(a_Position, a_Chunk.GetPos())); // 80 ticks to boom + a_Chunk.GetWorld()->SpawnPrimedTNT(Vector3d(0.5, 0, 0.5) + cChunkDef::RelativeToAbsolute(a_Position, a_Chunk.GetPos())); // 80 ticks to boom } } |