From db5e9cbc118b2fd1c4e39735314c891e970b3768 Mon Sep 17 00:00:00 2001 From: Pepper0ni <93387759+Pepper0ni@users.noreply.github.com> Date: Fri, 5 Jul 2024 22:49:56 +0100 Subject: [PATCH] Fix Multiple Foolish hints from an area being generated. (#4190) * Fix Multiple Foolish hints for the same location * remove debug comment --- .../Enhancements/randomizer/3drando/hints.cpp | 17 +++++++++-------- .../Enhancements/randomizer/item_location.cpp | 2 +- soh/soh/Enhancements/randomizer/item_location.h | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index d571c1ab5..a01f2a4ce 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -129,9 +129,9 @@ bool FilterWotHLocations(RandomizerCheck loc){ return ctx->GetItemLocation(loc)->IsWothCandidate(); } -bool FilterBarrenLocations(RandomizerCheck loc){ +bool FilterFoolishLocations(RandomizerCheck loc){ auto ctx = Rando::Context::GetInstance(); - return ctx->GetItemLocation(loc)->IsBarrenCandidate(); + return ctx->GetItemLocation(loc)->IsFoolishCandidate(); } bool FilterSongLocations(RandomizerCheck loc){ @@ -176,7 +176,7 @@ const std::array hintSettingTable{{ .junkWeight = 6, .distTable = { {"WotH", HINT_TYPE_WOTH, 7, 0, 1, FilterWotHLocations, 2}, - {"Barren", HINT_TYPE_FOOLISH, 4, 0, 1, FilterBarrenLocations, 1}, + {"Foolish", HINT_TYPE_FOOLISH, 4, 0, 1, FilterFoolishLocations, 1}, //("Entrance", HINT_TYPE_ENTRANCE, 6, 0, 1), //not yet implemented {"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations}, {"Overworld", HINT_TYPE_ITEM, 4, 0, 1, FilterOverworldLocations}, @@ -192,7 +192,7 @@ const std::array hintSettingTable{{ .junkWeight = 0, .distTable = { {"WotH", HINT_TYPE_WOTH, 12, 0, 2, FilterWotHLocations, 2}, - {"Barren", HINT_TYPE_FOOLISH, 12, 0, 1, FilterBarrenLocations, 1}, + {"Foolish", HINT_TYPE_FOOLISH, 12, 0, 1, FilterFoolishLocations, 1}, //{"Entrance", HINT_TYPE_ENTRANCE, 4, 0, 1}, //not yet implemented {"Song", HINT_TYPE_ITEM, 4, 0, 1, FilterSongLocations}, {"Overworld", HINT_TYPE_ITEM, 6, 0, 1, FilterOverworldLocations}, @@ -208,7 +208,7 @@ const std::array hintSettingTable{{ .junkWeight = 0, .distTable = { {"WotH", HINT_TYPE_WOTH, 15, 0, 2, FilterWotHLocations}, - {"Barren", HINT_TYPE_FOOLISH, 15, 0, 1, FilterBarrenLocations}, + {"Foolish", HINT_TYPE_FOOLISH, 15, 0, 1, FilterFoolishLocations}, //{"Entrance", HINT_TYPE_ENTRANCE, 10, 0, 1}, //not yet implemented {"Song", HINT_TYPE_ITEM, 2, 0, 1, FilterSongLocations}, {"Overworld", HINT_TYPE_ITEM, 7, 0, 1, FilterOverworldLocations}, @@ -448,9 +448,6 @@ static RandomizerCheck CreateRandomHint(std::vector& possibleHi placed = CreateHint(hintedLocation, copies, type, distributionName); } - if (type == HINT_TYPE_FOOLISH){ - SetAllInRegionAsHinted(ctx->GetItemLocation(hintedLocation)->GetArea(), possibleHintLocations); - } return hintedLocation; } @@ -582,6 +579,10 @@ uint8_t PlaceHints(std::vector& selectedHints, RandomizerCheck hintedLocation = RC_UNKNOWN_CHECK; hintedLocation = CreateRandomHint(hintTypePool, distribution.copies, distribution.type, distribution.name); + if (distribution.type == HINT_TYPE_FOOLISH){ + SetAllInRegionAsHinted(ctx->GetItemLocation(hintedLocation)->GetArea(), hintTypePool); + hintTypePool = FilterHintability(hintTypePool); + } if (hintedLocation == RC_UNKNOWN_CHECK){ //if hint failed to place, remove all wieght and copies then return the number of stones to redistribute uint8_t hintsToRemove = (selectedHints[curSlot] - numHint) * distribution.copies; selectedHints[curSlot] = 0; //as distTable is passed by refernce here, these changes stick for the rest of this seed generation diff --git a/soh/soh/Enhancements/randomizer/item_location.cpp b/soh/soh/Enhancements/randomizer/item_location.cpp index 032619a62..3185fce8a 100644 --- a/soh/soh/Enhancements/randomizer/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/item_location.cpp @@ -192,7 +192,7 @@ void ItemLocation::SetWothCandidate() { wothCandidate = true; } -bool ItemLocation::IsBarrenCandidate() const { +bool ItemLocation::IsFoolishCandidate() const { return barrenCandidate; } diff --git a/soh/soh/Enhancements/randomizer/item_location.h b/soh/soh/Enhancements/randomizer/item_location.h index 082fd4493..b40cac537 100644 --- a/soh/soh/Enhancements/randomizer/item_location.h +++ b/soh/soh/Enhancements/randomizer/item_location.h @@ -49,7 +49,7 @@ class ItemLocation { void SetVisible(bool visibleInImGui_); bool IsWothCandidate() const; void SetWothCandidate(); - bool IsBarrenCandidate() const; + bool IsFoolishCandidate() const; void SetBarrenCandidate(); void ResetVariables();