diff options
author | Mattes D <github@xoft.cz> | 2019-09-08 15:40:12 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2019-09-08 20:21:49 +0200 |
commit | 5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755 (patch) | |
tree | 7b633e2b29ae816dcc6a56c4d1c083518db7da04 /src/Generating/ComposableGenerator.h | |
parent | BiomeGen: Changed to use cChunkCoords params. (diff) | |
download | cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.tar cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.tar.gz cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.tar.bz2 cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.tar.lz cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.tar.xz cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.tar.zst cuberite-5f4df3e87dc43bb9cbf19ea1e15d73ee0b5d1755.zip |
Diffstat (limited to '')
-rw-r--r-- | src/Generating/ComposableGenerator.h | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/Generating/ComposableGenerator.h b/src/Generating/ComposableGenerator.h index 3007d9824..59ce25352 100644 --- a/src/Generating/ComposableGenerator.h +++ b/src/Generating/ComposableGenerator.h @@ -86,7 +86,7 @@ public: virtual ~cTerrainShapeGen() {} // Force a virtual destructor in descendants /** Generates the shape for the given chunk */ - virtual void GenShape(int a_ChunkX, int a_ChunkZ, cChunkDesc::Shape & a_Shape) = 0; + virtual void GenShape(cChunkCoords a_ChunkCoords, cChunkDesc::Shape & a_Shape) = 0; /** Reads parameters from the ini file, prepares generator for use. */ virtual void InitializeShapeGen(cIniFile & a_IniFile) {} @@ -118,7 +118,7 @@ public: virtual ~cTerrainHeightGen() {} // Force a virtual destructor in descendants /** Retrieves the heightmap for the specified chunk. */ - virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) = 0; + virtual void GenHeightMap(cChunkCoords a_ChunkCoords, cChunkDef::HeightMap & a_HeightMap) = 0; /** Initializes the generator, reading its parameters from the INI file. */ virtual void InitializeHeightGen(cIniFile & a_IniFile) {} @@ -128,11 +128,10 @@ public: Descendants may provide a better-performing method. */ virtual HEIGHTTYPE GetHeightAt(int a_BlockX, int a_BlockZ) { - int chunkX, chunkZ; - cChunkDef::BlockToChunk(a_BlockX, a_BlockZ, chunkX, chunkZ); + auto chunkCoords = cChunkDef::BlockToChunk({a_BlockX, 0, a_BlockZ}); cChunkDef::HeightMap heightMap; - GenHeightMap(chunkX, chunkZ, heightMap); - return cChunkDef::GetHeight(heightMap, a_BlockX - chunkX * cChunkDef::Width, a_BlockZ - chunkZ * cChunkDef::Width); + GenHeightMap(chunkCoords, heightMap); + return cChunkDef::GetHeight(heightMap, a_BlockX - chunkCoords.m_ChunkX * cChunkDef::Width, a_BlockZ - chunkCoords.m_ChunkZ * cChunkDef::Width); } /** Creates a cTerrainHeightGen descendant based on the INI file settings. */ |