- fixed the code from the last commit :)
git-svn-id: http://mc-server.googlecode.com/svn/trunk@111 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
parent
cf720c17e6
commit
adb4dbc904
@ -51,7 +51,7 @@ void cEntity::Initialize( cWorld* a_World )
|
|||||||
m_World = a_World;
|
m_World = a_World;
|
||||||
m_World->AddEntity( this );
|
m_World->AddEntity( this );
|
||||||
|
|
||||||
MoveToCorrectChunk();
|
MoveToCorrectChunk(true);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Not needed because it´s covered by the MoveToCorrectChunk function
|
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;
|
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
|
if( !m_World ) return; // Entity needs a world to move to a chunk
|
||||||
|
|
||||||
int ChunkX = 0, ChunkY = 0, ChunkZ = 0;
|
int ChunkX = 0, ChunkY = 0, ChunkZ = 0;
|
||||||
cWorld::BlockToChunk( (int)m_Pos->x, (int)m_Pos->y, (int)m_Pos->z, ChunkX, ChunkY, ChunkZ );
|
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 );
|
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;
|
typedef std::list< cClientHandle* > ClientList;
|
||||||
ClientList BeforeClients;
|
ClientList BeforeClients;
|
||||||
|
@ -86,7 +86,7 @@ public: //tolua_export
|
|||||||
void WrapRotation();
|
void WrapRotation();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void MoveToCorrectChunk();
|
void MoveToCorrectChunk(bool a_IgnoreOldChunk = false);
|
||||||
|
|
||||||
friend class cReferenceManager;
|
friend class cReferenceManager;
|
||||||
void AddReference( cEntity*& a_EntityPtr );
|
void AddReference( cEntity*& a_EntityPtr );
|
||||||
|
Loading…
Reference in New Issue
Block a user