diff options
author | peterbell10 <peterbell10@live.co.uk> | 2017-09-11 23:20:49 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2017-09-11 23:20:49 +0200 |
commit | e225b7f8262df48ad4d7094bc295add3007b0649 (patch) | |
tree | a42e9afcc88cfe6e9d1258458e3ad42764083d0e /src/Entities/Minecart.cpp | |
parent | cBlockArea: change MakeIndex to return size_t (diff) | |
download | cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.gz cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.bz2 cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.lz cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.xz cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.tar.zst cuberite-e225b7f8262df48ad4d7094bc295add3007b0649.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Entities/Minecart.cpp | 23 |
1 files changed, 10 insertions, 13 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp index 7f32dc910..8921f8894 100644 --- a/src/Entities/Minecart.cpp +++ b/src/Entities/Minecart.cpp @@ -20,8 +20,7 @@ -class cMinecartCollisionCallback : - public cEntityCallback +class cMinecartCollisionCallback { public: cMinecartCollisionCallback(Vector3d a_Pos, double a_Height, double a_Width, UInt32 a_UniqueID, UInt32 a_AttacheeUniqueID) : @@ -35,33 +34,31 @@ public: { } - virtual bool Item(cEntity * a_Entity) override + bool operator () (cEntity & a_Entity) { - ASSERT(a_Entity != nullptr); - if ( ( - !a_Entity->IsPlayer() || - reinterpret_cast<cPlayer *>(a_Entity)->IsGameModeSpectator() // Spectators doesn't collide with anything + !a_Entity.IsPlayer() || + static_cast<cPlayer &>(a_Entity).IsGameModeSpectator() // Spectators doesn't collide with anything ) && - !a_Entity->IsMob() && - !a_Entity->IsMinecart() && - !a_Entity->IsBoat() + !a_Entity.IsMob() && + !a_Entity.IsMinecart() && + !a_Entity.IsBoat() ) { return false; } - else if ((a_Entity->GetUniqueID() == m_UniqueID) || (a_Entity->GetUniqueID() == m_AttacheeUniqueID)) + else if ((a_Entity.GetUniqueID() == m_UniqueID) || (a_Entity.GetUniqueID() == m_AttacheeUniqueID)) { return false; } - cBoundingBox bbEntity(a_Entity->GetPosition(), a_Entity->GetWidth() / 2, a_Entity->GetHeight()); + cBoundingBox bbEntity(a_Entity.GetPosition(), a_Entity.GetWidth() / 2, a_Entity.GetHeight()); cBoundingBox bbMinecart(Vector3d(m_Pos.x, floor(m_Pos.y), m_Pos.z), m_Width / 2, m_Height); if (bbEntity.DoesIntersect(bbMinecart)) { - m_CollidedEntityPos = a_Entity->GetPosition(); + m_CollidedEntityPos = a_Entity.GetPosition(); m_DoesIntersect = true; return true; } |