mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-02-07 02:40:30 -05:00
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.
This commit is contained in:
parent
ed674f1ed2
commit
526aad59d5
@ -533,7 +533,8 @@ void Settings::CreateOptions() {
|
|||||||
});
|
});
|
||||||
// TODO: Exclude Locations Menus
|
// TODO: Exclude Locations Menus
|
||||||
mTricksByArea.clear();
|
mTricksByArea.clear();
|
||||||
std::vector<Option*> tricksOption(mTrickOptions.size());
|
std::vector<Option*> tricksOption;
|
||||||
|
tricksOption.reserve(mTrickOptions.size());
|
||||||
for (int i = 0; i < RT_MAX; i++) {
|
for (int i = 0; i < RT_MAX; i++) {
|
||||||
auto trick = &mTrickOptions[i];
|
auto trick = &mTrickOptions[i];
|
||||||
if (!trick->GetName().empty()) {
|
if (!trick->GetName().empty()) {
|
||||||
|
Loading…
Reference in New Issue
Block a user