Fix UB in tileat()
This commit is contained in:
parent
61c0e17fd8
commit
2c8d01df49
@ -144,8 +144,8 @@ static inline double dot(dvec_t v, dvec_t u)
|
||||
static inline unsigned
|
||||
tileat(const map_t map, int layeridx, double x, double y)
|
||||
{
|
||||
const unsigned row = (unsigned)floor(x / TILESIZE) + MAPSHIFTX;
|
||||
const unsigned col = (unsigned)floor(y / TILESIZE) + MAPSHIFTY;
|
||||
const unsigned row = (unsigned)(floor(x / TILESIZE) + MAPSHIFTX);
|
||||
const unsigned col = (unsigned)(floor(y / TILESIZE) + MAPSHIFTY);
|
||||
if (row >= MAPWIDTH || col >= MAPHEIGHT)
|
||||
return 0;
|
||||
else
|
||||
|
Loading…
x
Reference in New Issue
Block a user