summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Dubé <159546+serprex@users.noreply.github.com>2026-08-29 21:29:36 +0000
committerGitHub <noreply@github.com>2026-08-29 21:29:36 +0000
commitbb6d1d3b4bef74a94248f7364b6d3fa25287d454 (patch)
treeae556af24408d168e81c699cc345f0656cd5c1f0
parentb043cdf4002e17361f34d71203b92f6c91942506 (diff)
Cleanup mExcludeLocationsOptionsArea (#7131)
-rw-r--r--soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp4
-rw-r--r--soh/soh/Enhancements/randomizer/SeedContext.cpp14
-rw-r--r--soh/soh/Enhancements/randomizer/settings.cpp7
-rw-r--r--soh/soh/Enhancements/randomizer/settings.h8
4 files changed, 13 insertions, 20 deletions
diff --git a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp
index 188a22592..4e5a16264 100644
--- a/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp
+++ b/soh/soh/Enhancements/randomizer/3drando/spoiler_log.cpp
@@ -162,8 +162,8 @@ std::string RemoveLineBreaks(std::string s) {
static void WriteExcludedLocations() {
auto ctx = Rando::Context::GetInstance();
- for (size_t i = 0; i < Rando::Settings::GetInstance()->GetExcludeLocationsOptions().size(); i++) {
- for (const auto& location : Rando::Settings::GetInstance()->GetExcludeLocationsOptions()[i]) {
+ for (const auto& areaOptions : Rando::Settings::GetInstance()->GetExcludeLocationsOptions()) {
+ for (const auto* location : areaOptions) {
if (ctx->GetLocationOption(static_cast<RandomizerCheck>(location->GetKey())).Get() == RO_LOCATION_INCLUDE) {
continue;
}
diff --git a/soh/soh/Enhancements/randomizer/SeedContext.cpp b/soh/soh/Enhancements/randomizer/SeedContext.cpp
index 66fc1b38b..e1db1c496 100644
--- a/soh/soh/Enhancements/randomizer/SeedContext.cpp
+++ b/soh/soh/Enhancements/randomizer/SeedContext.cpp
@@ -17,6 +17,7 @@
#include "soh/Enhancements/randomizer/randomizer_check_tracker.h"
#include "soh/Enhancements/randomizer/randomizer.h"
+#include <algorithm>
#include <vector>
#include <fstream>
@@ -276,14 +277,13 @@ void Context::AddExcludedOptions() {
continue;
}
AddLocation(loc.GetRandomizerCheck(), &everyPossibleLocation);
- bool alreadyAdded = false;
- for (Option* location : Rando::Settings::GetInstance()->GetExcludeOptionsForArea(loc.GetArea())) {
- if (location->GetName() == loc.GetExcludedOption()->GetName()) {
- alreadyAdded = true;
- }
- }
+ Option* excludedOption = loc.GetExcludedOption();
+ auto& areaOptions = Settings::GetInstance()->GetExcludeOptionsForArea(loc.GetArea());
+ const bool alreadyAdded = std::any_of(areaOptions.begin(), areaOptions.end(), [&](const Option* option) {
+ return option->GetName() == excludedOption->GetName();
+ });
if (!alreadyAdded) {
- Rando::Settings::GetInstance()->GetExcludeOptionsForArea(loc.GetArea()).push_back(loc.GetExcludedOption());
+ areaOptions.push_back(excludedOption);
}
}
}
diff --git a/soh/soh/Enhancements/randomizer/settings.cpp b/soh/soh/Enhancements/randomizer/settings.cpp
index 92a4689ef..2ab5783dd 100644
--- a/soh/soh/Enhancements/randomizer/settings.cpp
+++ b/soh/soh/Enhancements/randomizer/settings.cpp
@@ -105,9 +105,6 @@ void Settings::HandleShopsanityPriceUI() {
}
}
-Settings::Settings() : mExcludeLocationsOptionsAreas(RCAREA_INVALID) {
-}
-
#define OPT_U8(rsk, ...) mOptions[rsk] = Option::U8(rsk, __VA_ARGS__)
#define OPT_BOOL(rsk, ...) mOptions[rsk] = Option::Bool(rsk, __VA_ARGS__)
#define OPT_TRICK(rsk, ...) mTrickSettings[rsk] = TrickSetting::LogicTrick(rsk, __VA_ARGS__)
@@ -1516,8 +1513,6 @@ void Settings::CreateOptions() {
StaticData::optionNameToEnum = PopulateOptionNameToEnum();
- mExcludeLocationsOptionsAreas.reserve(RCAREA_INVALID);
-
// RANDOTODO sweep trick descriptions and make sure they match a post-refactor, post shuffles reality
/* Common abbreviations in name tags
- A: Adult
@@ -2603,7 +2598,7 @@ std::vector<Option*>& Settings::GetExcludeOptionsForArea(const RandomizerCheckAr
return mExcludeLocationsOptionsAreas[area];
}
-const std::vector<std::vector<Option*>>& Settings::GetExcludeLocationsOptions() const {
+const std::array<std::vector<Option*>, RCAREA_INVALID>& Settings::GetExcludeLocationsOptions() const {
return mExcludeLocationsOptionsAreas;
}
diff --git a/soh/soh/Enhancements/randomizer/settings.h b/soh/soh/Enhancements/randomizer/settings.h
index b9c1d5797..310dd4056 100644
--- a/soh/soh/Enhancements/randomizer/settings.h
+++ b/soh/soh/Enhancements/randomizer/settings.h
@@ -9,8 +9,6 @@
namespace Rando {
class Settings {
public:
- Settings();
-
/**
* @brief Hides or Unhides the price UI of Shopsanity based on settings.
*/
@@ -88,9 +86,9 @@ class Settings {
/**
* @brief Get a reference to all of the Exclude Location `Option` lists.
*
- * @return const std::vector<std::vector<Option*>>&
+ * @return const std::array<std::vector<Option*>, RCAREA_INVALID>&
*/
- const std::vector<std::vector<Option*>>& GetExcludeLocationsOptions() const;
+ const std::array<std::vector<Option*>, RCAREA_INVALID>& GetExcludeLocationsOptions() const;
/**
* @brief Get the list of `OptionGroup`s.
@@ -156,7 +154,7 @@ class Settings {
std::array<std::string, RSK_MAX> mOptionDescriptions = {};
std::array<OptionGroup, RSG_MAX> mOptionGroups = {};
std::array<TrickSetting, RT_MAX> mTrickSettings = {};
- std::vector<std::vector<Option*>> mExcludeLocationsOptionsAreas = {};
+ std::array<std::vector<Option*>, RCAREA_INVALID> mExcludeLocationsOptionsAreas = {};
std::unordered_map<std::string, RandomizerTrick> mTrickNameToEnum;
};
} // namespace Rando