Codechange: Base CargoArray off std::array.

This avoids needing to define array accessors and allows use of
default value initialization.
This commit is contained in:
2023-05-23 12:23:50 +01:00
committed by PeterN
parent 74e42e39a8
commit f177ce7c9a
14 changed files with 26 additions and 68 deletions

View File

@@ -323,7 +323,7 @@ bool FindSubsidyTownCargoRoute()
if (src_town->cache.population < SUBSIDY_CARGO_MIN_POPULATION) return false;
/* Calculate the produced cargo of houses around town center. */
CargoArray town_cargo_produced;
CargoArray town_cargo_produced{};
TileArea ta = TileArea(src_town->xy, 1, 1).Expand(SUBSIDY_TOWN_CARGO_RADIUS);
for (TileIndex tile : ta) {
if (IsTileType(tile, MP_HOUSE)) {
@@ -431,7 +431,7 @@ bool FindSubsidyCargoDestination(CargoID cid, SourceType src_type, SourceID src)
const Town *dst_town = Town::GetRandom();
/* Calculate cargo acceptance of houses around town center. */
CargoArray town_cargo_accepted;
CargoArray town_cargo_accepted{};
TileArea ta = TileArea(dst_town->xy, 1, 1).Expand(SUBSIDY_TOWN_CARGO_RADIUS);
for (TileIndex tile : ta) {
if (IsTileType(tile, MP_HOUSE)) {