summaryrefslogtreecommitdiffstats
path: root/source/cEntity.h
diff options
context:
space:
mode:
Diffstat (limited to 'source/cEntity.h')
-rw-r--r--source/cEntity.h63
1 files changed, 45 insertions, 18 deletions
diff --git a/source/cEntity.h b/source/cEntity.h
index 80fc33cf1..b406e759f 100644
--- a/source/cEntity.h
+++ b/source/cEntity.h
@@ -1,6 +1,15 @@
+
#pragma once
-#include "MemoryLeak.h"
+
+
+
+#include "Vector3d.h"
+#include "Vector3f.h"
+
+
+
+
#define CLASS_PROT_ISA() virtual bool IsA( const char* a_EntityType );
#define CLASS_PROT_GETCLASS() virtual const char* GetClass();
@@ -27,12 +36,19 @@
CLASS_DEF_ISA( classname, superclass ) \
CLASS_DEF_GETCLASS( classname )
-class cChunk;
+
+
+
+
class cWorld;
class cReferenceManager;
-class Vector3d;
-class Vector3f;
class cClientHandle;
+class cPacket;
+
+
+
+
+
class cEntity //tolua_export
{ //tolua_export
public: //tolua_export
@@ -52,16 +68,16 @@ public: //tolua_export
virtual bool IsA( const char* a_EntityType ); //tolua_export
virtual const char* GetClass(); //tolua_export
- cWorld* GetWorld() { return m_World; } //tolua_export
+ cWorld * GetWorld(void) const { return m_World; } //tolua_export
- const Vector3d & GetPosition(); //tolua_export
- const double & GetPosX(); //tolua_export
- const double & GetPosY(); //tolua_export
- const double & GetPosZ(); //tolua_export
- const Vector3f & GetRot(); //tolua_export
- float GetRotation(); //tolua_export
- float GetPitch(); //tolua_export
- float GetRoll(); //tolua_export
+ const Vector3d & GetPosition(void) const {return *m_Pos; } //tolua_export
+ const double & GetPosX (void) const {return m_Pos->x; } //tolua_export
+ const double & GetPosY (void) const {return m_Pos->y; } //tolua_export
+ const double & GetPosZ (void) const {return m_Pos->z; } //tolua_export
+ const Vector3f & GetRot (void) const {return *m_Rot; } //tolua_export
+ float GetRotation(void) const {return m_Rot->x; } //tolua_export
+ float GetPitch (void) const {return m_Rot->y; } //tolua_export
+ float GetRoll (void) const {return m_Rot->z; } //tolua_export
Vector3f GetLookVector(); //tolua_export
void SetPosX( const double & a_PosX ); //tolua_export
@@ -74,18 +90,21 @@ public: //tolua_export
void SetPitch( float a_Pitch ); //tolua_export
void SetRoll( float a_Roll ); //tolua_export
- inline int GetUniqueID() { return m_UniqueID; } //tolua_export
- inline bool IsDestroyed() { return m_bDestroyed; } //tolua_export
+ inline int GetUniqueID(void) const { return m_UniqueID; } //tolua_export
+ inline bool IsDestroyed(void) const { return m_bDestroyed; } //tolua_export
void Destroy(); //tolua_export
- void RemoveFromChunk( cChunk* a_Chunk ); // for internal use in cChunk
+ void RemoveFromChunk(void); // for internal use in cChunk
virtual void Tick(float a_Dt) = 0; //tolua_export
- virtual void SpawnOn( cClientHandle* a_Target ) = 0; //tolua_export
+ virtual cPacket * GetSpawnPacket(void) const {assert(!"GetSpawnedPacket unimplemented!"); return NULL; }; // _X: Needs to be implemented due to Lua bindings
+ void SpawnOn (cClientHandle * a_Client); // tolua_export
+
void WrapRotation();
protected:
+
void SetWorld( cWorld* a_World ) { m_World = a_World; }
void MoveToCorrectChunk(bool a_bIgnoreOldChunk = false);
@@ -94,7 +113,9 @@ protected:
void ReferencedBy( cEntity*& a_EntityPtr );
void Dereference( cEntity*& a_EntityPtr );
+ static cCriticalSection m_CSCount;
static int m_EntityCount;
+
int m_UniqueID;
cReferenceManager* m_Referencers;
@@ -111,6 +132,12 @@ protected:
bool m_bRemovedFromChunk;
ENUM_ENTITY_TYPE m_EntityType;
-private:
+
cWorld* m_World;
}; //tolua_export
+
+typedef std::list<cEntity *> cEntityList;
+
+
+
+