diff options
author | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-03 21:55:16 +0100 |
---|---|---|
committer | faketruth <faketruth@0a769ca7-a7f5-676a-18bf-c427514a06d6> | 2012-03-03 21:55:16 +0100 |
commit | ad89cf88ba997651257412594cdd88e84a525a19 (patch) | |
tree | 7706bc9b0b9ae25cbb4b2b097e3c27bed5ba2e30 /source/cWorld.h | |
parent | That should not have been committed... (diff) | |
download | cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.gz cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.bz2 cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.lz cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.xz cuberite-ad89cf88ba997651257412594cdd88e84a525a19.tar.zst cuberite-ad89cf88ba997651257412594cdd88e84a525a19.zip |
Diffstat (limited to '')
-rw-r--r-- | source/cWorld.h | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/source/cWorld.h b/source/cWorld.h index 3b8f7b059..60b393ab8 100644 --- a/source/cWorld.h +++ b/source/cWorld.h @@ -179,26 +179,29 @@ public: inline static void AbsoluteToRelative( int & a_X, int & a_Y, int & a_Z, int & a_ChunkX, int & a_ChunkY, int & a_ChunkZ )
{
- (void)a_Y; // not unused anymore
- a_ChunkX = a_X/16;
- if(a_X < 0 && a_X % 16 != 0) a_ChunkX--;
+ // TODO: Use floor() instead of weird if statements
+ // Also fix Y
+ a_ChunkX = a_X/cChunk::c_ChunkWidth;
+ if(a_X < 0 && a_X % cChunk::c_ChunkWidth != 0) a_ChunkX--;
a_ChunkY = 0;
- a_ChunkZ = a_Z/16;
- if(a_Z < 0 && a_Z % 16 != 0) a_ChunkZ--;
+ a_ChunkZ = a_Z/cChunk::c_ChunkWidth;
+ if(a_Z < 0 && a_Z % cChunk::c_ChunkWidth != 0) a_ChunkZ--;
- a_X = a_X - a_ChunkX*16;
- //a_Y = a_Y - a_ChunkY*16;
- a_Z = a_Z - a_ChunkZ*16;
+ a_X = a_X - a_ChunkX*cChunk::c_ChunkWidth;
+ a_Y = a_Y - a_ChunkY*cChunk::c_ChunkHeight;
+ a_Z = a_Z - a_ChunkZ*cChunk::c_ChunkWidth;
}
inline static void BlockToChunk( int a_X, int a_Y, int a_Z, int & a_ChunkX, int & a_ChunkY, int & a_ChunkZ )
{
+ // TODO: Use floor() instead of weird if statements
+ // Also fix Y
(void)a_Y; // not unused anymore
- a_ChunkX = a_X/16;
- if(a_X < 0 && a_X % 16 != 0) a_ChunkX--;
+ a_ChunkX = a_X/cChunk::c_ChunkWidth;
+ if(a_X < 0 && a_X % cChunk::c_ChunkWidth != 0) a_ChunkX--;
a_ChunkY = 0;
- a_ChunkZ = a_Z/16;
- if(a_Z < 0 && a_Z % 16 != 0) a_ChunkZ--;
+ a_ChunkZ = a_Z/cChunk::c_ChunkWidth;
+ if(a_Z < 0 && a_Z % cChunk::c_ChunkWidth != 0) a_ChunkZ--;
}
void SaveAllChunks(); //tolua_export
|