summaryrefslogtreecommitdiffstats
path: root/source/cChunkMap.cpp
diff options
context:
space:
mode:
authorfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-01 22:57:08 +0100
committerfaketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6>2011-11-01 22:57:08 +0100
commitb5b920dedaa62302795b0b8f3db84a0650d236e0 (patch)
treef46d1ec70d6519fff2a75f45c08fe37bf4b5538c /source/cChunkMap.cpp
parentforogt to update all of cPlayer.cpp for player based gamemode. (diff)
downloadcuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.tar
cuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.tar.gz
cuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.tar.bz2
cuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.tar.lz
cuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.tar.xz
cuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.tar.zst
cuberite-b5b920dedaa62302795b0b8f3db84a0650d236e0.zip
Diffstat (limited to '')
-rw-r--r--source/cChunkMap.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp
index 1cabcd593..855318159 100644
--- a/source/cChunkMap.cpp
+++ b/source/cChunkMap.cpp
@@ -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