diff --git a/src/map/tile.cpp b/src/map/tile.cpp index e619c32bf..6ec05beca 100644 --- a/src/map/tile.cpp +++ b/src/map/tile.cpp @@ -12,9 +12,9 @@ Tile::ID Tile::ID::parent(int8_t parent_z) const { assert(parent_z < z); int32_t dim = pow(2, z - parent_z); return Tile::ID{ - static_cast(parent_z), - static_cast(floor((float)x / dim)), - static_cast(y / dim) + parent_z, + (x >= 0 ? x : x - dim + 1) / dim, + y / dim }; }