mirror of https://github.com/OpenTTD/OpenTTD
(svn r16552) -Codechange: make AddTileIndexDiffCWrap() a bit faster
parent
d6996c110a
commit
5e1c59c3de
|
@ -297,10 +297,9 @@ static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC dif
|
||||||
{
|
{
|
||||||
int x = TileX(tile) + diff.x;
|
int x = TileX(tile) + diff.x;
|
||||||
int y = TileY(tile) + diff.y;
|
int y = TileY(tile) + diff.y;
|
||||||
if (x < 0 || y < 0 || x > (int)MapMaxX() || y > (int)MapMaxY())
|
/* Negative value will become big positive value after cast */
|
||||||
return INVALID_TILE;
|
if ((uint)x >= MapSizeX() || (uint)y >= MapSizeY()) return INVALID_TILE;
|
||||||
else
|
return TileXY(x, y);
|
||||||
return TileXY(x, y);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue