mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-10 08:00:05 +00:00
Codechange: replace macro with function for TileAdd(XY)
This commit is contained in:
parent
27eadc13ec
commit
ecf534522c
@ -455,27 +455,31 @@ inline TileIndexDiff ToTileIndexDiff(TileIndexDiffC tidc)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a given offset to a tile.
|
||||||
|
*
|
||||||
|
* @param tile The tile to add an offset to.
|
||||||
|
* @param offset The offset to add.
|
||||||
|
* @return The resulting tile.
|
||||||
|
*/
|
||||||
#ifndef _DEBUG
|
#ifndef _DEBUG
|
||||||
/**
|
constexpr TileIndex TileAdd(TileIndex tile, TileIndexDiff offset) { return tile + offset; }
|
||||||
* Adds two tiles together.
|
|
||||||
*
|
|
||||||
* @param x One tile
|
|
||||||
* @param y Another tile to add
|
|
||||||
* @return The resulting tile(index)
|
|
||||||
*/
|
|
||||||
# define TileAdd(x, y) ((x) + (y))
|
|
||||||
#else
|
#else
|
||||||
extern TileIndex TileAdd(TileIndex tile, TileIndexDiff offset);
|
TileIndex TileAdd(TileIndex tile, TileIndexDiff offset);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds a given offset to a tile.
|
* Adds a given offset to a tile.
|
||||||
*
|
*
|
||||||
* @param tile The tile to add an offset on it
|
* @param tile The tile to add an offset to.
|
||||||
* @param x The x offset to add to the tile
|
* @param x The x offset to add to the tile.
|
||||||
* @param y The y offset to add to the tile
|
* @param y The y offset to add to the tile.
|
||||||
|
* @return The resulting tile.
|
||||||
*/
|
*/
|
||||||
#define TileAddXY(tile, x, y) TileAdd(tile, TileDiffXY(x, y))
|
inline TileIndex TileAddXY(TileIndex tile, int x, int y)
|
||||||
|
{
|
||||||
|
return TileAdd(tile, TileDiffXY(x, y));
|
||||||
|
}
|
||||||
|
|
||||||
TileIndex TileAddWrap(TileIndex tile, int addx, int addy);
|
TileIndex TileAddWrap(TileIndex tile, int addx, int addy);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user