diff options
author | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-25 21:23:30 +0100 |
---|---|---|
committer | lapayo94@gmail.com <lapayo94@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-12-25 21:23:30 +0100 |
commit | adb4dbc9047947c8da872e578b4356053bdfd908 (patch) | |
tree | 94ff3c1925c70ee821ca3ba8ac7c182f03a06b01 /source | |
parent | - Fixed a critical bug, which caused players to not getting spawned on the others client (diff) | |
download | cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.tar cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.tar.gz cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.tar.bz2 cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.tar.lz cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.tar.xz cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.tar.zst cuberite-adb4dbc9047947c8da872e578b4356053bdfd908.zip |
Diffstat (limited to 'source')
-rw-r--r-- | source/cEntity.cpp | 10 | ||||
-rw-r--r-- | source/cEntity.h | 2 |
2 files changed, 7 insertions, 5 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;
diff --git a/source/cEntity.h b/source/cEntity.h index c25c3e293..49689f735 100644 --- a/source/cEntity.h +++ b/source/cEntity.h @@ -86,7 +86,7 @@ public: //tolua_export void WrapRotation();
protected:
- void MoveToCorrectChunk();
+ void MoveToCorrectChunk(bool a_IgnoreOldChunk = false);
friend class cReferenceManager;
void AddReference( cEntity*& a_EntityPtr );
|