summaryrefslogtreecommitdiffstats
path: root/source/cEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/cEntity.cpp')
-rw-r--r--source/cEntity.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/source/cEntity.cpp b/source/cEntity.cpp
index b32439869..f739a3243 100644
--- a/source/cEntity.cpp
+++ b/source/cEntity.cpp
@@ -51,7 +51,7 @@ void cEntity::Initialize( cWorld* a_World )
m_World = a_World;
m_World->AddEntity( this );
- MoveToCorrectChunk();
+ MoveToCorrectChunk(true);
/*
Not needed because itīs covered by the MoveToCorrectChunk function
@@ -73,16 +73,18 @@ void cEntity::WrapRotation()
while(m_Rot->y < -180.f) m_Rot->y+=360.f;
}
-void cEntity::MoveToCorrectChunk()
+void cEntity::MoveToCorrectChunk(bool a_IgnoreOldChunk)
{
if( !m_World ) return; // Entity needs a world to move to a chunk
int ChunkX = 0, ChunkY = 0, ChunkZ = 0;
cWorld::BlockToChunk( (int)m_Pos->x, (int)m_Pos->y, (int)m_Pos->z, ChunkX, ChunkY, ChunkZ );
- if( m_ChunkX != ChunkX || m_ChunkY != ChunkY || m_ChunkZ != ChunkZ )
+ if(a_IgnoreOldChunk || m_ChunkX != ChunkX || m_ChunkY != ChunkY || m_ChunkZ != ChunkZ)
{
LOG("From %i %i To %i %i", m_ChunkX, m_ChunkZ, ChunkX, ChunkZ );
- cChunk* Chunk = m_World->GetChunkUnreliable( m_ChunkX, m_ChunkY, m_ChunkZ );
+ cChunk* Chunk = 0;
+ if(!a_IgnoreOldChunk)
+ Chunk = m_World->GetChunkUnreliable( m_ChunkX, m_ChunkY, m_ChunkZ );
typedef std::list< cClientHandle* > ClientList;
ClientList BeforeClients;