src/newgrf_industrytiles.cpp
changeset 8458 38fe72ff1402
parent 8275 f17d0c863ee3
child 8570 f50de4804ff1
equal deleted inserted replaced
8457:b5359aaeddca 8458:38fe72ff1402
    43  * @param index of the industry been queried for
    43  * @param index of the industry been queried for
    44  * @return a construction of bits obeying the newgrf format
    44  * @return a construction of bits obeying the newgrf format
    45  */
    45  */
    46 uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index)
    46 uint32 GetNearbyIndustryTileInformation(byte parameter, TileIndex tile, IndustryID index)
    47 {
    47 {
    48 	byte tile_type;
       
    49 	bool is_same_industry;
       
    50 
       
    51 	if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
    48 	if (parameter != 0) tile = GetNearbyTile(parameter, tile); // only perform if it is required
    52 	is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index);
    49 	bool is_same_industry = (IsTileType(tile, MP_INDUSTRY) && GetIndustryIndex(tile) == index);
    53 	tile_type = GetTerrainType(tile) << 2 | (IsTileType(tile, MP_WATER) ? 1 : 0) << 1 | (is_same_industry ? 1 : 0);
    50 
    54 
    51 	return GetNearbyTileInformation(tile) | (is_same_industry ? 1 : 0) << 8;
    55 	uint z;
       
    56 	Slope tileh = GetTileSlope(tile, &z);
       
    57 	return GetTileType(tile) << 24 | z << 16 | tile_type << 8 | tileh;
       
    58 }
    52 }
    59 
    53 
    60 /** This is the position of the tile relative to the northernmost tile of the industry.
    54 /** This is the position of the tile relative to the northernmost tile of the industry.
    61  * Format: 00yxYYXX
    55  * Format: 00yxYYXX
    62  * Variable  Content
    56  * Variable  Content