diff --git a/soh/soh/Enhancements/randomizer/3drando/fill.cpp b/soh/soh/Enhancements/randomizer/3drando/fill.cpp index 6b23c6f2d..d25d04aa0 100644 --- a/soh/soh/Enhancements/randomizer/3drando/fill.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/fill.cpp @@ -485,18 +485,19 @@ static void GeneratePlaythrough() { GetAccessibleLocations(ctx->allLocations, SearchMode::GeneratePlaythrough); } -RandomizerArea LookForExternalArea(Area* curRegion, std::vector alreadyChecked){//RANDOTODO curREGION - for (auto& entrance : curRegion->entrances) { +RandomizerArea LookForExternalArea(const Area* const currentRegion, std::vector &alreadyChecked){ + for (const auto& entrance : currentRegion->entrances) { RandomizerArea otherArea = entrance->GetParentRegion()->GetArea(); - if(otherArea != RA_NONE){ - return otherArea; - //if the area hasn't already been checked, check it - } else if (std::find(alreadyChecked.begin(), alreadyChecked.end(), entrance->GetParentRegionKey()) == alreadyChecked.end()) { + const bool isAreaUnchecked = std::find(alreadyChecked.begin(), alreadyChecked.end(), entrance->GetParentRegionKey()) == alreadyChecked.end(); + if (otherArea == RA_NONE && isAreaUnchecked) { + //if the region is in RA_NONE and hasn't already been checked, check it alreadyChecked.push_back(entrance->GetParentRegionKey()); - RandomizerArea passdown = LookForExternalArea(entrance->GetParentRegion(), alreadyChecked); + const RandomizerArea passdown = LookForExternalArea(entrance->GetParentRegion(), alreadyChecked); if(passdown != RA_NONE){ return passdown; } + } else if (otherArea != RA_LINKS_POCKET){ //if it's links pocket, do not propogate this, Link's Pocket is not a real Area + return otherArea; } } return RA_NONE; @@ -505,16 +506,17 @@ RandomizerArea LookForExternalArea(Area* curRegion, std::vector alreadyChecked = {(RandomizerRegion)c}; + std::vector alreadyChecked = {static_cast(regionType)}; area = LookForExternalArea(®ion, alreadyChecked); } for (auto& loc : region.locations){ ctx->GetItemLocation(loc.GetLocation())->SetArea(area); } + areaTable[regionType].SetArea(area); } } diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index 1f195251b..d571c1ab5 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -496,7 +496,7 @@ void CreateWarpSongTexts() { if (ctx->GetOption(RSK_WARP_SONG_HINTS)){ auto warpSongEntrances = GetShuffleableEntrances(EntranceType::WarpSong, false); for (auto entrance : warpSongEntrances) { - auto destination = entrance->GetConnectedRegion()->GetArea();//KNOWN ISSUE: says links pocket sometimes, putting off as this will need rewriting when entrance hits are added anyway + const auto destination = entrance->GetConnectedRegion()->GetArea(); 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})); diff --git a/soh/soh/Enhancements/randomizer/3drando/location_access.hpp b/soh/soh/Enhancements/randomizer/3drando/location_access.hpp index 82b3817bf..7a4024c69 100644 --- a/soh/soh/Enhancements/randomizer/3drando/location_access.hpp +++ b/soh/soh/Enhancements/randomizer/3drando/location_access.hpp @@ -186,6 +186,10 @@ public: return area; } + void SetArea(RandomizerArea newArea) { + area = newArea; + } + //Here checks conditional access based on whether or not both ages have //access to this area. For example: if there are rocks that block a path //which both child and adult can access, adult having hammer can give @@ -222,7 +226,6 @@ public: "Child Night: " + std::to_string(childNight) + "\t" "Adult Day: " + std::to_string(adultDay) + "\t" "Adult Night: " + std::to_string(adultNight); - //CitraPrint(message); } };