From b0b5c432542ea5f9292f428bb59e2670c0d7c53d Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Sun, 10 Apr 2011 22:50:31 +0300 Subject: better support for old maps --- src/map.h | 32 +++++++++++++++++++++++--------- 1 file changed, 23 insertions(+), 9 deletions(-) (limited to 'src/map.h') diff --git a/src/map.h b/src/map.h index e2cd432be..cb48cb32b 100644 --- a/src/map.h +++ b/src/map.h @@ -341,6 +341,8 @@ public: // Returns the position of the chunk where the sector is in v2s16 sector_to_chunk(v2s16 sectorpos) { + if(m_chunksize == 0) + return v2s16(0,0); sectorpos.X += m_chunksize / 2; sectorpos.Y += m_chunksize / 2; v2s16 chunkpos = getContainerPos(sectorpos, m_chunksize); @@ -350,6 +352,8 @@ public: // Returns the position of the (0,0) sector of the chunk v2s16 chunk_to_sector(v2s16 chunkpos) { + if(m_chunksize == 0) + return v2s16(0,0); v2s16 sectorpos( chunkpos.X * m_chunksize, chunkpos.Y * m_chunksize @@ -378,6 +382,9 @@ public: */ bool chunkNonVolatile(v2s16 chunkpos) { + if(m_chunksize == 0) + return true; + /*for(s16 x=-1; x<=1; x++) for(s16 y=-1; y<=1; y++)*/ s16 x=0; @@ -393,6 +400,9 @@ public: return true; } + /* + Chunks are generated by using these and makeChunk(). + */ void initChunkMake(ChunkMakeData &data, v2s16 chunkpos); MapChunk* finishChunkMake(ChunkMakeData &data, core::map &changed_blocks); @@ -402,16 +412,16 @@ public: All chunks touching this one can be altered also. */ - MapChunk* generateChunkRaw(v2s16 chunkpos, + /*MapChunk* generateChunkRaw(v2s16 chunkpos, core::map &changed_blocks, - bool force=false); + bool force=false);*/ /* Generate a chunk and its neighbors so that it won't be touched anymore. */ - MapChunk* generateChunk(v2s16 chunkpos, - core::map &changed_blocks); + /*MapChunk* generateChunk(v2s16 chunkpos, + core::map &changed_blocks);*/ /* Generate a sector. @@ -434,14 +444,14 @@ public: - Check disk (loads blocks also) - Generate chunk */ - MapSector * emergeSector(v2s16 p, - core::map &changed_blocks); + /*MapSector * emergeSector(v2s16 p, + core::map &changed_blocks);*/ - MapSector * emergeSector(v2s16 p) + /*MapSector * emergeSector(v2s16 p) { core::map changed_blocks; return emergeSector(p, changed_blocks); - } + }*/ MapBlock * generateBlock( v3s16 p, @@ -516,7 +526,7 @@ public: v3s16 getBlockPos(std::string sectordir, std::string blockfile); void save(bool only_changed); - void loadAll(); + //void loadAll(); // Saves map seed and possibly other stuff void saveMapMeta(); @@ -557,6 +567,7 @@ private: bool m_map_saving_enabled; // Chunk size in MapSectors + // If 0, chunks are disabled. s16 m_chunksize; // Chunks core::map m_chunks; @@ -754,6 +765,7 @@ protected: struct ChunkMakeData { + bool no_op; ManualMapVoxelManipulator vmanip; u64 seed; v2s16 chunkpos; @@ -764,8 +776,10 @@ struct ChunkMakeData v2s16 sectorpos_bigbase; s16 sectorpos_bigbase_size; s16 max_spread_amount; + UniqueQueue transforming_liquid; ChunkMakeData(): + no_op(false), vmanip(NULL) {} }; -- cgit v1.2.3