Cleanup mExcludeLocationsOptionsArea (#7131)

This commit is contained in:
Philip Dubé
2026-08-29 21:29:36 +00:00
committed by GitHub
parent b043cdf400
commit bb6d1d3b4b
4 changed files with 13 additions and 20 deletions
@@ -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;
}
@@ -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);
}
}
}
+1 -6
View File
@@ -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;
}
+3 -5
View File
@@ -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