summaryrefslogtreecommitdiffstats
path: root/src/SetChunkData.cpp
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2023-05-26 12:59:31 +0200
committerMattes D <github@xoft.cz>2023-05-26 23:00:17 +0200
commit889eba1df501e190f9019cc42bad1606477c4cce (patch)
treed39d291692153c15e996a412e609beff1adbaae9 /src/SetChunkData.cpp
parentAdded cChunkCoords fmtlib formatter. (diff)
downloadcuberite-889eba1df501e190f9019cc42bad1606477c4cce.tar
cuberite-889eba1df501e190f9019cc42bad1606477c4cce.tar.gz
cuberite-889eba1df501e190f9019cc42bad1606477c4cce.tar.bz2
cuberite-889eba1df501e190f9019cc42bad1606477c4cce.tar.lz
cuberite-889eba1df501e190f9019cc42bad1606477c4cce.tar.xz
cuberite-889eba1df501e190f9019cc42bad1606477c4cce.tar.zst
cuberite-889eba1df501e190f9019cc42bad1606477c4cce.zip
Diffstat (limited to 'src/SetChunkData.cpp')
-rw-r--r--src/SetChunkData.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/SetChunkData.cpp b/src/SetChunkData.cpp
new file mode 100644
index 000000000..4d298a093
--- /dev/null
+++ b/src/SetChunkData.cpp
@@ -0,0 +1,30 @@
+#include "Globals.h"
+#include "SetChunkData.h"
+#include "BlockType.h"
+#include "Entities/Entity.h"
+
+
+
+
+
+void SetChunkData::UpdateHeightMap()
+{
+ for (int x = 0; x < cChunkDef::Width; x++)
+ {
+ for (int z = 0; z < cChunkDef::Width; z++)
+ {
+ HEIGHTTYPE Height = 0;
+ for (HEIGHTTYPE y = cChunkDef::Height - 1; y > 0; y--)
+ {
+ BLOCKTYPE BlockType = BlockData.GetBlock({x, y, z});
+ if (BlockType != E_BLOCK_AIR)
+ {
+ Height = y;
+ break;
+ }
+ } // for y
+ auto idx = x + cChunkDef::Width * z;
+ HeightMap[idx] = Height;
+ } // for z
+ } // for x
+}