diff options
author | tron <tron@openttd.org> | 2005-01-07 17:02:43 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2005-01-07 17:02:43 +0000 |
commit | 7ca6b2b8b0d6f66966fa2ff01e3e9961314dfcc4 (patch) | |
tree | e4137b60a824b45ce09f668d58520e36dba10256 /misc.c | |
parent | f5c33e50733c46cee14e84ade6da0c171d96064b (diff) | |
download | openttd-7ca6b2b8b0d6f66966fa2ff01e3e9961314dfcc4.tar.xz |
(svn r1414) Move TileIndex, TILE_MASK and GET_TILE_[XY] to map.h and turn the latter into inline functions names Tile[XY]
Diffstat (limited to 'misc.c')
-rw-r--r-- | misc.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -527,21 +527,21 @@ void InitializeLandscapeVariables(bool only_constants) // distance in Manhattan metric uint GetTileDist(TileIndex xy1, TileIndex xy2) { - return myabs(GET_TILE_X(xy1) - GET_TILE_X(xy2)) + - myabs(GET_TILE_Y(xy1) - GET_TILE_Y(xy2)); + return myabs(TileX(xy1) - TileX(xy2)) + + myabs(TileY(xy1) - TileY(xy2)); } // maximum distance in x _or_ y uint GetTileDist1D(TileIndex xy1, TileIndex xy2) { - return max(myabs(GET_TILE_X(xy1) - GET_TILE_X(xy2)), - myabs(GET_TILE_Y(xy1) - GET_TILE_Y(xy2))); + return max(myabs(TileX(xy1) - TileX(xy2)), + myabs(TileY(xy1) - TileY(xy2))); } uint GetTileDist1Db(TileIndex xy1, TileIndex xy2) { - int a = myabs(GET_TILE_X(xy1) - GET_TILE_X(xy2)); - int b = myabs(GET_TILE_Y(xy1) - GET_TILE_Y(xy2)); + int a = myabs(TileX(xy1) - TileX(xy2)); + int b = myabs(TileY(xy1) - TileY(xy2)); if (a > b) return a*2+b; @@ -551,15 +551,15 @@ uint GetTileDist1Db(TileIndex xy1, TileIndex xy2) uint GetTileDistAdv(TileIndex xy1, TileIndex xy2) { - uint a = myabs(GET_TILE_X(xy1) - GET_TILE_X(xy2)); - uint b = myabs(GET_TILE_Y(xy1) - GET_TILE_Y(xy2)); + uint a = myabs(TileX(xy1) - TileX(xy2)); + uint b = myabs(TileY(xy1) - TileY(xy2)); return a*a+b*b; } bool CheckDistanceFromEdge(TileIndex tile, uint distance) { - return IS_INT_INSIDE(GET_TILE_X(tile), distance, MapSizeX() - distance) && - IS_INT_INSIDE(GET_TILE_Y(tile), distance, MapSizeY() - distance); + return IS_INT_INSIDE(TileX(tile), distance, MapSizeX() - distance) && + IS_INT_INSIDE(TileY(tile), distance, MapSizeY() - distance); } void OnNewDay_Train(Vehicle *v); @@ -732,8 +732,8 @@ int FindFirstBit(uint32 value) extern uint SafeTileAdd(uint tile, int add, const char *exp, const char *file, int line) { - uint x = GET_TILE_X(tile) + (signed char)(add & 0xFF); - uint y = GET_TILE_Y(tile) + ((((0x8080 + add)>>8) & 0xFF) - 0x80); + uint x = TileX(tile) + (signed char)(add & 0xFF); + uint y = TileY(tile) + ((((0x8080 + add)>>8) & 0xFF) - 0x80); if (x >= MapSizeX() || y >= MapSizeY()) { char buf[512]; |