fix the wrong codepath being used in CanBuy when generating seeds (#5514)

This commit is contained in:
Pepper0ni 2025-05-18 22:28:55 +01:00 committed by GitHub
parent f0e40fd1dc
commit 4334a132e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View file

@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals
Rando::ItemLocation* location = ctx->GetItemLocation(loc);
RandomizerGet locItem = location->GetPlacedRandomizerGet();
if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) {
if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) {
if (gals.calculatingAvailableChecks) {
gals.accessibleLocations.push_back(loc);
StopPerformanceTimer(PT_LOCATION_LOGIC);

View file

@ -33,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const {
return GetConditionsMet();
}
bool LocationAccess::ConditionsMet(Region* parentRegion) const {
bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const {
// WARNING enterance validation can run this after resetting the access for sphere 0 validation
// When refactoring ToD access, either fix the above or do not assume that we
// have any access at all just because this is being run
@ -46,7 +46,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion) const {
conditionsMet = true;
}
return conditionsMet && CanBuy();
return conditionsMet && CanBuy(calculatingAvailableChecks);
}
static uint16_t GetMinimumPrice(const Rando::Location* loc) {
@ -90,13 +90,13 @@ static uint16_t GetMinimumPrice(const Rando::Location* loc) {
}
}
bool LocationAccess::CanBuy() const {
bool LocationAccess::CanBuy(bool calculatingAvailableChecks) const {
const auto& loc = Rando::StaticData::GetLocation(location);
const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location);
if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) {
// Checks should only be identified while playing
if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) {
if (calculatingAvailableChecks && itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) {
return CanBuyAnother(GetMinimumPrice(loc));
} else {
return CanBuyAnother(itemLoc->GetPrice());

View file

@ -84,7 +84,7 @@ class LocationAccess {
bool CheckConditionAtAgeTime(bool& age, bool& time) const;
bool ConditionsMet(Region* parentRegion) const;
bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const;
RandomizerCheck GetLocation() const {
return location;
@ -100,7 +100,7 @@ class LocationAccess {
std::string condition_str;
// Makes sure shop locations are buyable
bool CanBuy() const;
bool CanBuy(bool calculatingAvailableChecks) const;
};
bool CanBuyAnother(uint16_t price);