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:
@@ -3097,16 +3097,16 @@ VehicleOrderID ProcessConditionalOrder(const Order *order, const Vehicle *v, Pro
|
||||
case OCV_UNCONDITIONALLY: skip_order = true; break;
|
||||
case OCV_CARGO_WAITING: {
|
||||
StationID next_station = GetNextRealStation(v, order);
|
||||
if (Station::IsValidID(next_station)) skip_order = OrderConditionCompare(occ, (Station::Get(next_station)->goods[value].cargo.AvailableCount() > 0), value);
|
||||
if (Station::IsValidID(next_station)) skip_order = OrderConditionCompare(occ, (Station::Get(next_station)->goods[value].CargoAvailableCount() > 0), value);
|
||||
break;
|
||||
}
|
||||
case OCV_CARGO_WAITING_AMOUNT: {
|
||||
StationID next_station = GetNextRealStation(v, order);
|
||||
if (Station::IsValidID(next_station)) {
|
||||
if (GB(order->GetXData(), 16, 16) == 0) {
|
||||
skip_order = OrderConditionCompare(occ, Station::Get(next_station)->goods[value].cargo.AvailableCount(), GB(order->GetXData(), 0, 16));
|
||||
skip_order = OrderConditionCompare(occ, Station::Get(next_station)->goods[value].CargoAvailableCount(), GB(order->GetXData(), 0, 16));
|
||||
} else {
|
||||
skip_order = OrderConditionCompare(occ, Station::Get(next_station)->goods[value].cargo.AvailableViaCount(GB(order->GetXData(), 16, 16) - 2), GB(order->GetXData(), 0, 16));
|
||||
skip_order = OrderConditionCompare(occ, Station::Get(next_station)->goods[value].CargoAvailableViaCount(GB(order->GetXData(), 16, 16) - 2), GB(order->GetXData(), 0, 16));
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
Reference in New Issue
Block a user