diff options
author | smatz <smatz@openttd.org> | 2009-06-10 14:07:08 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-06-10 14:07:08 +0000 |
commit | 5e1c59c3de00e594e7627359588eb66e7ef69511 (patch) | |
tree | ddc7288354a14fe5218e920cf439993de81f99f2 /src | |
parent | d6996c110add9e1619162405f899c528294f5893 (diff) | |
download | openttd-5e1c59c3de00e594e7627359588eb66e7ef69511.tar.xz |
(svn r16552) -Codechange: make AddTileIndexDiffCWrap() a bit faster
Diffstat (limited to 'src')
-rw-r--r-- | src/map_func.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/map_func.h b/src/map_func.h index 537b1f9a7..1deafc00c 100644 --- a/src/map_func.h +++ b/src/map_func.h @@ -297,10 +297,9 @@ static inline TileIndex AddTileIndexDiffCWrap(TileIndex tile, TileIndexDiffC dif { int x = TileX(tile) + diff.x; int y = TileY(tile) + diff.y; - if (x < 0 || y < 0 || x > (int)MapMaxX() || y > (int)MapMaxY()) - return INVALID_TILE; - else - return TileXY(x, y); + /* Negative value will become big positive value after cast */ + if ((uint)x >= MapSizeX() || (uint)y >= MapSizeY()) return INVALID_TILE; + return TileXY(x, y); } /** |