Fix recalculation area in UpdateTownCargoesHouse
This commit is contained in:
@@ -93,7 +93,7 @@ struct Town : TownPool::PoolItem<&_town_pool> {
|
|||||||
|
|
||||||
/* Cargo production and acceptance stats. */
|
/* Cargo production and acceptance stats. */
|
||||||
CargoTypes cargo_produced; ///< Bitmap of all cargoes produced by houses in this town.
|
CargoTypes cargo_produced; ///< Bitmap of all cargoes produced by houses in this town.
|
||||||
AcceptanceMatrix cargo_accepted; ///< Bitmap of cargoes accepted by houses for each 4*4 (really 6*6) map square of the town.
|
AcceptanceMatrix cargo_accepted; ///< Bitmap of cargoes accepted by houses for each 4*4 (really 12*12) map square of the town.
|
||||||
CargoTypes cargo_accepted_total; ///< NOSAVE: Bitmap of all cargoes accepted by houses in this town.
|
CargoTypes cargo_accepted_total; ///< NOSAVE: Bitmap of all cargoes accepted by houses in this town.
|
||||||
StationList stations_near; ///< NOSAVE: List of nearby stations.
|
StationList stations_near; ///< NOSAVE: List of nearby stations.
|
||||||
|
|
||||||
|
@@ -991,8 +991,8 @@ static void UpdateTownCargoesSingleGridArea(Town *t, TileIndex start, bool updat
|
|||||||
|
|
||||||
static void UpdateTownCargoesHouse(Town *t, TileIndex start, bool x_two_tiles, bool y_two_tiles, bool update_total = true)
|
static void UpdateTownCargoesHouse(Town *t, TileIndex start, bool x_two_tiles, bool y_two_tiles, bool update_total = true)
|
||||||
{
|
{
|
||||||
TileIndex lower = TileAddWrap(start, -1, -1);
|
TileIndex lower = TileAddSaturating(start, -AcceptanceMatrix::GRID, -AcceptanceMatrix::GRID);
|
||||||
TileIndex upper = TileAddWrap(start, x_two_tiles ? 2 : 1, y_two_tiles ? 2 : 1);
|
TileIndex upper = TileAddSaturating(start, AcceptanceMatrix::GRID + (x_two_tiles ? 1 : 0), AcceptanceMatrix::GRID + (y_two_tiles ? 1 : 0));
|
||||||
for (uint x = TileX(lower) & ~(AcceptanceMatrix::GRID - 1); x <= TileX(upper); x += AcceptanceMatrix::GRID) {
|
for (uint x = TileX(lower) & ~(AcceptanceMatrix::GRID - 1); x <= TileX(upper); x += AcceptanceMatrix::GRID) {
|
||||||
for (uint y = TileY(lower) & ~(AcceptanceMatrix::GRID - 1); y <= TileY(upper); y += AcceptanceMatrix::GRID) {
|
for (uint y = TileY(lower) & ~(AcceptanceMatrix::GRID - 1); y <= TileY(upper); y += AcceptanceMatrix::GRID) {
|
||||||
UpdateTownCargoesSingleGridArea(t, TileXY(x, y), false);
|
UpdateTownCargoesSingleGridArea(t, TileXY(x, y), false);
|
||||||
|
Reference in New Issue
Block a user