summaryrefslogtreecommitdiffstats
path: root/source/cEntity.cpp
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 09:58:26 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-08-24 09:58:26 +0200
commite92b9e7ecbdf2918aab59d4eeb7bb5966430b264 (patch)
tree1a998d44e5faab91c54ea8517dd9fa02b3732ef7 /source/cEntity.cpp
parentAdded plugin name to deprecation messages (diff)
downloadcuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.gz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.bz2
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.lz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.xz
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.tar.zst
cuberite-e92b9e7ecbdf2918aab59d4eeb7bb5966430b264.zip
Diffstat (limited to 'source/cEntity.cpp')
-rw-r--r--source/cEntity.cpp47
1 files changed, 8 insertions, 39 deletions
diff --git a/source/cEntity.cpp b/source/cEntity.cpp
index a906737cf..12af1c0b7 100644
--- a/source/cEntity.cpp
+++ b/source/cEntity.cpp
@@ -68,7 +68,13 @@ cEntity::~cEntity()
-void cEntity::Initialize( cWorld* a_World )
+CLASS_DEF_GETCLASS(cEntity);
+
+
+
+
+
+void cEntity::Initialize(cWorld * a_World)
{
m_World = a_World;
m_World->AddEntity( this );
@@ -118,31 +124,17 @@ void cEntity::MoveToCorrectChunk(bool a_bIgnoreOldChunk)
virtual void Added(cClientHandle * a_Client) override
{
- if (m_Spawn == NULL)
- {
- m_Spawn = m_Entity->GetSpawnPacket(); // Only create the packet when needed
- }
- if (m_Spawn != NULL)
- {
- a_Client->Send(*m_Spawn);
- }
+ m_Entity->SpawnOn(*a_Client);
}
- cPacket * m_Spawn;
bool m_IgnoreOldChunk;
cEntity * m_Entity;
public:
cMover(cEntity * a_Entity, bool a_IgnoreOldChunk) :
- m_Spawn(NULL),
m_IgnoreOldChunk(a_IgnoreOldChunk),
m_Entity(a_Entity)
{}
-
- ~cMover()
- {
- delete m_Spawn;
- }
} Mover(this, a_bIgnoreOldChunk);
m_World->CompareChunkClients(m_ChunkX, m_ChunkY, m_ChunkZ, ChunkX, ChunkY, ChunkZ, Mover);
@@ -194,29 +186,6 @@ void cEntity::RemoveFromChunk(void)
-void cEntity::SpawnOn(cClientHandle * a_Client)
-{
- std::auto_ptr<cPacket> SpawnPacket(GetSpawnPacket());
- if (SpawnPacket.get() == NULL)
- {
- return;
- }
-
- if (a_Client == NULL)
- {
- m_World->BroadcastToChunk(m_ChunkX, m_ChunkY, m_ChunkZ, *SpawnPacket.get(), NULL);
- }
- else
- {
- a_Client->Send(*(SpawnPacket.get()));
- }
-}
-
-
-
-
-
-CLASS_DEF_GETCLASS( cEntity );
bool cEntity::IsA( const char* a_EntityType )
{
//LOG("IsA( cEntity ) : %s", a_EntityType);