From 625a4accdad2e6acfe1135634cb32ee149415645 Mon Sep 17 00:00:00 2001 From: "admin@omencraft.com" Date: Sat, 29 Oct 2011 21:19:06 +0000 Subject: Added denotch map converter. Program currently reads the only mcr file in the region dir and writes the uncompressed chunk data in world/X0-Z0.pak. I compile in linux with "g++ cConvert.cpp -lz -o denotch" git-svn-id: http://mc-server.googlecode.com/svn/trunk@20 0a769ca7-a7f5-676a-18bf-c427514a06d6 --- source/cChunkMap.cpp | 15 ++++++++++----- source/cChunkMap.h | 2 +- 2 files changed, 11 insertions(+), 6 deletions(-) (limited to 'source') 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 // sprintf and stuff #endif +#include + #include "zlib.h" #include @@ -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 +} diff --git a/source/cChunkMap.h b/source/cChunkMap.h index 57ad313dc..19619f0c5 100644 --- a/source/cChunkMap.h +++ b/source/cChunkMap.h @@ -88,4 +88,4 @@ private: cChunkNode* m_Nodes; int m_Width, m_Height; -}; \ No newline at end of file +}; -- cgit v1.2.3