Slightly reorder struct Station to reduce padding waste

This commit is contained in:
Jonathan G Rennison 2024-06-21 18:14:14 +01:00
parent d4819ad184
commit 04254af89c
2 changed files with 4 additions and 5 deletions

View File

@ -77,9 +77,7 @@ Station::Station(TileIndex tile) :
indtype(IT_INVALID), indtype(IT_INVALID),
extra_name_index(UINT16_MAX), extra_name_index(UINT16_MAX),
time_since_load(255), time_since_load(255),
time_since_unload(255), time_since_unload(255)
station_cargo_history_cargoes(0),
station_cargo_history_offset(0)
{ {
/* this->random_bits is set in Station::AddFacility() */ /* this->random_bits is set in Station::AddFacility() */
} }

View File

@ -901,6 +901,8 @@ public:
uint8_t time_since_load; uint8_t time_since_load;
uint8_t time_since_unload; uint8_t time_since_unload;
uint8_t station_cargo_history_offset = 0; ///< Start offset in station_cargo_history cargo ring buffer, here for alignment
std::vector<Vehicle *> loading_vehicles; std::vector<Vehicle *> loading_vehicles;
GoodsEntry goods[NUM_CARGO]; ///< Goods at this station GoodsEntry goods[NUM_CARGO]; ///< Goods at this station
CargoTypes always_accepted; ///< Bitmask of always accepted cargo types (by houses, HQs, industry tiles when industry doesn't accept cargo) CargoTypes always_accepted; ///< Bitmask of always accepted cargo types (by houses, HQs, industry tiles when industry doesn't accept cargo)
@ -908,8 +910,7 @@ public:
IndustryList industries_near; ///< Cached list of industries near the station that can accept cargo, @see DeliverGoodsToIndustry() IndustryList industries_near; ///< Cached list of industries near the station that can accept cargo, @see DeliverGoodsToIndustry()
Industry *industry; ///< NOSAVE: Associated industry for neutral stations. (Rebuilt on load from Industry->st) Industry *industry; ///< NOSAVE: Associated industry for neutral stations. (Rebuilt on load from Industry->st)
CargoTypes station_cargo_history_cargoes; ///< Bitmask of cargoes in station_cargo_history CargoTypes station_cargo_history_cargoes = 0; ///< Bitmask of cargoes in station_cargo_history
uint8_t station_cargo_history_offset; ///< Start offset in station_cargo_history cargo ring buffer
std::vector<std::array<uint16_t, MAX_STATION_CARGO_HISTORY_DAYS>> station_cargo_history; ///< Station history of waiting cargo, dynamic range compressed (see RXCompressUint) std::vector<std::array<uint16_t, MAX_STATION_CARGO_HISTORY_DAYS>> station_cargo_history; ///< Station history of waiting cargo, dynamic range compressed (see RXCompressUint)
Station(TileIndex tile = INVALID_TILE); Station(TileIndex tile = INVALID_TILE);