diff options
author | tycho <work.tycho@gmail.com> | 2015-05-28 13:29:26 +0200 |
---|---|---|
committer | tycho <work.tycho@gmail.com> | 2015-05-28 13:54:04 +0200 |
commit | b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0 (patch) | |
tree | ff9846d0ffa558e237ea148762f67b5ebf71a47d /src/Mobs | |
parent | Merge branch 'master' into PreventNewWarnings (diff) | |
download | cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.tar cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.tar.gz cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.tar.bz2 cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.tar.lz cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.tar.xz cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.tar.zst cuberite-b2fa71a32ac8bd86bda778a5d54fe2e7e471a1c0.zip |
Diffstat (limited to 'src/Mobs')
-rw-r--r-- | src/Mobs/Guardian.cpp | 6 | ||||
-rw-r--r-- | src/Mobs/Horse.cpp | 8 | ||||
-rw-r--r-- | src/Mobs/Path.cpp | 18 | ||||
-rw-r--r-- | src/Mobs/Squid.cpp | 6 |
4 files changed, 19 insertions, 19 deletions
diff --git a/src/Mobs/Guardian.cpp b/src/Mobs/Guardian.cpp index 6efd4a42b..cfe7861a6 100644 --- a/src/Mobs/Guardian.cpp +++ b/src/Mobs/Guardian.cpp @@ -43,13 +43,13 @@ void cGuardian::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) Vector3d Pos = GetPosition(); // TODO: Not a real behavior, but cool :D - int RelY = static_cast<int>(floor(Pos.y)); + int RelY = FloorC(Pos.y); if ((RelY < 0) || (RelY >= cChunkDef::Height)) { return; } - int RelX = static_cast<int>(floor(Pos.x)) - a_Chunk.GetPosX() * cChunkDef::Width; - int RelZ = static_cast<int>(floor(Pos.z)) - a_Chunk.GetPosZ() * cChunkDef::Width; + int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width; + int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width; BLOCKTYPE BlockType; if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire()) { diff --git a/src/Mobs/Horse.cpp b/src/Mobs/Horse.cpp index 4321fdc73..ce3bd65eb 100644 --- a/src/Mobs/Horse.cpp +++ b/src/Mobs/Horse.cpp @@ -55,10 +55,10 @@ void cHorse::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) { if (m_World->GetTickRandomNumber(50) == 25) { - m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 0); - m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 2); - m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 6); - m_World->BroadcastSoundParticleEffect(2000, static_cast<int>(GetPosX()), static_cast<int>(GetPosY()), static_cast<int>(GetPosZ()), 8); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 0); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 2); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 6); + m_World->BroadcastSoundParticleEffect(2000, FloorC(GetPosX()), FloorC(GetPosY()), FloorC(GetPosZ()), 8); m_Attachee->Detach(); m_bIsRearing = true; diff --git a/src/Mobs/Path.cpp b/src/Mobs/Path.cpp index 4d04d9861..1848e144e 100644 --- a/src/Mobs/Path.cpp +++ b/src/Mobs/Path.cpp @@ -46,18 +46,18 @@ cPath::cPath( a_BoundingBoxWidth = 1; // Until we improve physics, if ever. - m_BoundingBoxWidth = static_cast<int>(ceil(a_BoundingBoxWidth)); - m_BoundingBoxHeight = static_cast<int>(ceil(a_BoundingBoxHeight)); + m_BoundingBoxWidth = CeilC(a_BoundingBoxWidth); + m_BoundingBoxHeight = CeilC(a_BoundingBoxHeight); m_HalfWidth = a_BoundingBoxWidth / 2; - int HalfWidthInt = static_cast<int>(a_BoundingBoxWidth / 2); - m_Source.x = static_cast<int>(floor(a_StartingPoint.x - HalfWidthInt)); - m_Source.y = static_cast<int>(floor(a_StartingPoint.y)); - m_Source.z = static_cast<int>(floor(a_StartingPoint.z - HalfWidthInt)); + int HalfWidthInt = FloorC(a_BoundingBoxWidth / 2); + m_Source.x = FloorC(a_StartingPoint.x - HalfWidthInt); + m_Source.y = FloorC(a_StartingPoint.y); + m_Source.z = FloorC(a_StartingPoint.z - HalfWidthInt); - m_Destination.x = static_cast<int>(floor(a_EndingPoint.x - HalfWidthInt)); - m_Destination.y = static_cast<int>(floor(a_EndingPoint.y)); - m_Destination.z = static_cast<int>(floor(a_EndingPoint.z - HalfWidthInt)); + m_Destination.x = FloorC(a_EndingPoint.x - HalfWidthInt); + m_Destination.y = FloorC(a_EndingPoint.y); + m_Destination.z = FloorC(a_EndingPoint.z - HalfWidthInt); if (GetCell(m_Source)->m_IsSolid || GetCell(m_Destination)->m_IsSolid) { diff --git a/src/Mobs/Squid.cpp b/src/Mobs/Squid.cpp index 7928f7dc8..d148d65f3 100644 --- a/src/Mobs/Squid.cpp +++ b/src/Mobs/Squid.cpp @@ -41,13 +41,13 @@ void cSquid::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) Vector3d Pos = GetPosition(); // TODO: Not a real behavior, but cool :D - int RelY = static_cast<int>(floor(Pos.y)); + int RelY = FloorC(Pos.y); if ((RelY < 0) || (RelY >= cChunkDef::Height)) { return; } - int RelX = static_cast<int>(floor(Pos.x)) - a_Chunk.GetPosX() * cChunkDef::Width; - int RelZ = static_cast<int>(floor(Pos.z)) - a_Chunk.GetPosZ() * cChunkDef::Width; + int RelX = FloorC(Pos.x) - a_Chunk.GetPosX() * cChunkDef::Width; + int RelZ = FloorC(Pos.z) - a_Chunk.GetPosZ() * cChunkDef::Width; BLOCKTYPE BlockType; if (a_Chunk.UnboundedRelGetBlockType(RelX, RelY, RelZ, BlockType) && !IsBlockWater(BlockType) && !IsOnFire()) { |