industry_cmd.c
changeset 3157 3f35e2d9c8e3
parent 3144 33e42feae531
child 3173 f56ca618721b
--- a/industry_cmd.c	Tue Mar 07 07:51:05 2006 +0000
+++ b/industry_cmd.c	Wed Mar 08 06:55:33 2006 +0000
@@ -907,7 +907,7 @@
 	}
 }
 
-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 @@
 
 			if (or == 1 && CHANCE16(1, 7)) or = 2;
 
-			if (direction) {
+			if (direction == AXIS_X) {
+				SetFenceSE(tile, or);
+			} else {
 				SetFenceSW(tile, or);
-			} else {
-				SetFenceSE(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 @@
 		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)