Attempt at fixing cChunkDef::Height signedness.
This commit is contained in:
parent
b6e4d2c263
commit
812375fab1
@ -633,11 +633,6 @@ void cChunk::Tick(float a_Dt)
|
||||
void cChunk::TickBlock(int a_RelX, int a_RelY, int a_RelZ)
|
||||
{
|
||||
unsigned Index = MakeIndex(a_RelX, a_RelY, a_RelZ);
|
||||
if (Index == INDEX_OUT_OF_RANGE)
|
||||
{
|
||||
// An assert has already been made in MakeIndex()
|
||||
return;
|
||||
}
|
||||
cBlockHandler * Handler = BlockHandler(m_BlockTypes[Index]);
|
||||
ASSERT(Handler != NULL); // Happenned on server restart, FS #243
|
||||
Handler->OnUpdate(*this, a_RelX, a_RelY, a_RelZ);
|
||||
@ -1492,7 +1487,7 @@ void cChunk::QueueTickBlockNeighbors(int a_RelX, int a_RelY, int a_RelZ)
|
||||
{ 0, 0, 1},
|
||||
{ 0, 0, -1},
|
||||
} ;
|
||||
for (int i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||
for (size_t i = 0; i < ARRAYCOUNT(Coords); i++)
|
||||
{
|
||||
UnboundedQueueTickBlock(a_RelX + Coords[i].x, a_RelY + Coords[i].y, a_RelZ + Coords[i].z);
|
||||
} // for i - Coords[]
|
||||
|
@ -152,17 +152,16 @@ 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
|
||||
{
|
||||
// Chunk dimensions:
|
||||
Width = 16,
|
||||
Height = 256,
|
||||
NumBlocks = Width * Height * Width,
|
||||
|
||||
/// If the data is collected into a single buffer, how large it needs to be:
|
||||
BlockDataSize = cChunkDef::NumBlocks * 2 + (cChunkDef::NumBlocks / 2), // 2.5 * numblocks
|
||||
} ;
|
||||
|
||||
/// The type used for any heightmap operations and storage; idx = x + Width * z; Height points to the highest non-air block in the column
|
||||
typedef HEIGHTTYPE HeightMap[Width * Width];
|
||||
@ -216,8 +215,9 @@ public:
|
||||
{
|
||||
return MakeIndexNoCheck(x, y, z);
|
||||
}
|
||||
LOGERROR("cChunkDef::MakeIndex(): coords out of range: {%d, %d, %d}; returning fake index 0", x, y, z);
|
||||
ASSERT(!"cChunkDef::MakeIndex(): coords out of chunk range!");
|
||||
return INDEX_OUT_OF_RANGE;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -871,9 +871,9 @@ bool cWSSCompact::LoadChunkFromData(const cChunkCoords & a_Chunk, int & a_Uncomp
|
||||
}
|
||||
|
||||
BLOCKTYPE * BlockData = (BLOCKTYPE *)UncompressedData.data();
|
||||
NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + cChunkDef::MetaOffset);
|
||||
NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + cChunkDef::LightOffset);
|
||||
NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + cChunkDef::SkyLightOffset);
|
||||
NIBBLETYPE * MetaData = (NIBBLETYPE *)(BlockData + MetaOffset);
|
||||
NIBBLETYPE * BlockLight = (NIBBLETYPE *)(BlockData + LightOffset);
|
||||
NIBBLETYPE * SkyLight = (NIBBLETYPE *)(BlockData + SkyLightOffset);
|
||||
|
||||
a_World->SetChunkData(
|
||||
a_Chunk.m_ChunkX, a_Chunk.m_ChunkZ,
|
||||
|
@ -58,6 +58,14 @@ public:
|
||||
|
||||
protected:
|
||||
|
||||
enum
|
||||
{
|
||||
// Offsets to individual components in the joined blockdata array
|
||||
MetaOffset = cChunkDef::NumBlocks,
|
||||
LightOffset = MetaOffset + cChunkDef::NumBlocks / 2,
|
||||
SkyLightOffset = LightOffset + cChunkDef::NumBlocks / 2,
|
||||
} ;
|
||||
|
||||
struct sChunkHeader;
|
||||
typedef std::vector<sChunkHeader *> sChunkHeaders;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user