Fix padded tile area being used for industries in FindStationsAroundTiles
This commit is contained in:
@@ -1668,7 +1668,7 @@ static void PopulateStationsNearby(Industry *ind)
|
||||
}
|
||||
|
||||
/* Get our list of nearby stations. */
|
||||
FindStationsAroundTiles(ind->location, &ind->stations_near, false);
|
||||
FindStationsAroundTiles(ind->location, &ind->stations_near, false, ind->index);
|
||||
|
||||
/* Test if industry can accept cargo */
|
||||
uint cargo_index;
|
||||
|
@@ -1389,7 +1389,7 @@ void CheckCaches(bool force_check, std::function<void(const char *)> log)
|
||||
CCLOG("industry stations_near mismatch: ind %i, (old size: %u, new size: %u)", (int)ind->index, (uint)old_industry_stations_nears[i].size(), (uint)ind->stations_near.size());
|
||||
}
|
||||
StationList stlist;
|
||||
FindStationsAroundTiles(ind->location, &stlist, false);
|
||||
FindStationsAroundTiles(ind->location, &stlist, false, ind->index);
|
||||
if (ind->stations_near != stlist) {
|
||||
CCLOG("industry FindStationsAroundTiles mismatch: ind %i, (recalc size: %u, find size: %u)", (int)ind->index, (uint)ind->stations_near.size(), (uint)stlist.size());
|
||||
}
|
||||
|
@@ -4054,7 +4054,7 @@ static void AddNearbyStationsByCatchment(TileIndex tile, StationList *stations,
|
||||
* @param[out] 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 * const stations, bool use_nearby)
|
||||
void FindStationsAroundTiles(const TileArea &location, StationList * const stations, bool use_nearby, const IndustryID industry_filter)
|
||||
{
|
||||
if (use_nearby) {
|
||||
/* Industries and towns maintain a list of nearby stations */
|
||||
@@ -4092,6 +4092,7 @@ void FindStationsAroundTiles(const TileArea &location, StationList * const stati
|
||||
|
||||
/* Test if the tile is within the station's catchment */
|
||||
TILE_AREA_LOOP(tile, location) {
|
||||
if (industry_filter != INVALID_INDUSTRY && (!IsTileType(tile, MP_INDUSTRY) || GetIndustryIndex(tile) != industry_filter)) continue;
|
||||
if (st->TileIsInCatchment(tile)) {
|
||||
stations->insert(st);
|
||||
break;
|
||||
|
@@ -23,7 +23,7 @@
|
||||
|
||||
void ModifyStationRatingAround(TileIndex tile, Owner owner, int amount, uint radius);
|
||||
|
||||
void FindStationsAroundTiles(const TileArea &location, StationList *stations, bool use_nearby = true);
|
||||
void FindStationsAroundTiles(const TileArea &location, StationList *stations, bool use_nearby = true, IndustryID industry_filter = INVALID_INDUSTRY);
|
||||
|
||||
void ShowStationViewWindow(StationID station);
|
||||
void UpdateAllStationVirtCoords();
|
||||
|
Reference in New Issue
Block a user