summaryrefslogtreecommitdiffstats
path: root/src/Entities/Minecart.cpp
diff options
context:
space:
mode:
authorLogicParrot <LogicParrot@users.noreply.github.com>2017-09-02 09:45:06 +0200
committerAlexander Harkness <me@bearbin.net>2017-09-02 09:50:23 +0200
commit49c443896dcac8c4eaf08c4024e8bd2366ad899a (patch)
treeb1ec46cab2b4e5731860c7136f1bbfca6fe9d458 /src/Entities/Minecart.cpp
parentSetSwimState now takes into account head height (diff)
downloadcuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.gz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.bz2
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.lz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.xz
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.tar.zst
cuberite-49c443896dcac8c4eaf08c4024e8bd2366ad899a.zip
Diffstat (limited to 'src/Entities/Minecart.cpp')
-rw-r--r--src/Entities/Minecart.cpp23
1 files changed, 13 insertions, 10 deletions
diff --git a/src/Entities/Minecart.cpp b/src/Entities/Minecart.cpp
index 8921f8894..7f32dc910 100644
--- a/src/Entities/Minecart.cpp
+++ b/src/Entities/Minecart.cpp
@@ -20,7 +20,8 @@
-class cMinecartCollisionCallback
+class cMinecartCollisionCallback :
+ public cEntityCallback
{
public:
cMinecartCollisionCallback(Vector3d a_Pos, double a_Height, double a_Width, UInt32 a_UniqueID, UInt32 a_AttacheeUniqueID) :
@@ -34,31 +35,33 @@ public:
{
}
- bool operator () (cEntity & a_Entity)
+ virtual bool Item(cEntity * a_Entity) override
{
+ ASSERT(a_Entity != nullptr);
+
if (
(
- !a_Entity.IsPlayer() ||
- static_cast<cPlayer &>(a_Entity).IsGameModeSpectator() // Spectators doesn't collide with anything
+ !a_Entity->IsPlayer() ||
+ reinterpret_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;
}