From 04254af89c08e1960adb0fee265a7450f12541c3 Mon Sep 17 00:00:00 2001 From: Jonathan G Rennison Date: Fri, 21 Jun 2024 18:14:14 +0100 Subject: [PATCH] Slightly reorder struct Station to reduce padding waste --- src/station.cpp | 4 +--- src/station_base.h | 5 +++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/station.cpp b/src/station.cpp index 6e7b4e8536..860fa6a8f8 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -77,9 +77,7 @@ Station::Station(TileIndex tile) : indtype(IT_INVALID), extra_name_index(UINT16_MAX), time_since_load(255), - time_since_unload(255), - station_cargo_history_cargoes(0), - station_cargo_history_offset(0) + time_since_unload(255) { /* this->random_bits is set in Station::AddFacility() */ } diff --git a/src/station_base.h b/src/station_base.h index e5b6c456b2..9e8f47642f 100644 --- a/src/station_base.h +++ b/src/station_base.h @@ -901,6 +901,8 @@ public: uint8_t time_since_load; 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 loading_vehicles; 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) @@ -908,8 +910,7 @@ public: 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) - CargoTypes station_cargo_history_cargoes; ///< Bitmask of cargoes in station_cargo_history - uint8_t station_cargo_history_offset; ///< Start offset in station_cargo_history cargo ring buffer + CargoTypes station_cargo_history_cargoes = 0; ///< Bitmask of cargoes in station_cargo_history std::vector> station_cargo_history; ///< Station history of waiting cargo, dynamic range compressed (see RXCompressUint) Station(TileIndex tile = INVALID_TILE);