summaryrefslogtreecommitdiffstats
path: root/src/Section.cpp
diff options
context:
space:
mode:
authorLaG1924 <12997935+LaG1924@users.noreply.github.com>2017-09-03 17:45:52 +0200
committerLaG1924 <12997935+LaG1924@users.noreply.github.com>2018-01-13 03:39:31 +0100
commit145ba8e157f79db64203db9684af2e6ed33af075 (patch)
treeec524120eaf2dda746d662297483be51fe626367 /src/Section.cpp
parent2017-08-29 (diff)
downloadAltCraft-145ba8e157f79db64203db9684af2e6ed33af075.tar
AltCraft-145ba8e157f79db64203db9684af2e6ed33af075.tar.gz
AltCraft-145ba8e157f79db64203db9684af2e6ed33af075.tar.bz2
AltCraft-145ba8e157f79db64203db9684af2e6ed33af075.tar.lz
AltCraft-145ba8e157f79db64203db9684af2e6ed33af075.tar.xz
AltCraft-145ba8e157f79db64203db9684af2e6ed33af075.tar.zst
AltCraft-145ba8e157f79db64203db9684af2e6ed33af075.zip
Diffstat (limited to '')
-rw-r--r--src/Section.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/Section.cpp b/src/Section.cpp
index 9b4292b..554cdbf 100644
--- a/src/Section.cpp
+++ b/src/Section.cpp
@@ -93,17 +93,17 @@ BlockId Section::GetBlockId(Vector pos) const {
return blockId;
}
-unsigned char Section::GetBlockLight(Vector pos)
+unsigned char Section::GetBlockLight(Vector pos) const
{
int blockNumber = pos.y * 256 + pos.z * 16 + pos.x;
- unsigned char lightValue = this->light[blockNumber];
+ unsigned char lightValue = this->light[blockNumber / 2];
return (blockNumber % 2 == 0) ? (lightValue & 0xF) : (lightValue >> 4);
}
-unsigned char Section::GetBlockSkyLight(Vector pos)
+unsigned char Section::GetBlockSkyLight(Vector pos) const
{
int blockNumber = pos.y * 256 + pos.z * 16 + pos.x;
- unsigned char skyValue = this->sky[blockNumber];
+ unsigned char skyValue = this->sky[blockNumber / 2];
return (blockNumber % 2 == 0) ? (skyValue & 0xF) : (skyValue >> 4);
}