diff options
author | tron <tron@openttd.org> | 2006-03-08 06:55:33 +0000 |
---|---|---|
committer | tron <tron@openttd.org> | 2006-03-08 06:55:33 +0000 |
commit | fbe939b31f8c7ea4e6e47d6d903625dd25c5e856 (patch) | |
tree | 5dc0e72ac096a8404e81f92e3e1480cb29c96061 /industry_cmd.c | |
parent | 313754011d04ad4913bf4028b78d75ceb359e9b3 (diff) | |
download | openttd-fbe939b31f8c7ea4e6e47d6d903625dd25c5e856.tar.xz |
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
Diffstat (limited to 'industry_cmd.c')
-rw-r--r-- | industry_cmd.c | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/industry_cmd.c b/industry_cmd.c index c8100e304..c949d2360 100644 --- a/industry_cmd.c +++ b/industry_cmd.c @@ -907,7 +907,7 @@ static bool IsBadFarmFieldTile2(TileIndex tile) } } -static void SetupFarmFieldFence(TileIndex tile, int size, byte type, int direction) +static void SetupFarmFieldFence(TileIndex tile, int size, byte type, Axis direction) { do { tile = TILE_MASK(tile); @@ -917,14 +917,14 @@ static void SetupFarmFieldFence(TileIndex tile, int size, byte type, int directi if (or == 1 && CHANCE16(1, 7)) or = 2; - if (direction) { - SetFenceSW(tile, or); - } else { + if (direction == AXIS_X) { SetFenceSE(tile, or); + } else { + SetFenceSW(tile, or); } } - tile += direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0); + tile += (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1)); } while (--size); } @@ -984,10 +984,10 @@ static void PlantFarmField(TileIndex tile) type = _plantfarmfield_type[Random() & 0xF]; } - SetupFarmFieldFence(tile - TileDiffXY(1, 0), size_y, type, 1); - SetupFarmFieldFence(tile - TileDiffXY(0, 1), size_x, type, 0); - SetupFarmFieldFence(tile + TileDiffXY(size_x - 1, 0), size_y, type, 1); - SetupFarmFieldFence(tile + TileDiffXY(0, size_y - 1), size_x, type, 0); + SetupFarmFieldFence(tile - TileDiffXY(1, 0), size_y, type, AXIS_Y); + SetupFarmFieldFence(tile - TileDiffXY(0, 1), size_x, type, AXIS_X); + SetupFarmFieldFence(tile + TileDiffXY(size_x - 1, 0), size_y, type, AXIS_Y); + SetupFarmFieldFence(tile + TileDiffXY(0, size_y - 1), size_x, type, AXIS_X); } static void MaybePlantFarmField(const Industry* i) |