Skip to content

Commit 76febc6

Browse files
committed
Change TilePos::y from uint8_t to int
* Fixes integer overflow issues
1 parent 1925815 commit 76febc6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

source/world/level/TilePos.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ TilePos::TilePos(int _x, int _y, int _z)
2121

2222
TilePos::TilePos(float _x, float _y, float _z)
2323
{
24-
_init((int)floorf(_x), (uint8_t)floorf(_y), (int)floorf(_z));
24+
_init((int)floorf(_x), (int)floorf(_y), (int)floorf(_z));
2525
}
2626

2727
TilePos::TilePos(const Vec3& pos)

source/world/level/TilePos.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct ChunkPos;
1515
struct TilePos
1616
{
1717
int x;
18-
uint8_t y; // 255 height limit
18+
int y; // We had this on uint8_t due to the 255 height limit, but this can overflow too easily
1919
int z;
2020

2121
private:

0 commit comments

Comments
 (0)