Avoid unnecessary GoodsEntryData creation
This commit is contained in:
@@ -636,7 +636,7 @@ bool VehicleCargoList::Stage(bool accepted, StationID current_station, StationID
|
|||||||
CargoPacketList transfer_deliver;
|
CargoPacketList transfer_deliver;
|
||||||
std::vector<CargoPacket *> keep;
|
std::vector<CargoPacket *> keep;
|
||||||
|
|
||||||
const FlowStatMap &flows = ge->CreateData().flows;
|
const FlowStatMap &flows = ge->ConstFlows();
|
||||||
|
|
||||||
bool force_keep = (order_flags & OUFB_NO_UNLOAD) != 0;
|
bool force_keep = (order_flags & OUFB_NO_UNLOAD) != 0;
|
||||||
bool force_unload = (order_flags & OUFB_UNLOAD) != 0;
|
bool force_unload = (order_flags & OUFB_UNLOAD) != 0;
|
||||||
|
@@ -182,6 +182,7 @@ void LinkGraphJob::FinaliseJob()
|
|||||||
geflows.insert(std::move(*it));
|
geflows.insert(std::move(*it));
|
||||||
}
|
}
|
||||||
geflows.SortStorage();
|
geflows.SortStorage();
|
||||||
|
ge.RemoveDataIfUnused();
|
||||||
InvalidateWindowData(WC_STATION_VIEW, st->index, this->Cargo());
|
InvalidateWindowData(WC_STATION_VIEW, st->index, this->Cargo());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -715,6 +715,11 @@ struct GoodsEntry {
|
|||||||
{
|
{
|
||||||
return this->data != nullptr ? this->data->flows : _empty_flows;
|
return this->data != nullptr ? this->data->flows : _empty_flows;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RemoveDataIfUnused()
|
||||||
|
{
|
||||||
|
if (this->data != nullptr && this->data->MayBeRemoved()) this->data.reset();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/** All airport-related information. Only valid if tile != INVALID_TILE. */
|
/** All airport-related information. Only valid if tile != INVALID_TILE. */
|
||||||
|
Reference in New Issue
Block a user