summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
authorpeterbell10 <peterbell10@live.co.uk>2017-09-01 13:04:50 +0200
committerMattes D <github@xoft.cz>2017-09-01 13:04:50 +0200
commit496c337cdfa593654018c171f6a74c28272265b5 (patch)
treefab48316d8fd6de97500ca1b8c8c5792eb578acc /src/Entities/Minecart.cpp
parentUpdate Core plugin (diff)
downloadcuberite-496c337cdfa593654018c171f6a74c28272265b5.tar
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.gz
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.bz2
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.lz
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.xz
cuberite-496c337cdfa593654018c171f6a74c28272265b5.tar.zst
cuberite-496c337cdfa593654018c171f6a74c28272265b5.zip
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;
}