Fix Link's Pocket Appearing in Hints. (#4191)

* Fix issues with areas not being applied to the region itself, and Link's Pocket Propogating through randomised warps

* Address reviews

* address reviews again

* fix mac issues

* git pls
This commit is contained in:
Pepper0ni 2024-07-05 22:35:47 +01:00 committed by GitHub
parent baf7691fbd
commit 510b655e5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 12 deletions

View File

@ -485,18 +485,19 @@ static void GeneratePlaythrough() {
GetAccessibleLocations(ctx->allLocations, SearchMode::GeneratePlaythrough);
}
RandomizerArea LookForExternalArea(Area* curRegion, std::vector<RandomizerRegion> alreadyChecked){//RANDOTODO curREGION
for (auto& entrance : curRegion->entrances) {
RandomizerArea LookForExternalArea(const Area* const currentRegion, std::vector<RandomizerRegion> &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<RandomizerRegion
void SetAreas(){
auto ctx = Rando::Context::GetInstance();
//RANDOTODO give entrances an enum like RandomizerCheck, the give them all areas here, the use those areas to not need to recursivly find ItemLocation areas
for (int c = 0; c < RR_MARKER_AREAS_END; c++) {
Area region = areaTable[c];
for (int regionType = 0; regionType < RR_MARKER_AREAS_END; regionType++) {
Area region = areaTable[regionType];
RandomizerArea area = region.GetArea();
if (area == RA_NONE) {
std::vector<RandomizerRegion> alreadyChecked = {(RandomizerRegion)c};
std::vector<RandomizerRegion> alreadyChecked = {static_cast<RandomizerRegion>(regionType)};
area = LookForExternalArea(&region, alreadyChecked);
}
for (auto& loc : region.locations){
ctx->GetItemLocation(loc.GetLocation())->SetArea(area);
}
areaTable[regionType].SetArea(area);
}
}

View File

@ -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}));

View File

@ -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);
}
};