905 case MP_TREES: return false; |
905 case MP_TREES: return false; |
906 default: return true; |
906 default: return true; |
907 } |
907 } |
908 } |
908 } |
909 |
909 |
910 static void SetupFarmFieldFence(TileIndex tile, int size, byte type, int direction) |
910 static void SetupFarmFieldFence(TileIndex tile, int size, byte type, Axis direction) |
911 { |
911 { |
912 do { |
912 do { |
913 tile = TILE_MASK(tile); |
913 tile = TILE_MASK(tile); |
914 |
914 |
915 if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) { |
915 if (IsTileType(tile, MP_CLEAR) || IsTileType(tile, MP_TREES)) { |
916 byte or = type; |
916 byte or = type; |
917 |
917 |
918 if (or == 1 && CHANCE16(1, 7)) or = 2; |
918 if (or == 1 && CHANCE16(1, 7)) or = 2; |
919 |
919 |
920 if (direction) { |
920 if (direction == AXIS_X) { |
|
921 SetFenceSE(tile, or); |
|
922 } else { |
921 SetFenceSW(tile, or); |
923 SetFenceSW(tile, or); |
922 } else { |
|
923 SetFenceSE(tile, or); |
|
924 } |
924 } |
925 } |
925 } |
926 |
926 |
927 tile += direction ? TileDiffXY(0, 1) : TileDiffXY(1, 0); |
927 tile += (direction == AXIS_X ? TileDiffXY(1, 0) : TileDiffXY(0, 1)); |
928 } while (--size); |
928 } while (--size); |
929 } |
929 } |
930 |
930 |
931 static void PlantFarmField(TileIndex tile) |
931 static void PlantFarmField(TileIndex tile) |
932 { |
932 { |
982 type = 3; |
982 type = 3; |
983 if (_opt.landscape != LT_HILLY && _opt.landscape != LT_DESERT) { |
983 if (_opt.landscape != LT_HILLY && _opt.landscape != LT_DESERT) { |
984 type = _plantfarmfield_type[Random() & 0xF]; |
984 type = _plantfarmfield_type[Random() & 0xF]; |
985 } |
985 } |
986 |
986 |
987 SetupFarmFieldFence(tile - TileDiffXY(1, 0), size_y, type, 1); |
987 SetupFarmFieldFence(tile - TileDiffXY(1, 0), size_y, type, AXIS_Y); |
988 SetupFarmFieldFence(tile - TileDiffXY(0, 1), size_x, type, 0); |
988 SetupFarmFieldFence(tile - TileDiffXY(0, 1), size_x, type, AXIS_X); |
989 SetupFarmFieldFence(tile + TileDiffXY(size_x - 1, 0), size_y, type, 1); |
989 SetupFarmFieldFence(tile + TileDiffXY(size_x - 1, 0), size_y, type, AXIS_Y); |
990 SetupFarmFieldFence(tile + TileDiffXY(0, size_y - 1), size_x, type, 0); |
990 SetupFarmFieldFence(tile + TileDiffXY(0, size_y - 1), size_x, type, AXIS_X); |
991 } |
991 } |
992 |
992 |
993 static void MaybePlantFarmField(const Industry* i) |
993 static void MaybePlantFarmField(const Industry* i) |
994 { |
994 { |
995 if (CHANCE16(1, 8)) { |
995 if (CHANCE16(1, 8)) { |