Changeset - r23554:d690e3d46135
[Not reviewed]
master
0 2 0
PeterN - 5 years ago 2019-03-27 23:10:02
peter@fuzzle.org
Fix: Incorrect display of industry production around tiles. (#7426)

Display of industry production around tiles (as shown when placing a station)
did not take account of the station catchment changes, so still showed production
from an industry even if it was not covered by a tile.

This is fixed by making a set of nearby industries that are covered, instead of
looping over all possible industries.
2 files changed with 12 insertions and 12 deletions:
0 comments (0 inline, 0 general)
bin/ai/regression/tst_regression/result.txt
Show inline comments
 
@@ -8536,7 +8536,6 @@ ERROR: IsEnd() is invalid as Begin() is 
 
--TileList_IndustryProducing--
 
  Count():             92
 
  Location ListDump:
 
    46920 => 1
 
    46919 => 1
 
    46918 => 1
 
    46917 => 1
 
@@ -8545,7 +8544,6 @@ ERROR: IsEnd() is invalid as Begin() is 
 
    46914 => 1
 
    46913 => 1
 
    46912 => 1
 
    46911 => 1
 
    46664 => 1
 
    46663 => 1
 
    46662 => 1
 
@@ -8628,6 +8626,8 @@ ERROR: IsEnd() is invalid as Begin() is 
 
    44353 => 1
 
    44352 => 1
 
    44351 => 1
 
    46920 => 0
 
    46911 => 0
 

	
 
--TileList_StationType--
 
  Count():             4
src/station_cmd.cpp
Show inline comments
 
@@ -512,21 +512,21 @@ CargoArray GetProductionAroundTiles(Tile
 
	assert(w > 0);
 
	assert(h > 0);
 

	
 
	std::set<IndustryID> industries;
 
	TileArea ta(TileXY(x1, y1), TileXY(x2 - 1, y2 - 1));
 

	
 
	/* Loop over all tiles to get the produced cargo of
 
	 * everything except industries */
 
	TILE_AREA_LOOP(tile, ta) AddProducedCargo(tile, produced);
 

	
 
	/* Loop over the industries. They produce cargo for
 
	 * anything that is within 'rad' from their bounding
 
	 * box. As such if you have e.g. a oil well the tile
 
	 * area loop might not hit an industry tile while
 
	 * the industry would produce cargo for the station.
 
	TILE_AREA_LOOP(tile, ta) {
 
		if (IsTileType(tile, MP_INDUSTRY)) industries.insert(GetIndustryIndex(tile));
 
		AddProducedCargo(tile, produced);
 
	}
 

	
 
	/* Loop over the seen industries. They produce cargo for
 
	 * anything that is within 'rad' of any one of their tiles.
 
	 */
 
	const Industry *i;
 
	FOR_ALL_INDUSTRIES(i) {
 
		if (!ta.Intersects(i->location)) continue;
 
	for (IndustryID industry : industries) {
 
		const Industry *i = Industry::Get(industry);
 
		/* Skip industry with neutral station */
 
		if (i->neutral_station != NULL && !_settings_game.station.serve_neutral_industries) continue;
 

	
0 comments (0 inline, 0 general)