summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r--src/Entities/Minecart.cpp23
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;
}