Skip to content

Commit

Permalink
WormNestCaves occasionally generates sandstone around the cave
Browse files Browse the repository at this point in the history
Only when the block around the cave is sand.
  • Loading branch information
NiLSPACE committed Dec 13, 2014
1 parent b8072cb commit 00bee25
Showing 1 changed file with 22 additions and 3 deletions.
25 changes: 22 additions & 3 deletions src/Generating/Caves.cpp
Expand Up @@ -100,6 +100,7 @@ class cCaveTunnel
void ProcessChunk(
int a_ChunkX, int a_ChunkZ,
cChunkDef::BlockTypes & a_BlockTypes,
cChunkDesc::BlockNibbleBytes & a_BlockMetas,
cChunkDef::HeightMap & a_HeightMap
);

Expand Down Expand Up @@ -455,6 +456,7 @@ void cCaveTunnel::CalcBoundingBox(void)
void cCaveTunnel::ProcessChunk(
int a_ChunkX, int a_ChunkZ,
cChunkDef::BlockTypes & a_BlockTypes,
cChunkDesc::BlockNibbleBytes & a_BlockMetas,
cChunkDef::HeightMap & a_HeightMap
)
{
Expand Down Expand Up @@ -505,6 +507,22 @@ void cCaveTunnel::ProcessChunk(
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_AIR);
}
}
else if (SqDist <= SqRad * 2)
{
if (cChunkDef::GetBlock(a_BlockTypes, x, y, z) == E_BLOCK_SAND)
{
int Index = cChunkDef::MakeIndexNoCheck(x, y, z);
if (a_BlockMetas[Index] == 1)
{
a_BlockMetas[Index] = 0;
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_RED_SANDSTONE);
}
else
{
cChunkDef::SetBlock(a_BlockTypes, x, y, z, E_BLOCK_SANDSTONE);
}
}
}
} // for y
} // for x, z
} // for itr - m_Points[]
Expand Down Expand Up @@ -596,11 +614,12 @@ void cStructGenWormNestCaves::cCaveSystem::DrawIntoChunk(cChunkDesc & a_ChunkDes
{
int ChunkX = a_ChunkDesc.GetChunkX();
int ChunkZ = a_ChunkDesc.GetChunkZ();
cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
cChunkDef::HeightMap & HeightMap = a_ChunkDesc.GetHeightMap();
cChunkDef::BlockTypes & BlockTypes = a_ChunkDesc.GetBlockTypes();
cChunkDef::HeightMap & HeightMap = a_ChunkDesc.GetHeightMap();
cChunkDesc::BlockNibbleBytes & BlockMetas = a_ChunkDesc.GetBlockMetasUncompressed();
for (cCaveTunnels::const_iterator itr = m_Tunnels.begin(), end = m_Tunnels.end(); itr != end; ++itr)
{
(*itr)->ProcessChunk(ChunkX, ChunkZ, BlockTypes, HeightMap);
(*itr)->ProcessChunk(ChunkX, ChunkZ, BlockTypes, BlockMetas, HeightMap);
} // for itr - m_Tunnels[]
}

Expand Down

0 comments on commit 00bee25

Please sign in to comment.