summaryrefslogtreecommitdiffstats
path: root/src/Entities/Entity.h
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-21 23:49:06 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-21 23:49:06 +0200
commit8050a5b98a3003c2a4bed39b896b4a3a4c1068c0 (patch)
treebb0be233efcf1052125862812569ce3874b4d9d0 /src/Entities/Entity.h
parentBug and crash fixes (diff)
downloadcuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.gz
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.bz2
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.lz
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.xz
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.tar.zst
cuberite-8050a5b98a3003c2a4bed39b896b4a3a4c1068c0.zip
Diffstat (limited to 'src/Entities/Entity.h')
-rw-r--r--src/Entities/Entity.h30
1 files changed, 21 insertions, 9 deletions
diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h
index eea48a12f..58254a493 100644
--- a/src/Entities/Entity.h
+++ b/src/Entities/Entity.h
@@ -382,16 +382,19 @@ public:
/// Teleports to the coordinates specified
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ);
- /** Moves entity to specified world */
- virtual bool MoveToWorld(const AString & a_WorldName, cWorld * a_World = NULL, bool a_ShouldSendRespawn = true);
+ /** Moves entity to specified world, taking a world pointer */
+ virtual bool MoveToWorld(cWorld * a_World, bool a_ShouldSendRespawn = true);
+
+ /** Moves entity to specified world, taking a world name */
+ bool MoveToWorld(const AString & a_WorldName, bool a_ShouldSendRespawn = true);
// tolua_end
/** Returns if the entity is travelling away from a specified world */
- bool IsWorldTravellingFrom(cWorld * a_World) const { return (m_WorldTravellingFrom == a_World); }
+ bool IsWorldTravellingFrom(cWorld * a_World) const { return m_WorldTravellingFrom == a_World; }
/** Sets the world the entity will be leaving */
- void SetWorldTravellingFrom(cWorld * a_World) { (m_WorldTravellingFrom = a_World); }
+ void SetWorldTravellingFrom(cWorld * a_World) { m_WorldTravellingFrom = a_World; }
/// Updates clients of changes in the entity.
virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = NULL);
@@ -538,11 +541,20 @@ protected:
int m_AirLevel;
int m_AirTickTimer;
- /** Portal delay timer and cooldown boolean
- First value is to delay sending the respawn packet (which triggers the Entering the {Dimension} screen).
- Second value is to prevent a teleportation loop by ensuring we do not reenter a portal that we came out of.
- */
- std::pair<unsigned short, bool> m_PortalCooldownData;
+ /** Structure storing the portal delay timer and cooldown boolean */
+ struct sPortalCooldownData
+ {
+ /** Ticks since entry of portal, used to delay teleportation */
+ unsigned short m_TicksDelayed;
+
+ /** Whether the entity has just exited the portal, and should therefore not be teleported again
+ This prevents teleportation loops, and is reset when the entity has moved out of the portal
+ */
+ bool m_ShouldPreventTeleportation;
+ };
+
+ /** Portal delay timer and cooldown boolean data */
+ sPortalCooldownData m_PortalCooldownData;
private:
/** Measured in degrees, [-180, +180) */