From 526aad59d54c1a507449255a27d8f9bb01d60d89 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Sun, 19 Jan 2025 20:06:42 -0500 Subject: [PATCH] Fix the trick options loop (#4917) 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. --- soh/soh/Enhancements/randomizer/settings.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp index 0d9f0a171..ef7cb0cd5 100644 --- a/soh/soh/Enhancements/randomizer/settings.cpp +++ b/soh/soh/Enhancements/randomizer/settings.cpp @@ -533,7 +533,8 @@ void Settings::CreateOptions() { }); // TODO: Exclude Locations Menus mTricksByArea.clear(); - std::vector tricksOption(mTrickOptions.size()); + std::vector tricksOption; + tricksOption.reserve(mTrickOptions.size()); for (int i = 0; i < RT_MAX; i++) { auto trick = &mTrickOptions[i]; if (!trick->GetName().empty()) {