1
0

You can now run multiple worlds by defining them in settings.ini . However there's no way to change worlds on the fly yet

Players are now stored in separate folder /players instead of in the world folder (!so move the folder!)
Fixed a memory leak/error in cPickup.cpp
Multiple worlds are stored in cRoot
cClientHandle lists are taken out of cWorld and now stored in cServer
Worlds now have names to distinguish them by
Some functions in the Core plugin now distinguish between worlds

git-svn-id: http://mc-server.googlecode.com/svn/trunk@40 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
faketruth
2011-11-01 21:57:08 +00:00
parent 4c4e9867eb
commit b5b920deda
18 changed files with 482 additions and 167 deletions

View File

@@ -10,6 +10,9 @@
#include <cstdlib> // abs
#include <math.h> // floorf
#include <stdio.h> // sprintf and stuff
#define sprintf_s( dest, size, format, ... ) sprintf( dest, format, __VA_ARGS__ )
#endif
#include "zlib.h"
@@ -549,16 +552,12 @@ void cChunkMap::SaveAllChunks()
void cChunkMap::SaveLayer( cChunkLayer* a_Layer )
{
cMakeDir::MakeDir("world");
std::string WorldName = m_World->GetName();
cMakeDir::MakeDir( WorldName.c_str() );
char SourceFile[128];
#ifdef _WIN32
sprintf_s(SourceFile, 128, "world/X%i_Z%i.pak", a_Layer->m_X, a_Layer->m_Z );
#else
sprintf(SourceFile, "world/X%i_Z%i.pak", a_Layer->m_X, a_Layer->m_Z );
#endif
sprintf_s(SourceFile, 128, ( WorldName + "/X%i_Z%i.pak").c_str(), a_Layer->m_X, a_Layer->m_Z );
FILE* f = 0;
#ifdef _WIN32
@@ -635,13 +634,10 @@ void cChunkMap::SaveLayer( cChunkLayer* a_Layer )
cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ )
{
std::string WorldName = m_World->GetName();
char SourceFile[128];
#ifdef _WIN32
sprintf_s(SourceFile, 128, "world/X%i_Z%i.pak", a_LayerX, a_LayerZ );
#else
sprintf(SourceFile, "world/X%i_Z%i.pak", a_LayerX, a_LayerZ );
#endif
sprintf_s(SourceFile, 128, (WorldName + "/X%i_Z%i.pak").c_str(), a_LayerX, a_LayerZ );
FILE* f = 0;
#ifdef _WIN32