diff --git a/src/town.h b/src/town.h index 8d44e9ae1c..6454647a39 100644 --- a/src/town.h +++ b/src/town.h @@ -93,7 +93,7 @@ struct Town : TownPool::PoolItem<&_town_pool> { /* Cargo production and acceptance stats. */ 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. StationList stations_near; ///< NOSAVE: List of nearby stations. diff --git a/src/town_cmd.cpp b/src/town_cmd.cpp index 4e7f609056..63682a0d5c 100644 --- a/src/town_cmd.cpp +++ b/src/town_cmd.cpp @@ -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) { - TileIndex lower = TileAddWrap(start, -1, -1); - TileIndex upper = TileAddWrap(start, x_two_tiles ? 2 : 1, y_two_tiles ? 2 : 1); + TileIndex lower = TileAddSaturating(start, -AcceptanceMatrix::GRID, -AcceptanceMatrix::GRID); + 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 y = TileY(lower) & ~(AcceptanceMatrix::GRID - 1); y <= TileY(upper); y += AcceptanceMatrix::GRID) { UpdateTownCargoesSingleGridArea(t, TileXY(x, y), false);