Ver código fonte

fix light info is transmitted for wrong locations

Kolja Strohm 1 ano atrás
pai
commit
d4f3b96799
1 arquivos alterados com 2 adições e 3 exclusões
  1. 2 3
      FactoryCraft/Chunk.cpp

+ 2 - 3
FactoryCraft/Chunk.cpp

@@ -925,9 +925,8 @@ void Chunk::setLightData(
     Framework::Vec3<int> location, unsigned char* data, bool foreground)
 {
     int index
-        = ((location.x * CHUNK_SIZE + location.y) * WORLD_HEIGHT + location.z)
-        * 6;
-    memcpy(lightData + index, data, 6);
+        = (location.x * CHUNK_SIZE + location.y) * WORLD_HEIGHT + location.z;
+    memcpy(lightData + index * 6, data, 6);
     // check if neighbor is a visible block and send update to clients
     bool needSend = 0;
     for (int i = 0; i < 6; i++)