Reserve vector size when loading station flow stats
This commit is contained in:
@@ -646,6 +646,7 @@ static void Load_STNN()
|
|||||||
SlObjectLoadFiltered(&st->goods[i], _filtered_goods_desc);
|
SlObjectLoadFiltered(&st->goods[i], _filtered_goods_desc);
|
||||||
StationID prev_source = INVALID_STATION;
|
StationID prev_source = INVALID_STATION;
|
||||||
if (SlXvIsFeaturePresent(XSLFI_FLOW_STAT_FLAGS)) {
|
if (SlXvIsFeaturePresent(XSLFI_FLOW_STAT_FLAGS)) {
|
||||||
|
st->goods[i].flows.reserve(_num_flows);
|
||||||
for (uint32 j = 0; j < _num_flows; ++j) {
|
for (uint32 j = 0; j < _num_flows; ++j) {
|
||||||
FlowSaveLoad flow;
|
FlowSaveLoad flow;
|
||||||
buffer->CheckBytes(2 + 4);
|
buffer->CheckBytes(2 + 4);
|
||||||
|
@@ -493,6 +493,11 @@ public:
|
|||||||
return this->flows_index.begin()->first;
|
return this->flows_index.begin()->first;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void reserve(size_t size)
|
||||||
|
{
|
||||||
|
this->flows_storage.reserve(size);
|
||||||
|
}
|
||||||
|
|
||||||
void SortStorage();
|
void SortStorage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user