Move StationCargoList and FlowStatMap out of GoodsEntry struct
Move them into a new GoodsEntryData struct referenced using a std::unique_ptr from GoodsEntry. The unique_ptr may be nullptr if the cargo list and flow stat map are both empty (this is the case for unused cargoes). This reduces GoodsEntry from 128 to 24 bytes, and Station from 8680 to 2024 bytes, (on Linux x86_64).
This commit is contained in:
@@ -1476,7 +1476,7 @@ static void MaybeCrashAirplane(Aircraft *v)
|
||||
/* Crash the airplane. Remove all goods stored at the station. */
|
||||
for (CargoID i = 0; i < NUM_CARGO; i++) {
|
||||
st->goods[i].rating = 1;
|
||||
st->goods[i].cargo.Truncate();
|
||||
if (st->goods[i].data != nullptr) st->goods[i].data->cargo.Truncate();
|
||||
}
|
||||
|
||||
CrashAirplane(v);
|
||||
|
Reference in New Issue
Block a user