Changeset - r23468:75c935eb854b
[Not reviewed]
master
0 1 0
peter1138 - 5 years ago 2019-03-13 07:29:11
peter1138@openttd.org
Fix #7372: FindStationsAroundTiles() with caching returns no result for industry tiles.

Currently this can only be triggered by NewGRF house tiles querying for cargo acceptance history
of nearby stations (var 0x64) with a tile offset, and providing an offset that happens to point
to an industry tile. This serves no useful purpose.
1 file changed with 1 insertions and 1 deletions:
0 comments (0 inline, 0 general)
src/station_cmd.cpp
Show inline comments
 
@@ -3820,25 +3820,25 @@ static void AddNearbyStationsByCatchment
 
 * Find all stations around a rectangular producer (industry, house, headquarter, ...)
 
 *
 
 * @param location The location/area of the producer
 
 * @param stations The list to store the stations in
 
 * @param use_nearby Use nearby station list of industry/town associated with location.tile
 
 */
 
void FindStationsAroundTiles(const TileArea &location, StationList *stations, bool use_nearby)
 
{
 
	if (use_nearby) {
 
		/* Industries and towns maintain a list of nearby stations */
 
		if (IsTileType(location.tile, MP_INDUSTRY)) {
 
			/* Industry nearby stations are already filtered by catchment. */
 
			stations = &Industry::GetByTile(location.tile)->stations_near;
 
			*stations = Industry::GetByTile(location.tile)->stations_near;
 
			return;
 
		} else if (IsTileType(location.tile, MP_HOUSE)) {
 
			/* Town nearby stations need to be filtered per tile. */
 
			assert(location.w == 1 && location.h == 1);
 
			AddNearbyStationsByCatchment(location.tile, stations, Town::GetByTile(location.tile)->stations_near);
 
			return;
 
		}
 
	}
 

	
 
	/* Not using, or don't have a nearby stations list, so we need to scan. */
 
	uint x = TileX(location.tile);
 
	uint y = TileY(location.tile);
0 comments (0 inline, 0 general)