VarAction2: Use reserve and shrink_to_fit for DSG adjusts vector

This commit is contained in:
Jonathan G Rennison
2023-08-17 21:20:17 +01:00
parent 129691dcc7
commit c49651ae7b
2 changed files with 7 additions and 0 deletions

View File

@@ -6014,6 +6014,9 @@ static void NewSpriteGroup(ByteReader *buf)
/* Continue reading var adjusts while bit 5 is set. */
} while (HasBit(varadjust, 5));
/* shrink_to_fit will be called later */
group->adjusts.reserve(current_adjusts.size());
for (const DeterministicSpriteGroupAdjust &adjust : current_adjusts) {
group->adjusts.push_back(adjust);
OptimiseVarAction2Adjust(va2_opt_state, info, group, group->adjusts.back());