From f8d1e96ae7ac9a3483ff0a214796455946d7880f Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:25:45 -0700 Subject: Use static casts instead of C casts, add floor-cast functions --- src/Entities/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 3fa7e80c1..0a03eb3f2 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT (int)floor(GetPosX()) -#define POSY_TOINT (int)floor(GetPosY()) -#define POSZ_TOINT (int)floor(GetPosZ()) +#define POSX_TOINT FloorD(GetPosX()) +#define POSY_TOINT FloorD(GetPosY()) +#define POSZ_TOINT FloorD(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } -- cgit v1.2.3 From 76b37acb421bf10e094182b2e9be111eb29c46f1 Mon Sep 17 00:00:00 2001 From: archshift Date: Wed, 3 Sep 2014 16:51:38 -0700 Subject: Float/Ciel: If it's going to use C++11, it might as well take advantage of it --- src/Entities/Entity.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index 0a03eb3f2..f0577aba2 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -27,9 +27,9 @@ return super::GetClass(); \ } -#define POSX_TOINT FloorD(GetPosX()) -#define POSY_TOINT FloorD(GetPosY()) -#define POSZ_TOINT FloorD(GetPosZ()) +#define POSX_TOINT FloorC(GetPosX()) +#define POSY_TOINT FloorC(GetPosY()) +#define POSZ_TOINT FloorC(GetPosZ()) #define POS_TOINT Vector3i(POSXTOINT, POSYTOINT, POSZTOINT) #define GET_AND_VERIFY_CURRENT_CHUNK(ChunkVarName, X, Z) cChunk * ChunkVarName = a_Chunk.GetNeighborChunk(X, Z); if ((ChunkVarName == NULL) || !ChunkVarName->IsValid()) { return; } -- cgit v1.2.3 From ebd31ff1321aeb23b5698d74c08f599a2fa62988 Mon Sep 17 00:00:00 2001 From: Mattes D Date: Sun, 19 Oct 2014 11:46:38 +0200 Subject: LuaState: Pushing a cEntity pushes the correct class name. This makes Lua scripts easier, as they don't need to cast values from cEntity to the specific descendant. --- src/Entities/Entity.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/Entities/Entity.h') diff --git a/src/Entities/Entity.h b/src/Entities/Entity.h index f0577aba2..07754791d 100644 --- a/src/Entities/Entity.h +++ b/src/Entities/Entity.h @@ -172,13 +172,13 @@ public: /// Returns true if the entity is of the specified class or a subclass (cPawn's IsA("cEntity") returns true) virtual bool IsA(const char * a_ClassName) const; - /// Returns the topmost class name for the object - virtual const char * GetClass(void) const; - - // Returns the class name of this class + /** Returns the class name of this class */ static const char * GetClassStatic(void); - /// Returns the topmost class's parent class name for the object. cEntity returns an empty string (no parent). + /** Returns the topmost class name for the object */ + virtual const char * GetClass(void) const; + + /** Returns the topmost class's parent class name for the object. cEntity returns an empty string (no parent). */ virtual const char * GetParentClass(void) const; cWorld * GetWorld(void) const { return m_World; } -- cgit v1.2.3