src/newgrf_commons.cpp
changeset 8955 8d6bb31af11b
parent 8954 ca1d17502817
child 9007 6fc05c8ecf87
equal deleted inserted replaced
8954:ca1d17502817 8955:8d6bb31af11b
    13 #include "newgrf.h"
    13 #include "newgrf.h"
    14 #include "newgrf_commons.h"
    14 #include "newgrf_commons.h"
    15 #include "tile_map.h"
    15 #include "tile_map.h"
    16 #include "station_map.h"
    16 #include "station_map.h"
    17 #include "settings_type.h"
    17 #include "settings_type.h"
       
    18 #include "tree_map.h"
    18 
    19 
    19 /** Constructor of generic class
    20 /** Constructor of generic class
    20  * @param offset end of original data for this entity. i.e: houses = 110
    21  * @param offset end of original data for this entity. i.e: houses = 110
    21  * @param maximum of entities this manager can deal with. i.e: houses = 512
    22  * @param maximum of entities this manager can deal with. i.e: houses = 512
    22  * @param invalid is the ID used to identify an invalid entity id
    23  * @param invalid is the ID used to identify an invalid entity id
   294  */
   295  */
   295 uint32 GetNearbyTileInformation(TileIndex tile)
   296 uint32 GetNearbyTileInformation(TileIndex tile)
   296 {
   297 {
   297 	TileType tile_type = GetTileType(tile);
   298 	TileType tile_type = GetTileType(tile);
   298 
   299 
       
   300 	/* Fake tile type for trees on shore */
       
   301 	if (IsTileType(tile, MP_TREES) && GetTreeGround(tile) == TREE_GROUND_SHORE) tile_type = MP_WATER;
       
   302 
   299 	uint z;
   303 	uint z;
   300 	Slope tileh = GetTileSlope(tile, &z);
   304 	Slope tileh = GetTileSlope(tile, &z);
   301 	byte terrain_type = GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1;
   305 	byte terrain_type = GetTerrainType(tile) << 2 | (tile_type == MP_WATER ? 1 : 0) << 1;
   302 	return tile_type << 24 | z << 16 | terrain_type << 8 | tileh;
   306 	return tile_type << 24 | z << 16 | terrain_type << 8 | tileh;
   303 }
   307 }