diff options
author | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-29 23:19:06 +0200 |
---|---|---|
committer | admin@omencraft.com <admin@omencraft.com@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2011-10-29 23:19:06 +0200 |
commit | 625a4accdad2e6acfe1135634cb32ee149415645 (patch) | |
tree | 8c4dbd53b335ef9f5d3af6bc91c70ca92e1be6da /source/cChunkMap.cpp | |
parent | Fixed a memory leak (diff) | |
download | cuberite-625a4accdad2e6acfe1135634cb32ee149415645.tar cuberite-625a4accdad2e6acfe1135634cb32ee149415645.tar.gz cuberite-625a4accdad2e6acfe1135634cb32ee149415645.tar.bz2 cuberite-625a4accdad2e6acfe1135634cb32ee149415645.tar.lz cuberite-625a4accdad2e6acfe1135634cb32ee149415645.tar.xz cuberite-625a4accdad2e6acfe1135634cb32ee149415645.tar.zst cuberite-625a4accdad2e6acfe1135634cb32ee149415645.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cChunkMap.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/source/cChunkMap.cpp b/source/cChunkMap.cpp index 119af2c76..2f6818195 100644 --- a/source/cChunkMap.cpp +++ b/source/cChunkMap.cpp @@ -12,6 +12,8 @@ #include <stdio.h> // sprintf and stuff
#endif
+#include <iostream>
+
#include "zlib.h"
#include <json/json.h>
@@ -234,7 +236,7 @@ void cChunkMap::CompressChunk( cChunkData* a_ChunkData ) {
// Delete already present compressed data
if( a_ChunkData->m_Compressed ) delete [] a_ChunkData->m_Compressed;
-
+
// Get Json data
Json::Value root;
std::string JsonData = "";
@@ -363,6 +365,7 @@ cChunk* cChunkMap::GetChunk( int a_X, int a_Y, int a_Z ) else
{
cChunk* Chunk = new cChunk(a_X, a_Y, a_Z);
+ //std::cout << BlockData;
memcpy( Chunk->m_BlockData, BlockData, cChunk::c_BlockDataSize );
Chunk->CalculateHeightmap();
Data->m_LiveChunk = Chunk;
@@ -551,14 +554,15 @@ void cChunkMap::SaveLayer( cChunkLayer* a_Layer ) cMakeDir::MakeDir("world");
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 );
+ //std::cout << SourceFile << std::endl;
#endif
-
-
+
+
FILE* f = 0;
#ifdef _WIN32
if( fopen_s(&f, SourceFile, "wb" ) == 0 ) // no error
@@ -685,6 +689,7 @@ cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ ) }
OrderedData[i] = Data;
+ //std::cout << Data;
}
// Loop over chunks again, in the order they were loaded, and load their compressed data
@@ -714,4 +719,4 @@ cChunkMap::cChunkLayer* cChunkMap::LoadLayer(int a_LayerX, int a_LayerZ ) //LOGWARN("Could not open file %s", SourceFile );
}
return 0;
-}
\ No newline at end of file +}
|