MCPcopy Create free account
hub / github.com/cuberite/cuberite / GenHeightMap

Method GenHeightMap

src/Generating/DistortedHeightmap.cpp:477–497  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

475
476
477void cDistortedHeightmap::GenHeightMap(int a_ChunkX, int a_ChunkZ, cChunkDef::HeightMap & a_HeightMap)
478{
479 PrepareState(a_ChunkX, a_ChunkZ);
480 for (int z = 0; z < cChunkDef::Width; z++)
481 {
482 for (int x = 0; x < cChunkDef::Width; x++)
483 {
484 int NoiseArrayIdx = x + 17 * 257 * z;
485 cChunkDef::SetHeight(a_HeightMap, x, z, m_SeaLevel - 1);
486 for (int y = cChunkDef::Height - 1; y > m_SeaLevel - 1; y--)
487 {
488 int HeightMapHeight = (int)m_DistortedHeightmap[NoiseArrayIdx + 17 * y];
489 if (y < HeightMapHeight)
490 {
491 cChunkDef::SetHeight(a_HeightMap, x, z, y);
492 break;
493 }
494 } // for y
495 } // for x
496 } // for z
497}
498
499
500

Callers 2

PrepareStateMethod · 0.45
GetHeightmapAtMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected