1
0

Fix comments

This commit is contained in:
tycho 2015-05-24 14:58:24 +01:00
parent 95b81b3ef1
commit 76a3165f09
6 changed files with 73 additions and 63 deletions

View File

@ -104,7 +104,7 @@ static int tolua_cNetwork_CreateUDPEndpoint(lua_State * L)
UInt16 Port; UInt16 Port;
// Check validity: // Check validity:
if (S.GetStackValues(2, Port)) if (!S.GetStackValues(2, Port))
{ {
LOGWARNING("cNetwork:CreateUDPEndpoint() called with invalid port, failing the request."); LOGWARNING("cNetwork:CreateUDPEndpoint() called with invalid port, failing the request.");
S.Push(false); S.Push(false);

View File

@ -241,7 +241,9 @@ inline eBlockFace MirrorBlockFaceY(eBlockFace a_BlockFace)
case BLOCK_FACE_NONE: case BLOCK_FACE_NONE:
case BLOCK_FACE_YM: case BLOCK_FACE_YM:
case BLOCK_FACE_YP: case BLOCK_FACE_YP:
{
return a_BlockFace; return a_BlockFace;
};
} }
} }
@ -254,14 +256,20 @@ inline eBlockFace RotateBlockFaceCCW(eBlockFace a_BlockFace)
{ {
switch (a_BlockFace) switch (a_BlockFace)
{ {
case BLOCK_FACE_XM: return BLOCK_FACE_ZP; case BLOCK_FACE_XM:
case BLOCK_FACE_XP: return BLOCK_FACE_ZM; return BLOCK_FACE_ZP;
case BLOCK_FACE_ZM: return BLOCK_FACE_XM; case BLOCK_FACE_XP:
case BLOCK_FACE_ZP: return BLOCK_FACE_XP; return BLOCK_FACE_ZM;
case BLOCK_FACE_ZM:
return BLOCK_FACE_XM;
case BLOCK_FACE_ZP:
return BLOCK_FACE_XP;
case BLOCK_FACE_NONE: case BLOCK_FACE_NONE:
case BLOCK_FACE_YM: case BLOCK_FACE_YM:
case BLOCK_FACE_YP: case BLOCK_FACE_YP:
{
return a_BlockFace; return a_BlockFace;
}
} }
} }
@ -280,7 +288,9 @@ inline eBlockFace RotateBlockFaceCW(eBlockFace a_BlockFace)
case BLOCK_FACE_NONE: case BLOCK_FACE_NONE:
case BLOCK_FACE_YM: case BLOCK_FACE_YM:
case BLOCK_FACE_YP: case BLOCK_FACE_YP:
{
return a_BlockFace; return a_BlockFace;
};
} }
} }

View File

@ -60,7 +60,7 @@ cBioGenCache::cBioGenCache(cBiomeGenPtr a_BioGenToCache, size_t a_CacheSize) :
{ {
for (size_t i = 0; i < m_CacheSize; i++) for (size_t i = 0; i < m_CacheSize; i++)
{ {
m_CacheOrder[i] = static_cast<size_t>(i); m_CacheOrder[i] = i;
m_CacheData[i].m_ChunkX = 0x7fffffff; m_CacheData[i].m_ChunkX = 0x7fffffff;
m_CacheData[i].m_ChunkZ = 0x7fffffff; m_CacheData[i].m_ChunkZ = 0x7fffffff;
} }
@ -1121,7 +1121,7 @@ public:
virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override virtual void GenBiomes(int a_ChunkX, int a_ChunkZ, cChunkDef::BiomeMap & a_Biomes) override
{ {
int vals[16 * 16]; int vals[16 * 16];
m_Gen->GetInts(static_cast<size_t>(a_ChunkX * cChunkDef::Width), static_cast<size_t>(a_ChunkZ * cChunkDef::Width), 16, 16, vals); m_Gen->GetInts(a_ChunkX * cChunkDef::Width, a_ChunkZ * cChunkDef::Width, 16, 16, vals);
for (int z = 0; z < cChunkDef::Width; z++) for (int z = 0; z < cChunkDef::Width; z++)
{ {
for (int x = 0; x < cChunkDef::Width; x++) for (int x = 0; x < cChunkDef::Width; x++)

View File

@ -66,7 +66,7 @@ public:
// These operate on the heightmap, so they could get out of sync with the data // These operate on the heightmap, so they could get out of sync with the data
// Use UpdateHeightmap() to re-calculate heightmap from the block data // Use UpdateHeightmap() to re-calculate heightmap from the block data
void SetHeight(int a_RelX, int a_RelZ, HEIGHTTYPE a_Height); void SetHeight(int a_RelX, int a_RelZ, HEIGHTTYPE a_Height);
HEIGHTTYPE GetHeight(int a_RelX, int a_RelZ); HEIGHTTYPE GetHeight(int a_RelX, int a_RelZ);
// tolua_end // tolua_end

View File

@ -58,7 +58,7 @@ public:
virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override virtual void GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap) override
{ {
int heights[cChunkDef::Width * cChunkDef::Width]; int heights[cChunkDef::Width * cChunkDef::Width];
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); m_Gen->GetInts(a_ChunkX * cChunkDef::Width, 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++) 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)); a_HeightMap[i] = static_cast<HEIGHTTYPE>(std::max(std::min(60 + heights[i], cChunkDef::Height - 60), 40));

View File

@ -47,7 +47,7 @@ public:
virtual ~cProtIntGen() {} virtual ~cProtIntGen() {}
/** Generates the array of specified size into a_Values, based on given min coords. */ /** Generates the array of specified size into a_Values, based on given min coords. */
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) = 0; virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) = 0;
}; };
@ -109,14 +109,14 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t BaseZ = a_MinZ + z; int BaseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
a_Values[x + a_SizeX * z] = (super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(BaseZ)) / 7) % m_Range; a_Values[x + a_SizeX * z] = (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
} }
} // for z } // for z
} }
@ -146,22 +146,22 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t BaseZ = a_MinZ + z; int BaseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
int rnd = (super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(BaseZ)) / 7); int rnd = (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7);
a_Values[x + a_SizeX * z] = ((rnd % 100) < m_Threshold) ? ((rnd / 101) % bgLandOceanMax + 1) : 0; a_Values[x + a_SizeX * z] = ((rnd % 100) < m_Threshold) ? ((rnd / 101) % bgLandOceanMax + 1) : 0;
} }
} }
// If the centerpoint of the world is within the area, set it to bgTemperate, always: // If the centerpoint of the world is within the area, set it to bgTemperate, always:
if ((a_MinX <= 0) && (a_MinZ <= 0) && (a_MinX + a_SizeX > 0) && (a_MinZ + a_SizeZ > 0)) if ((a_MinX <= 0) && (a_MinZ <= 0) && (a_MinX + static_cast<int>(a_SizeX) > 0) && (a_MinZ + static_cast<int>(a_SizeZ) > 0))
{ {
a_Values[-a_MinX - a_MinZ * a_SizeX] = bgTemperate; a_Values[static_cast<size_t>(-a_MinX) - static_cast<size_t>(a_MinZ) * a_SizeX] = bgTemperate;
} }
} }
@ -189,11 +189,11 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Get the coords for the lower generator: // Get the coords for the lower generator:
size_t lowerMinX = a_MinX >> 1; int lowerMinX = a_MinX >> 1;
size_t lowerMinZ = a_MinZ >> 1; int lowerMinZ = a_MinZ >> 1;
size_t lowerSizeX = a_SizeX / 2 + 2; size_t lowerSizeX = a_SizeX / 2 + 2;
size_t lowerSizeZ = a_SizeZ / 2 + 2; size_t lowerSizeZ = a_SizeZ / 2 + 2;
ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize); ASSERT(lowerSizeX * lowerSizeZ <= m_BufferSize);
@ -217,8 +217,8 @@ public:
{ {
int ValX1Z0 = lowerData[x + 1 + z * lowerSizeX]; int ValX1Z0 = lowerData[x + 1 + z * lowerSizeX];
int ValX1Z1 = lowerData[x + 1 + (z + 1) * lowerSizeX]; int ValX1Z1 = lowerData[x + 1 + (z + 1) * lowerSizeX];
int RndX = static_cast<int>(x + lowerMinX) * 2; int RndX = (static_cast<int>(x) + lowerMinX) * 2;
int RndZ = static_cast<int>(z + lowerMinZ) * 2; int RndZ = (static_cast<int>(z) + lowerMinZ) * 2;
cache[idx] = PrevZ0; cache[idx] = PrevZ0;
cache[idx + lowStepX] = super::chooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1); cache[idx + lowStepX] = super::chooseRandomOne(RndX, RndZ + 1, PrevZ0, PrevZ1);
cache[idx + 1] = super::chooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0); cache[idx + 1] = super::chooseRandomOne(RndX, RndZ - 1, PrevZ0, ValX1Z0);
@ -259,7 +259,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -272,7 +272,7 @@ public:
// Also get rid of single-pixel irregularities (A-B-A): // Also get rid of single-pixel irregularities (A-B-A):
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t NoiseZ = a_MinZ + z; int NoiseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
int val = lowerData[x + 1 + (z + 1) * lowerSizeX]; int val = lowerData[x + 1 + (z + 1) * lowerSizeX];
@ -283,7 +283,7 @@ public:
if ((left == right) && (above == below)) if ((left == right) && (above == below))
{ {
if (((super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(NoiseZ)) / 7) % 2) == 0) if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 2) == 0)
{ {
val = left; val = left;
} }
@ -331,7 +331,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
size_t lowerSizeX = a_SizeX + 1; size_t lowerSizeX = a_SizeX + 1;
@ -375,7 +375,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
size_t lowerSizeX = a_SizeX + 4; size_t lowerSizeX = a_SizeX + 4;
@ -425,7 +425,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
size_t lowerSizeX = a_SizeX + 3; size_t lowerSizeX = a_SizeX + 3;
@ -476,7 +476,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@ -484,12 +484,12 @@ public:
// Replace random values: // Replace random values:
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t BaseZ = a_MinZ + z; int BaseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
if (((super::m_Noise.IntNoise2DInt(static_cast<int>(BaseZ), static_cast<int>(a_MinX + x)) / 13) % 101) < m_ChancePct) if (((super::m_Noise.IntNoise2DInt(BaseZ, a_MinX + static_cast<int>(x)) / 13) % 101) < m_ChancePct)
{ {
a_Values[x + a_SizeX * z] = m_Min + (super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(BaseZ)) / 7) % m_Range; a_Values[x + a_SizeX * z] = m_Min + (super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), BaseZ) / 7) % m_Range;
} }
} // for x } // for x
} // for z } // for z
@ -522,7 +522,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@ -530,10 +530,10 @@ public:
// Add the random values: // Add the random values:
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t NoiseZ = a_MinZ + z; int NoiseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
int noiseVal = ((super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(NoiseZ)) / 7) % m_Range) - m_HalfRange; int noiseVal = ((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % m_Range) - m_HalfRange;
a_Values[x + z * a_SizeX] += noiseVal; a_Values[x + z * a_SizeX] += noiseVal;
} }
} }
@ -564,7 +564,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -576,11 +576,11 @@ public:
// Average random values: // Average random values:
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t NoiseZ = a_MinZ + z; int NoiseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
size_t idxLower = x + 1 + lowerSizeX * (z + 1); size_t idxLower = x + 1 + lowerSizeX * (z + 1);
if (((super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(NoiseZ)) / 7) % 100) > m_AvgChancePct) if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
{ {
// Average the 4 neighbors: // Average the 4 neighbors:
a_Values[x + z * a_SizeX] = ( a_Values[x + z * a_SizeX] = (
@ -621,7 +621,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -633,16 +633,16 @@ public:
// Average random values: // Average random values:
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
{ {
size_t NoiseZ = a_MinZ + z; int NoiseZ = a_MinZ + static_cast<int>(z);
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
size_t idxLower = x + 1 + lowerSizeX * (z + 1); size_t idxLower = x + 1 + lowerSizeX * (z + 1);
if (((super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(NoiseZ)) / 7) % 100) > m_AvgChancePct) if (((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ) / 7) % 100) > m_AvgChancePct)
{ {
// Chose a value in between the min and max neighbor: // Chose a value in between the min and max neighbor:
int min = std::min(std::min(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::min(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX])); int min = std::min(std::min(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::min(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
int max = std::max(std::max(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::max(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX])); int max = std::max(std::max(lowerData[idxLower - 1], lowerData[idxLower + 1]), std::max(lowerData[idxLower - lowerSizeX], lowerData[idxLower + lowerSizeX]));
a_Values[x + z * a_SizeX] = min + ((super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(NoiseZ + 10)) / 7) % (max - min + 1)); a_Values[x + z * a_SizeX] = min + ((super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), NoiseZ + 10) / 7) % (max - min + 1));
} }
else else
{ {
@ -675,7 +675,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Map for biome -> its beach: // Map for biome -> its beach:
static const int ToBeach[] = static const int ToBeach[] =
@ -779,7 +779,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
for (size_t z = 0; z < a_SizeZ; z++) for (size_t z = 0; z < a_SizeZ; z++)
@ -788,7 +788,7 @@ public:
{ {
if (a_Values[x + z * a_SizeX] == bgOcean) if (a_Values[x + z * a_SizeX] == bgOcean)
{ {
int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(a_MinX + x), static_cast<int>(a_MinZ + z)) / 7; int rnd = super::m_Noise.IntNoise2DInt(a_MinX + static_cast<int>(x), a_MinZ + static_cast<int>(z)) / 7;
if (rnd % 1000 < m_Chance) if (rnd % 1000 < m_Chance)
{ {
a_Values[x + z * a_SizeX] = (rnd / 1003) % bgLandOceanMax; a_Values[x + z * a_SizeX] = (rnd / 1003) % bgLandOceanMax;
@ -822,7 +822,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values)
{ {
// Generate the underlying biome groups: // Generate the underlying biome groups:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -920,7 +920,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Define the per-biome-group biomes: // Define the per-biome-group biomes:
static const int oceanBiomes[] = static const int oceanBiomes[] =
@ -1007,7 +1007,7 @@ public:
const cBiomesInGroups & Biomes = (val > bgfRare) ? const cBiomesInGroups & Biomes = (val > bgfRare) ?
rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] : rareBiomesInGroups[(val & (bgfRare - 1)) % ARRAYCOUNT(rareBiomesInGroups)] :
biomesInGroups[static_cast<size_t>(val) % ARRAYCOUNT(biomesInGroups)]; biomesInGroups[static_cast<size_t>(val) % ARRAYCOUNT(biomesInGroups)];
int rnd = (super::m_Noise.IntNoise2DInt(static_cast<int>(x + a_MinX), static_cast<int>(z + a_MinZ)) / 7); int rnd = (super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7);
a_Values[x + IdxZ] = Biomes.Biomes[rnd % Biomes.Count]; a_Values[x + IdxZ] = Biomes.Biomes[rnd % Biomes.Count];
} }
} }
@ -1050,7 +1050,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying values: // Generate the underlying values:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@ -1064,7 +1064,7 @@ public:
size_t idx = x + idxZ; size_t idx = x + idxZ;
if (a_Values[idx] == m_From) if (a_Values[idx] == m_From)
{ {
int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x + a_MinX), static_cast<int>(z + a_MinZ)) / 7; int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance) if (rnd % 1000 < m_Chance)
{ {
a_Values[idx] = m_To; a_Values[idx] = m_To;
@ -1109,7 +1109,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying data: // Generate the underlying data:
ASSERT(a_SizeX * a_SizeZ <= m_BufferSize); ASSERT(a_SizeX * a_SizeZ <= m_BufferSize);
@ -1136,7 +1136,7 @@ public:
} }
// There's a river, change the output to a river or a frozen river, based on the original biome: // There's a river, change the output to a river or a frozen river, based on the original biome:
if (IsBiomeVeryCold((EMCSBiome)a_Values[idx])) if (IsBiomeVeryCold(static_cast<EMCSBiome>(a_Values[idx])))
{ {
a_Values[idx] = biFrozenRiver; a_Values[idx] = biFrozenRiver;
} }
@ -1173,7 +1173,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying data: // Generate the underlying data:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -1231,7 +1231,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying data: // Generate the underlying data:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -1278,7 +1278,7 @@ public:
// If at least 3 ocean neighbors and the chance is right, change: // If at least 3 ocean neighbors and the chance is right, change:
if ( if (
(NumOceanNeighbors >= 3) && (NumOceanNeighbors >= 3) &&
((super::m_Noise.IntNoise2DInt(static_cast<int>(x + a_MinX), static_cast<int>(z + a_MinZ)) / 7) % 1000 < m_Chance) ((super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7) % 1000 < m_Chance)
) )
{ {
a_Values[x + z * a_SizeX] = m_ToValue; a_Values[x + z * a_SizeX] = m_ToValue;
@ -1321,7 +1321,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying data: // Generate the underlying data:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@ -1331,7 +1331,7 @@ public:
{ {
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x + a_MinX), static_cast<int>(z + a_MinZ)) / 7; int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance) if (rnd % 1000 < m_Chance)
{ {
a_Values[x + z * a_SizeX] = m_ToValue; a_Values[x + z * a_SizeX] = m_ToValue;
@ -1370,7 +1370,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying data: // Generate the underlying data:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@ -1380,7 +1380,7 @@ public:
{ {
for (size_t x = 0; x < a_SizeX; x++) for (size_t x = 0; x < a_SizeX; x++)
{ {
int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x + a_MinX), static_cast<int>(z + a_MinZ)) / 7; int rnd = super::m_Noise.IntNoise2DInt(static_cast<int>(x) + a_MinX, static_cast<int>(z) + a_MinZ) / 7;
if (rnd % 1000 < m_Chance) if (rnd % 1000 < m_Chance)
{ {
size_t idx = x + a_SizeX * z; size_t idx = x + a_SizeX * z;
@ -1418,7 +1418,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the base biomes and the alterations: // Generate the base biomes and the alterations:
m_BaseBiomes->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_BaseBiomes->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);
@ -1482,7 +1482,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying biomes: // Generate the underlying biomes:
size_t lowerSizeX = a_SizeX + 2; size_t lowerSizeX = a_SizeX + 2;
@ -1642,7 +1642,7 @@ public:
} }
virtual void GetInts(size_t a_MinX, size_t a_MinZ, size_t a_SizeX, size_t a_SizeZ, int * a_Values) override virtual void GetInts(int a_MinX, int a_MinZ, size_t a_SizeX, size_t a_SizeZ, int *a_Values) override
{ {
// Generate the underlying biomes and the alterations: // Generate the underlying biomes and the alterations:
m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values); m_Underlying->GetInts(a_MinX, a_MinZ, a_SizeX, a_SizeZ, a_Values);