summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--source/ChunkDef.h25
-rw-r--r--source/Simulator/FloodyFluidSimulator.cpp3
2 files changed, 16 insertions, 12 deletions
diff --git a/source/ChunkDef.h b/source/ChunkDef.h
index db3bf4740..44103e659 100644
--- a/source/ChunkDef.h
+++ b/source/ChunkDef.h
@@ -106,17 +106,20 @@ enum EMCSBiome
class cChunkDef
{
public:
- static const int Width = 16;
- static const int Height = 256;
- static const int NumBlocks = Width * Height * Width;
- static const int BlockDataSize = NumBlocks * 2 + (NumBlocks / 2); // 2.5 * numblocks
-
- // Offsets to individual components in the joined blockdata array
- static const int MetaOffset = NumBlocks;
- static const int LightOffset = MetaOffset + NumBlocks / 2;
- static const int SkyLightOffset = LightOffset + NumBlocks / 2;
-
- static const unsigned int INDEX_OUT_OF_RANGE = 0xffffffff;
+ enum
+ {
+ Width = 16,
+ Height = 256,
+ NumBlocks = Width * Height * Width,
+ BlockDataSize = NumBlocks * 2 + (NumBlocks / 2), // 2.5 * numblocks
+
+ // Offsets to individual components in the joined blockdata array
+ MetaOffset = NumBlocks,
+ LightOffset = MetaOffset + NumBlocks / 2,
+ SkyLightOffset = LightOffset + NumBlocks / 2,
+
+ INDEX_OUT_OF_RANGE = 0xffffffff,
+ } ;
/// The type used for any heightmap operations and storage; idx = x + Width * z
typedef HEIGHTTYPE HeightMap[Width * Width];
diff --git a/source/Simulator/FloodyFluidSimulator.cpp b/source/Simulator/FloodyFluidSimulator.cpp
index 25b43606b..0f100116d 100644
--- a/source/Simulator/FloodyFluidSimulator.cpp
+++ b/source/Simulator/FloodyFluidSimulator.cpp
@@ -42,7 +42,8 @@ void cFloodyFluidSimulator::SimulateBlock(int a_BlockX, int a_BlockY, int a_Bloc
cBlockArea Area;
int MinBlockY = std::max(0, a_BlockY - 1);
- int MaxBlockY = std::min(cChunkDef::Height, a_BlockY + 1);
+ int ChunkHeight = cChunkDef::Height; // Stupid compilers wouldn't let me use std::min(cChunkDef::Height, ...)
+ int MaxBlockY = std::min(ChunkHeight, a_BlockY + 1);
if (!Area.Read(m_World, a_BlockX - 1, a_BlockX + 1, MinBlockY, MaxBlockY, a_BlockZ - 1, a_BlockZ + 1))
{
// Cannot read the immediate neighborhood, probably too close to an unloaded chunk. Bail out.