src/newgrf_commons.cpp
changeset 8954 ca1d17502817
parent 8890 7db39585f2b3
child 8955 8d6bb31af11b
equal deleted inserted replaced
8953:19bf73113162 8954:ca1d17502817
   283 	if (IsRailwayStationTile(tile) && GetRailStationAxis(tile) == AXIS_X) Swap(x, y);
   283 	if (IsRailwayStationTile(tile) && GetRailStationAxis(tile) == AXIS_X) Swap(x, y);
   284 
   284 
   285 	/* Make sure we never roam outside of the map */
   285 	/* Make sure we never roam outside of the map */
   286 	return TILE_MASK(tile + TileDiffXY(x, y));
   286 	return TILE_MASK(tile + TileDiffXY(x, y));
   287 }
   287 }
       
   288 
       
   289 /**
       
   290  * Common part of station var 0x67 , house var 0x62, indtile var 0x60, industry var 0x62.
       
   291  *
       
   292  * @param tile the tile of interest.
       
   293  * @return 0czzbbss: c = TileType; zz = TileZ; bb: 7-3 zero, 4-2 TerrainType, 1 water/shore, 0 zero; ss = TileSlope
       
   294  */
       
   295 uint32 GetNearbyTileInformation(TileIndex tile)
       
   296 {
       
   297 	TileType tile_type = GetTileType(tile);
       
   298 
       
   299 	uint z;
       
   300 	Slope tileh = GetTileSlope(tile, &z);
       
   301 	byte terrain_type = GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1;
       
   302 	return tile_type << 24 | z << 16 | terrain_type << 8 | tileh;
       
   303 }