mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-07-30 03:28:55 -07:00
fix the wrong codepath being used in CanBuy when generating seeds (#5514)
This commit is contained in:
parent
f0e40fd1dc
commit
4334a132e3
3 changed files with 7 additions and 7 deletions
|
@ -421,7 +421,7 @@ bool AddCheckToLogic(LocationAccess& locPair, GetAccessibleLocationsStruct& gals
|
||||||
Rando::ItemLocation* location = ctx->GetItemLocation(loc);
|
Rando::ItemLocation* location = ctx->GetItemLocation(loc);
|
||||||
RandomizerGet locItem = location->GetPlacedRandomizerGet();
|
RandomizerGet locItem = location->GetPlacedRandomizerGet();
|
||||||
|
|
||||||
if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion)) {
|
if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) {
|
||||||
if (gals.calculatingAvailableChecks) {
|
if (gals.calculatingAvailableChecks) {
|
||||||
gals.accessibleLocations.push_back(loc);
|
gals.accessibleLocations.push_back(loc);
|
||||||
StopPerformanceTimer(PT_LOCATION_LOGIC);
|
StopPerformanceTimer(PT_LOCATION_LOGIC);
|
||||||
|
|
|
@ -33,7 +33,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const {
|
||||||
return GetConditionsMet();
|
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
|
// 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
|
// 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
|
// have any access at all just because this is being run
|
||||||
|
@ -46,7 +46,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion) const {
|
||||||
conditionsMet = true;
|
conditionsMet = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return conditionsMet && CanBuy();
|
return conditionsMet && CanBuy(calculatingAvailableChecks);
|
||||||
}
|
}
|
||||||
|
|
||||||
static uint16_t GetMinimumPrice(const Rando::Location* loc) {
|
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& loc = Rando::StaticData::GetLocation(location);
|
||||||
const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location);
|
const auto& itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(location);
|
||||||
|
|
||||||
if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) {
|
if (loc->GetRCType() == RCTYPE_SHOP || loc->GetRCType() == RCTYPE_SCRUB || loc->GetRCType() == RCTYPE_MERCHANT) {
|
||||||
// Checks should only be identified while playing
|
// Checks should only be identified while playing
|
||||||
if (itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) {
|
if (calculatingAvailableChecks && itemLoc->GetCheckStatus() != RCSHOW_IDENTIFIED) {
|
||||||
return CanBuyAnother(GetMinimumPrice(loc));
|
return CanBuyAnother(GetMinimumPrice(loc));
|
||||||
} else {
|
} else {
|
||||||
return CanBuyAnother(itemLoc->GetPrice());
|
return CanBuyAnother(itemLoc->GetPrice());
|
||||||
|
|
|
@ -84,7 +84,7 @@ class LocationAccess {
|
||||||
|
|
||||||
bool CheckConditionAtAgeTime(bool& age, bool& time) const;
|
bool CheckConditionAtAgeTime(bool& age, bool& time) const;
|
||||||
|
|
||||||
bool ConditionsMet(Region* parentRegion) const;
|
bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const;
|
||||||
|
|
||||||
RandomizerCheck GetLocation() const {
|
RandomizerCheck GetLocation() const {
|
||||||
return location;
|
return location;
|
||||||
|
@ -100,7 +100,7 @@ class LocationAccess {
|
||||||
std::string condition_str;
|
std::string condition_str;
|
||||||
|
|
||||||
// Makes sure shop locations are buyable
|
// Makes sure shop locations are buyable
|
||||||
bool CanBuy() const;
|
bool CanBuy(bool calculatingAvailableChecks) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
bool CanBuyAnother(uint16_t price);
|
bool CanBuyAnother(uint16_t price);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue