summaryrefslogtreecommitdiffstats
path: root/src/Generating/HeiGen.cpp
diff options
context:
space:
mode:
authortycho <work.tycho@gmail.com>2015-05-19 12:50:59 +0200
committertycho <work.tycho@gmail.com>2015-05-19 12:50:59 +0200
commitf2689c4887e6bd66af34de81cd793322f1dd57c4 (patch)
treeb8b78c3f7715797a640dc77b4474e1d2fe347e0c /src/Generating/HeiGen.cpp
parentMerge branch 'master' of https://github.com/mc-server/MCServer (diff)
downloadcuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.tar
cuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.tar.gz
cuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.tar.bz2
cuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.tar.lz
cuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.tar.xz
cuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.tar.zst
cuberite-f2689c4887e6bd66af34de81cd793322f1dd57c4.zip
Diffstat (limited to '')
-rw-r--r--src/Generating/HeiGen.cpp26
1 files changed, 5 insertions, 21 deletions
diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp
index e34ffc57c..e44885135 100644
--- a/src/Generating/HeiGen.cpp
+++ b/src/Generating/HeiGen.cpp
@@ -58,7 +58,7 @@ public:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override
{
int heights[cChunkDef::Width * cChunkDef::Width];
- m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, cChunkDef::Width, cChunkDef::Width, heights);
+ m_Gen->GetInts(static_cast<size_t>(a_ChunkX * cChunkDef::Width), static_cast<size_t>(a_ChunkZ * cChunkDef::Width), static_cast<size_t>(cChunkDef::Width), static_cast<size_t>(cChunkDef::Width), heights);
for (size_t i = 0; i < ARRAYCOUNT(heights); i++)
{
a_HeightMap[i] = static_cast<HEIGHTTYPE>(std::max(std::min(60 + heights[i], cChunkDef::Height - 60), 40));
@@ -92,7 +92,7 @@ void cHeiGenFlat::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap
void cHeiGenFlat::InitializeHeightGen(cIniFile & a_IniFile)
{
- m_Height = a_IniFile.GetValueSetI("Generator", "FlatHeight", m_Height);
+ m_Height = static_cast<HEIGHTTYPE>(a_IniFile.GetValueSetI("Generator", "FlatHeight", m_Height));
}
@@ -300,15 +300,7 @@ void cHeiGenClassic::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightM
{
const float xx = (float)(a_ChunkX * cChunkDef::Width + x);
- int hei = 64 + (int)(GetNoise(xx * 0.05f, zz * 0.05f) * 16);
- if (hei < 10)
- {
- hei = 10;
- }
- if (hei > 250)
- {
- hei = 250;
- }
+ HEIGHTTYPE hei = static_cast<HEIGHTTYPE>(Clamp(static_cast<int>(64 + (GetNoise(xx * 0.05f, zz * 0.05f) * 16)), 10, 250));
cChunkDef::SetHeight(a_HeightMap, x, z, hei);
} // for x
} // for z
@@ -366,15 +358,7 @@ void cHeiGenMountains::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::Heigh
for (int x = 0; x < cChunkDef::Width; x++)
{
int idx = IdxZ + x;
- int hei = 100 - (int)((MountainNoise[idx] - DitchNoise[idx] + PerlinNoise[idx]) * 15);
- if (hei < 10)
- {
- hei = 10;
- }
- if (hei > 250)
- {
- hei = 250;
- }
+ HEIGHTTYPE hei = static_cast<HEIGHTTYPE>(Clamp(100 - static_cast<int>((MountainNoise[idx] - DitchNoise[idx] + PerlinNoise[idx]) * 15), 10, 250));
cChunkDef::SetHeight(a_HeightMap, x, z, hei);
} // for x
} // for z
@@ -536,7 +520,7 @@ void cHeiGenBiomal::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMa
{
for (int x = 0; x < cChunkDef::Width; x++)
{
- cChunkDef::SetHeight(a_HeightMap, x, z, (int)Height[x + 17 * z]);
+ cChunkDef::SetHeight(a_HeightMap, x, z, static_cast<HEIGHTTYPE>(Height[x + 17 * z]));
}
}
//*/