From eb942797b8a1321f7460cea7763bb6891affd475 Mon Sep 17 00:00:00 2001 From: faketruth Date: Mon, 26 Dec 2011 21:54:08 +0000 Subject: Players can switch worlds on the fly with the command /gotoworld [worldName]. This uses the function cPlayer::MoveToWorld() Changed isValidItem to IsValidItem in Core.lua git-svn-id: http://mc-server.googlecode.com/svn/trunk@126 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cClientHandle.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'source/cClientHandle.cpp') diff --git a/source/cClientHandle.cpp b/source/cClientHandle.cpp index 4e71c7169..f7b93ca7e 100644 --- a/source/cClientHandle.cpp +++ b/source/cClientHandle.cpp @@ -375,6 +375,20 @@ void cClientHandle::StreamChunksSmart( cChunk** a_Chunks, unsigned int a_NumChun } } +// This removes the client from all chunks. Used when switching worlds +void cClientHandle::RemoveFromAllChunks() +{ + for(int i = 0; i < VIEWDISTANCE*VIEWDISTANCE; i++) + { + if( m_LoadedChunks[i] ) + { + m_LoadedChunks[i]->RemoveClient( this ); + m_LoadedChunks[i]->AsyncUnload( this ); + m_LoadedChunks[i] = 0; + } + } +} + void cClientHandle::AddPacket(cPacket * a_Packet) { m_pState->CriticalSection.Lock(); -- cgit v1.2.3