Skip to content

Commit

Permalink
Fix the trick options loop (HarbourMasters#4917)
Browse files Browse the repository at this point in the history
It initialized an array with a size, which pre-filled
it all with nullptrs, and then used push_back on top of that.
So it was a bunch of nullptrs followed by the actual
option pointers. Fixed by calling reserve instead of
constructing with a size, so it reserves the memory it needs
without actually filling the vector with nullptrs, so push_back
properly starts from the beginning.
  • Loading branch information
leggettc18 authored Jan 20, 2025
1 parent ed674f1 commit 526aad5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion soh/soh/Enhancements/randomizer/settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -533,7 +533,8 @@ void Settings::CreateOptions() {
});
// TODO: Exclude Locations Menus
mTricksByArea.clear();
std::vector<Option*> tricksOption(mTrickOptions.size());
std::vector<Option*> tricksOption;
tricksOption.reserve(mTrickOptions.size());
for (int i = 0; i < RT_MAX; i++) {
auto trick = &mTrickOptions[i];
if (!trick->GetName().empty()) {
Expand Down

0 comments on commit 526aad5

Please sign in to comment.