diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 5bfa5aea1..29bd91354 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -715,7 +715,7 @@ static void CalculateWotH() { //If removing this item and no other item caused the game to become unbeatable, then it is strictly necessary, //so add it unless it is in Links Pocket or an isolated place. auto itemLoc = ctx->GetItemLocation(ctx->playthroughLocations[i][j]); - if (itemLoc->IsHintable() && *itemLoc->GetAreas().begin() > RA_LINKS_POCKET && + if (itemLoc->IsHintable() && itemLoc->GetFirstArea() > RA_LINKS_POCKET && !(IsBeatableWithout(ctx->playthroughLocations[i][j], true))) { itemLoc->SetWothCandidate(); } diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index fa86a863b..770014dd9 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -501,10 +501,7 @@ void CreateWarpSongTexts() { auto warpSongEntrances = GetShuffleableEntrances(EntranceType::WarpSong, false); for (auto entrance : warpSongEntrances) { //RANDOTODO make random - RandomizerArea destination = RA_NONE; - if (!entrance->GetConnectedRegion()->GetAllAreas().empty()){ - destination = *entrance->GetConnectedRegion()->GetAllAreas().begin(); - } + RandomizerArea destination = entrance->GetConnectedRegion()->GetFirstArea(); switch (entrance->GetIndex()) { case 0x0600: // minuet RANDOTODO make into entrance hints when they are added ctx->AddHint(RH_MINUET_WARP_LOC, Hint(RH_MINUET_WARP_LOC, HINT_TYPE_AREA, "", {RHT_WARP_SONG}, {}, {destination})); @@ -748,12 +745,14 @@ void CreateStaticHintFromData(RandomizerHint hint, StaticHintInfo staticData){ std::vector locations = {}; if (staticData.targetItems.size() > 0){ locations = FindItemsAndMarkHinted(staticData.targetItems, staticData.hintChecks); - } - for(auto check: staticData.targetChecks){ - ctx->GetItemLocation(check)->SetHintAccesible(); + } else { + for(auto check: staticData.targetChecks){ + locations.push_back(check); + } } std::vector areas = {}; for (auto loc : locations){ + ctx->GetItemLocation(loc)->SetHintAccesible(); areas.push_back(RandomElementFromSet(ctx->GetItemLocation(loc)->GetAreas())); } //hintKeys are defaulted to in the hint object and do not need to be specified diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access.hpp b/soh/soh/Enhancements/randomizer/3drando/location_access.hpp index 3961418c6..d3423a3ba 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access.hpp @@ -205,6 +205,15 @@ public: return areas; } + RandomizerArea GetFirstArea() const{ + if (areas.empty()){ + assert(false); + return RA_NONE; + } else { + return *areas.begin(); + } + } + void ReplaceAreas(std::set newAreas) { areas = newAreas; } diff --git a/soh/soh/Enhancements/randomizer/hint.cpp b/soh/soh/Enhancements/randomizer/hint.cpp index b6463cab3..056102195 100644 --- a/soh/soh/Enhancements/randomizer/hint.cpp +++ b/soh/soh/Enhancements/randomizer/hint.cpp @@ -148,7 +148,7 @@ void Hint::FillGapsInData(){ for(uint8_t c = 0; c < locations.size(); c++){ //if area matters for the hint, it should be specified and not left to this if (fillAreas){ - areas.push_back(*ctx->GetItemLocation(locations[c])->GetAreas().begin()); + areas.push_back(ctx->GetItemLocation(locations[c])->GetFirstArea()); } if (fillItems){ items.push_back(ctx->GetItemLocation(locations[c])->GetPlacedRandomizerGet()); diff --git a/soh/soh/Enhancements/randomizer/item_location.cpp b/soh/soh/Enhancements/randomizer/item_location.cpp index d365081c3..75d539d04 100644 --- a/soh/soh/Enhancements/randomizer/item_location.cpp +++ b/soh/soh/Enhancements/randomizer/item_location.cpp @@ -72,6 +72,15 @@ std::set ItemLocation::GetAreas() const { return areas; } +RandomizerArea ItemLocation::GetFirstArea() const { + if (areas.empty()){ + assert(false); + return RA_NONE; + } else { + return *areas.begin(); + } +} + void ItemLocation::PlaceVanillaItem() { placedItem = StaticData::GetLocation(rc)->GetVanillaItem(); } diff --git a/soh/soh/Enhancements/randomizer/item_location.h b/soh/soh/Enhancements/randomizer/item_location.h index 7a0014bfb..335637261 100644 --- a/soh/soh/Enhancements/randomizer/item_location.h +++ b/soh/soh/Enhancements/randomizer/item_location.h @@ -23,6 +23,7 @@ class ItemLocation { RandomizerRegion GetParentRegionKey() const; void SetParentRegion (RandomizerRegion region); std::set GetAreas() const; + RandomizerArea GetFirstArea() const; void MergeAreas (std::set newAreas); void PlaceVanillaItem(); void ApplyPlacedItemEffect() const;