|
@@ -575,10 +575,9 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
if (dir == NORTH)
|
|
if (dir == NORTH)
|
|
{
|
|
{
|
|
int index = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
int index = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
|
|
+ int j = (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
if (blocks[index])
|
|
if (blocks[index])
|
|
{
|
|
{
|
|
- int j
|
|
|
|
- = (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
if (zChunk && zChunk->blocks[j])
|
|
blocks[index]->setNeighbour(NORTH, zChunk->blocks[j]);
|
|
blocks[index]->setNeighbour(NORTH, zChunk->blocks[j]);
|
|
else
|
|
else
|
|
@@ -588,14 +587,22 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
NORTH, zChunk ? zChunk->blockIds[j] : 0);
|
|
NORTH, zChunk ? zChunk->blockIds[j] : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else if (zChunk)
|
|
|
|
+ {
|
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
|
+ && !blockIds[index])
|
|
|
|
+ {
|
|
|
|
+ generateBlock(Vec3<int>(i, 0, z));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (dir == EAST)
|
|
else if (dir == EAST)
|
|
{
|
|
{
|
|
int index
|
|
int index
|
|
= ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT + z;
|
|
= ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT + z;
|
|
|
|
+ int j = i * WORLD_HEIGHT + z;
|
|
if (blocks[index])
|
|
if (blocks[index])
|
|
{
|
|
{
|
|
- int j = i * WORLD_HEIGHT + z;
|
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
if (zChunk && zChunk->blocks[j])
|
|
blocks[index]->setNeighbour(EAST, zChunk->blocks[j]);
|
|
blocks[index]->setNeighbour(EAST, zChunk->blocks[j]);
|
|
else
|
|
else
|
|
@@ -605,14 +612,22 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
EAST, zChunk ? zChunk->blockIds[j] : 0);
|
|
EAST, zChunk ? zChunk->blockIds[j] : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else if (zChunk)
|
|
|
|
+ {
|
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
|
+ && !blockIds[index])
|
|
|
|
+ {
|
|
|
|
+ generateBlock(Vec3<int>(CHUNK_SIZE - 1, i, z));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (dir == SOUTH)
|
|
else if (dir == SOUTH)
|
|
{
|
|
{
|
|
int index
|
|
int index
|
|
= (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
= (i * CHUNK_SIZE + CHUNK_SIZE - 1) * WORLD_HEIGHT + z;
|
|
|
|
+ int j = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
if (blocks[index])
|
|
if (blocks[index])
|
|
{
|
|
{
|
|
- int j = i * CHUNK_SIZE * WORLD_HEIGHT + z;
|
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
if (zChunk && zChunk->blocks[j])
|
|
blocks[index]->setNeighbour(SOUTH, zChunk->blocks[j]);
|
|
blocks[index]->setNeighbour(SOUTH, zChunk->blocks[j]);
|
|
else
|
|
else
|
|
@@ -622,14 +637,21 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
SOUTH, zChunk ? zChunk->blockIds[j] : 0);
|
|
SOUTH, zChunk ? zChunk->blockIds[j] : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else if (zChunk)
|
|
|
|
+ {
|
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
|
+ && !blockIds[index])
|
|
|
|
+ {
|
|
|
|
+ generateBlock(Vec3<int>(i, CHUNK_SIZE - 1, z));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if (dir == WEST)
|
|
else if (dir == WEST)
|
|
{
|
|
{
|
|
int index = i * WORLD_HEIGHT + z;
|
|
int index = i * WORLD_HEIGHT + z;
|
|
|
|
+ int j = ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT + z;
|
|
if (blocks[index])
|
|
if (blocks[index])
|
|
{
|
|
{
|
|
- int j = ((CHUNK_SIZE - 1) * CHUNK_SIZE + i) * WORLD_HEIGHT
|
|
|
|
- + z;
|
|
|
|
if (zChunk && zChunk->blocks[j])
|
|
if (zChunk && zChunk->blocks[j])
|
|
blocks[index]->setNeighbour(WEST, zChunk->blocks[j]);
|
|
blocks[index]->setNeighbour(WEST, zChunk->blocks[j]);
|
|
else
|
|
else
|
|
@@ -639,6 +661,14 @@ void Chunk::setNeighbor(Direction dir, Chunk* zChunk)
|
|
WEST, zChunk ? zChunk->blockIds[j] : 0);
|
|
WEST, zChunk ? zChunk->blockIds[j] : 0);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ else if (zChunk)
|
|
|
|
+ {
|
|
|
|
+ if (zChunk->blockIds[j] == BlockTypeEnum::AIR
|
|
|
|
+ && !blockIds[index])
|
|
|
|
+ {
|
|
|
|
+ generateBlock(Vec3<int>(0, i, z));
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|