From f2689c4887e6bd66af34de81cd793322f1dd57c4 Mon Sep 17 00:00:00 2001 From: tycho Date: Tue, 19 May 2015 11:50:59 +0100 Subject: Fixed a lot of warnings --- src/Generating/HeiGen.cpp | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) (limited to 'src/Generating/HeiGen.cpp') 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(a_ChunkX * cChunkDef::Width), static_cast(a_ChunkZ * cChunkDef::Width), static_cast(cChunkDef::Width), static_cast(cChunkDef::Width), heights); for (size_t i = 0; i < ARRAYCOUNT(heights); i++) { a_HeightMap[i] = static_cast(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(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(Clamp(static_cast(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(Clamp(100 - static_cast((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(Height[x + 17 * z])); } } //*/ -- cgit v1.2.3 From 03c75943ead4d7fe12a07bbdea18b87f85879b0f Mon Sep 17 00:00:00 2001 From: tycho Date: Tue, 19 May 2015 13:34:52 +0100 Subject: More fixed warnings --- src/Generating/HeiGen.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/Generating/HeiGen.cpp') diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp index e44885135..6aa52c4a5 100644 --- a/src/Generating/HeiGen.cpp +++ b/src/Generating/HeiGen.cpp @@ -801,7 +801,10 @@ protected: case biTaiga: a_Min = 63; a_Max = 75; break; case biTaigaHills: a_Min = 63; a_Max = 90; break; case biTaigaM: a_Min = 63; a_Max = 80; break; - default: + case biInvalidBiome: + case biNumBiomes: + case biVariant: + case biNumVariantBiomes: { ASSERT(!"Unknown biome"); a_Min = 10; -- cgit v1.2.3 From 76a3165f09e729c07cc64b085ec320cbeb206d59 Mon Sep 17 00:00:00 2001 From: tycho Date: Sun, 24 May 2015 14:58:24 +0100 Subject: Fix comments --- src/Generating/HeiGen.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/Generating/HeiGen.cpp') diff --git a/src/Generating/HeiGen.cpp b/src/Generating/HeiGen.cpp index 6aa52c4a5..aa1c1893b 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(static_cast(a_ChunkX * cChunkDef::Width), static_cast(a_ChunkZ * cChunkDef::Width), static_cast(cChunkDef::Width), static_cast(cChunkDef::Width), heights); + m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, static_cast(cChunkDef::Width), static_cast(cChunkDef::Width), heights); for (size_t i = 0; i < ARRAYCOUNT(heights); i++) { a_HeightMap[i] = static_cast(std::max(std::min(60 + heights[i], cChunkDef::Height - 60), 40)); -- cgit v1.2.3