ai.c
changeset 536 03d80fecb999
parent 460 7506c66ce4c3
child 538 24fdb517fbe5
equal deleted inserted replaced
535:0ddbb93125d1 536:03d80fecb999
  1934 	arf->cur_best_depth = 0xff;
  1934 	arf->cur_best_depth = 0xff;
  1935 
  1935 
  1936 	return better;
  1936 	return better;
  1937 }
  1937 }
  1938 
  1938 
  1939 static void FORCEINLINE AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex tile, const byte *p)
  1939 static inline void AiCheckBuildRailBridgeHere(AiRailFinder *arf, TileIndex tile, const byte *p)
  1940 {
  1940 {
  1941 	TileIndex tile_new;
  1941 	TileIndex tile_new;
  1942 	bool flag;
  1942 	bool flag;
  1943 
  1943 
  1944 	int dir2 = p[0] & 3;
  1944 	int dir2 = p[0] & 3;
  1974 				arf->bridge_end_tile = tile_new;
  1974 				arf->bridge_end_tile = tile_new;
  1975 		}
  1975 		}
  1976 	}
  1976 	}
  1977 }
  1977 }
  1978 
  1978 
  1979 static void FORCEINLINE AiCheckBuildRailTunnelHere(AiRailFinder *arf, TileIndex tile, const byte *p)
  1979 static inline void AiCheckBuildRailTunnelHere(AiRailFinder *arf, TileIndex tile, const byte *p)
  1980 {
  1980 {
  1981 	FindLandscapeHeightByTile(&arf->ti, tile);
  1981 	FindLandscapeHeightByTile(&arf->ti, tile);
  1982 
  1982 
  1983 	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) {
  1983 	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) {
  1984 		int32 cost = DoCommandByTile(tile, arf->player->ai.railtype_to_use, 0, DC_AUTO, CMD_BUILD_TUNNEL);
  1984 		int32 cost = DoCommandByTile(tile, arf->player->ai.railtype_to_use, 0, DC_AUTO, CMD_BUILD_TUNNEL);
  2811 		8+4,
  2811 		8+4,
  2812 	};
  2812 	};
  2813 	return DoCommandByTile(tile, _road_bits[type], 0, flags, CMD_BUILD_ROAD) != CMD_ERROR;
  2813 	return DoCommandByTile(tile, _road_bits[type], 0, flags, CMD_BUILD_ROAD) != CMD_ERROR;
  2814 }
  2814 }
  2815 
  2815 
  2816 static void FORCEINLINE AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
  2816 static inline void AiCheckBuildRoadBridgeHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
  2817 {
  2817 {
  2818 	TileIndex tile_new;
  2818 	TileIndex tile_new;
  2819 	bool flag;
  2819 	bool flag;
  2820 
  2820 
  2821 	int dir2 = p[0] & 3;
  2821 	int dir2 = p[0] & 3;
  2851 				arf->bridge_end_tile = tile_new;
  2851 				arf->bridge_end_tile = tile_new;
  2852 		}
  2852 		}
  2853 	}
  2853 	}
  2854 }
  2854 }
  2855 
  2855 
  2856 static void FORCEINLINE AiCheckBuildRoadTunnelHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
  2856 static inline void AiCheckBuildRoadTunnelHere(AiRoadFinder *arf, TileIndex tile, const byte *p)
  2857 {
  2857 {
  2858 	FindLandscapeHeightByTile(&arf->ti, tile);
  2858 	FindLandscapeHeightByTile(&arf->ti, tile);
  2859 
  2859 
  2860 	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) {
  2860 	if (arf->ti.tileh == _dir_table_2[p[0]&3] && arf->ti.z!=0) {
  2861 		int32 cost = DoCommandByTile(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);
  2861 		int32 cost = DoCommandByTile(tile, 0x200, 0, DC_AUTO, CMD_BUILD_TUNNEL);