industry_cmd.c
changeset 2955 27221592ebbc
parent 2952 6a26eeda9679
child 2979 883788245931
equal deleted inserted replaced
2954:5a55071e0b50 2955:27221592ebbc
     1 /* $Id$ */
     1 /* $Id$ */
     2 
     2 
     3 #include "stdafx.h"
     3 #include "stdafx.h"
     4 #include "openttd.h"
     4 #include "openttd.h"
       
     5 #include "clear.h"
     5 #include "table/strings.h"
     6 #include "table/strings.h"
     6 #include "table/sprites.h"
     7 #include "table/sprites.h"
     7 #include "functions.h"
     8 #include "functions.h"
     8 #include "map.h"
     9 #include "map.h"
     9 #include "tile.h"
    10 #include "tile.h"
   883 static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6};
   884 static const byte _plantfarmfield_type[] = {1, 1, 1, 1, 1, 3, 3, 4, 4, 4, 5, 5, 5, 6, 6, 6};
   884 
   885 
   885 static bool IsBadFarmFieldTile(TileIndex tile)
   886 static bool IsBadFarmFieldTile(TileIndex tile)
   886 {
   887 {
   887 	switch (GetTileType(tile)) {
   888 	switch (GetTileType(tile)) {
   888 		case MP_CLEAR: {
   889 		case MP_CLEAR: return IsClearGround(tile, CL_FIELDS) || IsClearGround(tile, CL_SNOW);
   889 			byte m5 = _m[tile].m5 & 0x1C;
   890 		case MP_TREES: return false;
   890 			return m5 == 0xC || m5 == 0x10;
   891 		default:       return true;
   891 		}
       
   892 
       
   893 		case MP_TREES:
       
   894 			return false;
       
   895 
       
   896 		default:
       
   897 			return true;
       
   898 	}
   892 	}
   899 }
   893 }
   900 
   894 
   901 static bool IsBadFarmFieldTile2(TileIndex tile)
   895 static bool IsBadFarmFieldTile2(TileIndex tile)
   902 {
   896 {
   903 	switch (GetTileType(tile)) {
   897 	switch (GetTileType(tile)) {
   904 		case MP_CLEAR: {
   898 		case MP_CLEAR: return IsClearGround(tile, CL_SNOW);
   905 			byte m5 = _m[tile].m5 & 0x1C;
   899 		case MP_TREES: return false;
   906 			return m5 == 0x10;
   900 		default:       return true;
   907 		}
       
   908 
       
   909 		case MP_TREES:
       
   910 			return false;
       
   911 
       
   912 		default:
       
   913 			return true;
       
   914 	}
   901 	}
   915 }
   902 }
   916 
   903 
   917 static void SetupFarmFieldFence(TileIndex tile, int size, byte type, int direction)
   904 static void SetupFarmFieldFence(TileIndex tile, int size, byte type, int direction)
   918 {
   905 {