summaryrefslogtreecommitdiff
path: root/unmovable_cmd.c
diff options
context:
space:
mode:
authortron <tron@openttd.org>2005-06-25 16:44:57 +0000
committertron <tron@openttd.org>2005-06-25 16:44:57 +0000
commit9617614b04b7e2981ebff5074b55778381ca8b20 (patch)
treeed8629cbd76a9334fd657971f55ef5cb63c9915f /unmovable_cmd.c
parent2b73dec56791a1aa3b2e3c333ae2d4673a7cfbfc (diff)
downloadopenttd-9617614b04b7e2981ebff5074b55778381ca8b20.tar.xz
(svn r2487) Replace TILE_XY by TileXY/TileDiffXY
Diffstat (limited to 'unmovable_cmd.c')
-rw-r--r--unmovable_cmd.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/unmovable_cmd.c b/unmovable_cmd.c
index c8ae9b8dd..e40244c55 100644
--- a/unmovable_cmd.c
+++ b/unmovable_cmd.c
@@ -41,10 +41,10 @@ int32 DestroyCompanyHQ(TileIndex tile, uint32 flags)
if (p->location_of_house == 0) return CMD_ERROR;
if (flags & DC_EXEC) {
- DoClearSquare(p->location_of_house + TILE_XY(0,0));
- DoClearSquare(p->location_of_house + TILE_XY(0,1));
- DoClearSquare(p->location_of_house + TILE_XY(1,0));
- DoClearSquare(p->location_of_house + TILE_XY(1,1));
+ DoClearSquare(p->location_of_house + TileDiffXY(0, 0));
+ DoClearSquare(p->location_of_house + TileDiffXY(0, 1));
+ DoClearSquare(p->location_of_house + TileDiffXY(1, 0));
+ DoClearSquare(p->location_of_house + TileDiffXY(1, 1));
p->location_of_house = 0; // reset HQ position
InvalidateWindow(WC_COMPANY, (int)p->index);
}
@@ -89,10 +89,10 @@ int32 CmdBuildCompanyHQ(int x, int y, uint32 flags, uint32 p1, uint32 p2)
p->location_of_house = tile;
- ModifyTile(tile + TILE_XY(0,0), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x80);
- ModifyTile(tile + TILE_XY(0,1), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x81);
- ModifyTile(tile + TILE_XY(1,0), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x82);
- ModifyTile(tile + TILE_XY(1,1), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x83);
+ ModifyTile(tile + TileDiffXY(0, 0), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x80);
+ ModifyTile(tile + TileDiffXY(0, 1), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x81);
+ ModifyTile(tile + TileDiffXY(1, 0), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x82);
+ ModifyTile(tile + TileDiffXY(1, 1), MP_SETTYPE(MP_UNMOVABLE) | MP_MAPOWNER_CURRENT | MP_MAP5, 0x83);
UpdatePlayerHouse(p, score);
InvalidateWindow(WC_COMPANY, (int)p->index);
}
@@ -322,9 +322,7 @@ static const TileIndexDiffC _tile_add[] = {
/* checks, if a radio tower is within a 9x9 tile square around tile */
static bool checkRadioTowerNearby(TileIndex tile)
{
- TileIndex tile_s;
-
- tile_s = TILE_XY(TileX(tile) - 4, TileY(tile) - 4);
+ TileIndex tile_s = tile - TileDiffXY(4, 4);
BEGIN_TILE_LOOP(tile, 9, 9, tile_s)
// already a radio tower here?
@@ -375,10 +373,10 @@ restart:
dir = r >> 30;
r %= (dir == 0 || dir == 2) ? MapMaxY() : MapMaxX();
tile =
- (dir==0)?TILE_XY(0,r):0 + // left
- (dir==1)?TILE_XY(r,0):0 + // top
- (dir == 2) ? TILE_XY(MapMaxX(), r) : 0 + // right
- (dir == 3) ? TILE_XY(r, MapMaxY()) : 0; // bottom
+ (dir == 0) ? TileXY(0, r) : 0 + // left
+ (dir == 1) ? TileXY(r, 0) : 0 + // top
+ (dir == 2) ? TileXY(MapMaxX(), r) : 0 + // right
+ (dir == 3) ? TileXY(r, MapMaxY()) : 0; // bottom
j = 20;
do {
if (--j == 0)