summary refs log tree commit diff stats
path: root/src/map.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/map.h')
-rw-r--r--src/map.h12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/map.h b/src/map.h index 2235b07..13b2b32 100644 --- a/src/map.h +++ b/src/map.h
@@ -45,16 +45,8 @@ struct Chunk {
45}; 45};
46 46
47inline void toChunkPos(int x, int y, int& cx, int& cy) { 47inline void toChunkPos(int x, int y, int& cx, int& cy) {
48 cx = x / CHUNK_WIDTH; 48 cx = std::floor(static_cast<double>(x) / CHUNK_WIDTH);
49 cy = y / CHUNK_HEIGHT; 49 cy = std::floor(static_cast<double>(y) / CHUNK_HEIGHT);
50 if (x < 0) {
51 cx *= -1;
52 cx--;
53 }
54 if (y < 0) {
55 cy *= -1;
56 cy--;
57 }
58} 50}
59 51
60class Map { 52class Map {