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:
Peter Nelson
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

@@ -513,7 +513,7 @@ static void ShowRejectOrAcceptNews(const Station *st, uint num_items, CargoID *c
*/
CargoArray GetProductionAroundTiles(TileIndex north_tile, int w, int h, int rad)
{
CargoArray produced;
CargoArray produced{};
std::set<IndustryID> industries;
TileArea ta = TileArea(north_tile, w, h).Expand(rad);
@@ -552,7 +552,7 @@ CargoArray GetProductionAroundTiles(TileIndex north_tile, int w, int h, int rad)
*/
CargoArray GetAcceptanceAroundTiles(TileIndex center_tile, int w, int h, int rad, CargoTypes *always_accepted)
{
CargoArray acceptance;
CargoArray acceptance{};
if (always_accepted != nullptr) *always_accepted = 0;
TileArea ta = TileArea(center_tile, w, h).Expand(rad);
@@ -574,7 +574,7 @@ CargoArray GetAcceptanceAroundTiles(TileIndex center_tile, int w, int h, int rad
*/
static CargoArray GetAcceptanceAroundStation(const Station *st, CargoTypes *always_accepted)
{
CargoArray acceptance;
CargoArray acceptance{};
if (always_accepted != nullptr) *always_accepted = 0;
BitmapTileIterator it(st->catchment_tiles);
@@ -596,7 +596,7 @@ void UpdateStationAcceptance(Station *st, bool show_msg)
CargoTypes old_acc = GetAcceptanceMask(st);
/* And retrieve the acceptance. */
CargoArray acceptance;
CargoArray acceptance{};
if (!st->rect.IsEmpty()) {
acceptance = GetAcceptanceAroundStation(st, &st->always_accepted);
}