1
0

Reverted previous commit, chose a different solution, much cleaner.

git-svn-id: http://mc-server.googlecode.com/svn/trunk@975 0a769ca7-a7f5-676a-18bf-c427514a06d6
This commit is contained in:
madmaxoft@gmail.com 2012-10-18 13:39:42 +00:00
parent 7aa87d1818
commit 99c9b2e11d
2 changed files with 10 additions and 14 deletions

View File

@ -106,20 +106,17 @@ enum EMCSBiome
class cChunkDef class cChunkDef
{ {
public: public:
enum static const int Width = 16;
{ static const int Height = 256;
Width = 16, static const int NumBlocks = Width * Height * Width;
Height = 256, static const int BlockDataSize = NumBlocks * 2 + (NumBlocks / 2); // 2.5 * numblocks
NumBlocks = Width * Height * Width,
BlockDataSize = NumBlocks * 2 + (NumBlocks / 2), // 2.5 * numblocks
// Offsets to individual components in the joined blockdata array // Offsets to individual components in the joined blockdata array
MetaOffset = NumBlocks, static const int MetaOffset = NumBlocks;
LightOffset = MetaOffset + NumBlocks / 2, static const int LightOffset = MetaOffset + NumBlocks / 2;
SkyLightOffset = LightOffset + NumBlocks / 2, static const int SkyLightOffset = LightOffset + NumBlocks / 2;
INDEX_OUT_OF_RANGE = 0xffffffff, static const unsigned int INDEX_OUT_OF_RANGE = 0xffffffff;
} ;
/// The type used for any heightmap operations and storage; idx = x + Width * z /// The type used for any heightmap operations and storage; idx = x + Width * z
typedef HEIGHTTYPE HeightMap[Width * Width]; typedef HEIGHTTYPE HeightMap[Width * Width];

View File

@ -42,8 +42,7 @@ void cFloodyFluidSimulator::SimulateBlock(int a_BlockX, int a_BlockY, int a_Bloc
cBlockArea Area; cBlockArea Area;
int MinBlockY = std::max(0, a_BlockY - 1); int MinBlockY = std::max(0, a_BlockY - 1);
int ChunkHeight = cChunkDef::Height; // Stupid compilers wouldn't let me use std::min(cChunkDef::Height, ...) int MaxBlockY = std::min(+cChunkDef::Height, a_BlockY + 1);
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)) 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. // Cannot read the immediate neighborhood, probably too close to an unloaded chunk. Bail out.