Rename Accessible Checks to Available Checks.

This commit is contained in:
Anthony Stewart 2025-03-21 22:02:52 -05:00
commit 2cce99aaf9
11 changed files with 69 additions and 69 deletions

View file

@ -1408,8 +1408,8 @@ static bool SfxHandler(std::shared_ptr<Ship::Console> Console, const std::vector
return 0; return 0;
} }
static bool RecalculateAccessibleChecksHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) { static bool RecalculateAvailableChecksHandler(std::shared_ptr<Ship::Console> Console, const std::vector<std::string>& args, std::string* output) {
CheckTracker::RecalculateAccessibleChecks(); CheckTracker::RecalculateAvailableChecks();
return 0; return 0;
} }
@ -1602,7 +1602,7 @@ void DebugConsole_Init(void) {
{"group_name", Ship::ArgumentType::TEXT, true}, {"group_name", Ship::ArgumentType::TEXT, true},
}}); }});
CMD_REGISTER("recalculate_accessible_checks", {RecalculateAccessibleChecksHandler, "Recalculate accessible checks."}); CMD_REGISTER("recalculate_available_checks", {RecalculateAvailableChecksHandler, "Recalculate available checks."});
Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame(); Ship::Context::GetInstance()->GetWindow()->GetGui()->SaveConsoleVariablesNextFrame();
} }

View file

@ -25,7 +25,7 @@ typedef enum {
PT_TOD_ACCESS, PT_TOD_ACCESS,
PT_ENTRANCE_LOGIC, PT_ENTRANCE_LOGIC,
PT_LOCATION_LOGIC, PT_LOCATION_LOGIC,
PT_RECALCULATE_ACCESSIBLE_CHECKS, PT_RECALCULATE_AVAILABLE_CHECKS,
PT_MAX PT_MAX
} TimerID; } TimerID;

View file

@ -396,8 +396,8 @@ 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, gals.calculatingAccessibleChecks)) { if (!location->IsAddedToPool() && locPair.ConditionsMet(parentRegion, gals.calculatingAvailableChecks)) {
if (gals.calculatingAccessibleChecks) { if (gals.calculatingAvailableChecks) {
gals.accessibleLocations.push_back(loc); gals.accessibleLocations.push_back(loc);
StopPerformanceTimer(PT_LOCATION_LOGIC); StopPerformanceTimer(PT_LOCATION_LOGIC);
return false; return false;
@ -498,19 +498,19 @@ void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, Randomize
} }
// Return any of the targetLocations that are accessible in logic // Return any of the targetLocations that are accessible in logic
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& targetLocations, RandomizerGet ignore /* = RG_NONE*/, bool calculatingAccessibleChecks /* = false */) { std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& targetLocations, RandomizerGet ignore /* = RG_NONE*/, bool calculatingAvailableChecks /* = false */) {
auto ctx = Rando::Context::GetInstance(); auto ctx = Rando::Context::GetInstance();
GetAccessibleLocationsStruct gals(0); GetAccessibleLocationsStruct gals(0);
gals.calculatingAccessibleChecks = calculatingAccessibleChecks; gals.calculatingAvailableChecks = calculatingAvailableChecks;
ResetLogic(ctx, gals, !calculatingAccessibleChecks); ResetLogic(ctx, gals, !calculatingAvailableChecks);
do { do {
gals.InitLoop(); gals.InitLoop();
for (size_t i = 0; i < gals.regionPool.size(); i++) { for (size_t i = 0; i < gals.regionPool.size(); i++) {
ProcessRegion(RegionTable(gals.regionPool[i]), gals, ignore); ProcessRegion(RegionTable(gals.regionPool[i]), gals, ignore);
} }
} while (gals.logicUpdated); } while (gals.logicUpdated);
erase_if(gals.accessibleLocations, [&targetLocations, ctx, calculatingAccessibleChecks](RandomizerCheck loc) { erase_if(gals.accessibleLocations, [&targetLocations, ctx, calculatingAvailableChecks](RandomizerCheck loc) {
if (ctx->GetItemLocation(loc)->GetPlacedRandomizerGet() != RG_NONE && !calculatingAccessibleChecks) { if (ctx->GetItemLocation(loc)->GetPlacedRandomizerGet() != RG_NONE && !calculatingAvailableChecks) {
return false; return false;
} }
for (RandomizerCheck allowedLocation : targetLocations) { for (RandomizerCheck allowedLocation : targetLocations) {

View file

@ -34,7 +34,7 @@ struct GetAccessibleLocationsStruct {
std::vector<RandomizerCheck> itemSphere; std::vector<RandomizerCheck> itemSphere;
std::list<Rando::Entrance*> entranceSphere; std::list<Rando::Entrance*> entranceSphere;
bool calculatingAccessibleChecks = false; bool calculatingAvailableChecks = false;
GetAccessibleLocationsStruct(int _maxGsCount){ GetAccessibleLocationsStruct(int _maxGsCount){
regionPool = {RR_ROOT}; regionPool = {RR_ROOT};
@ -64,7 +64,7 @@ std::vector<RandomizerCheck> GetEmptyLocations(std::vector<RandomizerCheck> allo
void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, RandomizerGet ignore = RG_NONE, void ProcessRegion(Region* region, GetAccessibleLocationsStruct& gals, RandomizerGet ignore = RG_NONE,
bool stopOnBeatable = false, bool addToPlaythrough = false); bool stopOnBeatable = false, bool addToPlaythrough = false);
std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& allowedLocations, RandomizerGet ignore=RG_NONE, bool calculatingAccessibleChecks=false); std::vector<RandomizerCheck> ReachabilitySearch(const std::vector<RandomizerCheck>& allowedLocations, RandomizerGet ignore=RG_NONE, bool calculatingAvailableChecks=false);
void GeneratePlaythrough(); void GeneratePlaythrough();

View file

@ -347,7 +347,7 @@ void RandomizerOnItemReceiveHandler(GetItemEntry receivedItemEntry) {
loc->SetCheckStatus(RCSHOW_COLLECTED); loc->SetCheckStatus(RCSHOW_COLLECTED);
CheckTracker::SpoilAreaFromCheck(randomizerQueuedCheck); CheckTracker::SpoilAreaFromCheck(randomizerQueuedCheck);
CheckTracker::RecalculateAllAreaTotals(); CheckTracker::RecalculateAllAreaTotals();
CheckTracker::RecalculateAccessibleChecks(); CheckTracker::RecalculateAvailableChecks();
SaveManager::Instance->SaveSection(gSaveContext.fileNum, SECTION_ID_TRACKER_DATA, true); SaveManager::Instance->SaveSection(gSaveContext.fileNum, SECTION_ID_TRACKER_DATA, true);
randomizerQueuedCheck = RC_UNKNOWN_CHECK; randomizerQueuedCheck = RC_UNKNOWN_CHECK;
randomizerQueuedItemEntry = GET_ITEM_NONE; randomizerQueuedItemEntry = GET_ITEM_NONE;

View file

@ -228,14 +228,14 @@ void ItemLocation::ResetVariables() {
areas = {}; areas = {};
status = RCSHOW_UNCHECKED; status = RCSHOW_UNCHECKED;
isSkipped = false; isSkipped = false;
isAccessible = false; isAvailable = false;
} }
bool ItemLocation::IsAccessible() const { bool ItemLocation::IsAvailable() const {
return isAccessible; return isAvailable;
} }
void ItemLocation::SetAccessible(bool isAccessible_) { void ItemLocation::SetAvailable(bool isAvailable_) {
isAccessible = isAccessible_; isAvailable = isAvailable_;
} }
} }

View file

@ -56,8 +56,8 @@ class ItemLocation {
bool IsFoolishCandidate() const; bool IsFoolishCandidate() const;
void SetBarrenCandidate(); void SetBarrenCandidate();
void ResetVariables(); void ResetVariables();
bool IsAccessible() const; bool IsAvailable() const;
void SetAccessible(bool isAccessible_); void SetAvailable(bool isAvailable_);
private: private:
RandomizerCheck rc; RandomizerCheck rc;
@ -78,6 +78,6 @@ class ItemLocation {
bool barrenCandidate = false; bool barrenCandidate = false;
RandomizerCheckStatus status = RCSHOW_UNCHECKED; RandomizerCheckStatus status = RCSHOW_UNCHECKED;
bool isSkipped = false; bool isSkipped = false;
bool isAccessible = false; bool isAvailable = false;
}; };
} // namespace Rando } // namespace Rando

View file

@ -32,7 +32,7 @@ bool LocationAccess::CheckConditionAtAgeTime(bool& age, bool& time) const {
return GetConditionsMet(); return GetConditionsMet();
} }
bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAccessibleChecks) 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
@ -47,7 +47,7 @@ bool LocationAccess::ConditionsMet(Region* parentRegion, bool calculatingAccessi
conditionsMet = true; conditionsMet = true;
} }
return conditionsMet && (calculatingAccessibleChecks || CanBuy()); return conditionsMet && (calculatingAvailableChecks || CanBuy());
} }
bool LocationAccess::CanBuy() const { bool LocationAccess::CanBuy() const {

View file

@ -75,7 +75,7 @@ class LocationAccess {
bool CheckConditionAtAgeTime(bool& age, bool& time) const; bool CheckConditionAtAgeTime(bool& age, bool& time) const;
bool ConditionsMet(Region* parentRegion, bool calculatingAccessibleChecks) const; bool ConditionsMet(Region* parentRegion, bool calculatingAvailableChecks) const;
RandomizerCheck GetLocation() const { RandomizerCheck GetLocation() const {
return location; return location;

View file

@ -131,10 +131,10 @@ bool areasFullyChecked[RCAREA_INVALID];
u32 areasSpoiled = 0; u32 areasSpoiled = 0;
bool showVOrMQ; bool showVOrMQ;
s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)" s8 areaChecksGotten[RCAREA_INVALID]; //| "Kokiri Forest (4/9)"
s8 areaChecksAccessible[RCAREA_INVALID]; s8 areaChecksAvailable[RCAREA_INVALID];
s8 areaCheckTotals[RCAREA_INVALID]; s8 areaCheckTotals[RCAREA_INVALID];
uint16_t totalChecks = 0; uint16_t totalChecks = 0;
uint16_t totalChecksAccessible = 0; uint16_t totalChecksAvailable = 0;
uint16_t totalChecksGotten = 0; uint16_t totalChecksGotten = 0;
bool optCollapseAll; // A bool that will collapse all checks once bool optCollapseAll; // A bool that will collapse all checks once
bool optExpandAll; // A bool that will expand all checks once bool optExpandAll; // A bool that will expand all checks once
@ -237,12 +237,12 @@ void TrySetAreas() {
void CalculateTotals() { void CalculateTotals() {
totalChecks = 0; totalChecks = 0;
totalChecksAccessible = 0; totalChecksAvailable = 0;
totalChecksGotten = 0; totalChecksGotten = 0;
for (uint8_t i = 0; i < RCAREA_INVALID; i++) { for (uint8_t i = 0; i < RCAREA_INVALID; i++) {
totalChecks += areaCheckTotals[i]; totalChecks += areaCheckTotals[i];
totalChecksAccessible += areaChecksAccessible[i]; totalChecksAvailable += areaChecksAvailable[i];
totalChecksGotten += areaChecksGotten[i]; totalChecksGotten += areaChecksGotten[i];
} }
} }
@ -257,7 +257,7 @@ uint16_t GetTotalChecksGotten() {
void RecalculateAreaTotals(RandomizerCheckArea rcArea) { void RecalculateAreaTotals(RandomizerCheckArea rcArea) {
areaChecksGotten[rcArea] = 0; areaChecksGotten[rcArea] = 0;
areaChecksAccessible[rcArea] = 0; areaChecksAvailable[rcArea] = 0;
areaCheckTotals[rcArea] = 0; areaCheckTotals[rcArea] = 0;
for (auto rc : checksByArea.at(rcArea)) { for (auto rc : checksByArea.at(rcArea)) {
if (!IsVisibleInCheckTracker(rc)) { if (!IsVisibleInCheckTracker(rc)) {
@ -266,8 +266,8 @@ void RecalculateAreaTotals(RandomizerCheckArea rcArea) {
areaCheckTotals[rcArea]++; areaCheckTotals[rcArea]++;
if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetIsSkipped() || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->HasObtained()) { if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetIsSkipped() || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->HasObtained()) {
areaChecksGotten[rcArea]++; areaChecksGotten[rcArea]++;
} else if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAccessible()) { } else if (OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAvailable()) {
areaChecksAccessible[rcArea]++; areaChecksAvailable[rcArea]++;
} }
} }
CalculateTotals(); CalculateTotals();
@ -315,7 +315,7 @@ void SetCheckCollected(RandomizerCheck rc) {
if (IsVisibleInCheckTracker(rc)) { if (IsVisibleInCheckTracker(rc)) {
if (!OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetIsSkipped()) { if (!OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->GetIsSkipped()) {
areaChecksGotten[loc->GetArea()]++; areaChecksGotten[loc->GetArea()]++;
areaChecksAccessible[loc->GetArea()]--; areaChecksAvailable[loc->GetArea()]--;
} else { } else {
OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(false); OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(false);
} }
@ -432,12 +432,12 @@ void ClearAreaChecksAndTotals() {
for (auto& [rcArea, vec] : checksByArea) { for (auto& [rcArea, vec] : checksByArea) {
vec.clear(); vec.clear();
areaChecksGotten[rcArea] = 0; areaChecksGotten[rcArea] = 0;
areaChecksAccessible[rcArea] = 0; areaChecksAvailable[rcArea] = 0;
areaCheckTotals[rcArea] = 0; areaCheckTotals[rcArea] = 0;
} }
totalChecks = 0; totalChecks = 0;
totalChecksGotten = 0; totalChecksGotten = 0;
totalChecksAccessible = 0; totalChecksAvailable = 0;
} }
void SetShopSeen(uint32_t sceneNum, bool prices) { void SetShopSeen(uint32_t sceneNum, bool prices) {
@ -479,8 +479,8 @@ void CheckTrackerLoadGame(int32_t fileNum) {
if (loc->GetCheckStatus() == RCSHOW_SAVED || loc->GetIsSkipped()) { if (loc->GetCheckStatus() == RCSHOW_SAVED || loc->GetIsSkipped()) {
areaChecksGotten[entry2->GetArea()]++; areaChecksGotten[entry2->GetArea()]++;
} }
if (loc->IsAccessible()) { if (loc->IsAvailable()) {
areaChecksAccessible[entry2->GetArea()]++; areaChecksAvailable[entry2->GetArea()]++;
} }
} }
@ -533,7 +533,7 @@ void CheckTrackerLoadGame(int32_t fileNum) {
UpdateAllOrdering(); UpdateAllOrdering();
UpdateInventoryChecks(); UpdateInventoryChecks();
UpdateFilters(); UpdateFilters();
RecalculateAccessibleChecks(); RecalculateAvailableChecks();
} }
void CheckTrackerShopSlotChange(uint8_t cursorSlot, int16_t basePrice) { void CheckTrackerShopSlotChange(uint8_t cursorSlot, int16_t basePrice) {
@ -549,7 +549,7 @@ void CheckTrackerShopSlotChange(uint8_t cursorSlot, int16_t basePrice) {
if (status == RCSHOW_SEEN) { if (status == RCSHOW_SEEN) {
OTRGlobals::Instance->gRandoContext->GetItemLocation(slot)->SetCheckStatus(RCSHOW_IDENTIFIED); OTRGlobals::Instance->gRandoContext->GetItemLocation(slot)->SetCheckStatus(RCSHOW_IDENTIFIED);
SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true); SaveManager::Instance->SaveSection(gSaveContext.fileNum, sectionId, true);
RecalculateAccessibleChecks(); RecalculateAvailableChecks();
} }
} }
@ -824,7 +824,7 @@ void SaveTrackerData(SaveContext* saveContext, int sectionID, bool fullSave) {
void SaveFile(SaveContext* saveContext, int sectionID, bool fullSave) { void SaveFile(SaveContext* saveContext, int sectionID, bool fullSave) {
SaveTrackerData(saveContext, sectionID, fullSave); SaveTrackerData(saveContext, sectionID, fullSave);
if (fullSave) { if (fullSave) {
RecalculateAccessibleChecks(); RecalculateAvailableChecks();
} }
} }
@ -978,7 +978,7 @@ void CheckTrackerWindow::DrawElement() {
ImGui::Separator(); ImGui::Separator();
ImGui::Text("Total Checks: %d Available / %d Checked / %d Total", totalChecksAccessible, totalChecksGotten, totalChecks); ImGui::Text("Total Checks: %d Available / %d Checked / %d Total", totalChecksAvailable, totalChecksGotten, totalChecks);
UIWidgets::PaddedSeparator(); UIWidgets::PaddedSeparator();
@ -1031,7 +1031,7 @@ void CheckTrackerWindow::DrawElement() {
} }
if ((shouldHideFilteredAreas && filterAreasHidden[rcArea]) || if ((shouldHideFilteredAreas && filterAreasHidden[rcArea]) ||
(!showHidden && ((hideComplete && thisAreaFullyChecked) || (hideIncomplete && !thisAreaFullyChecked))) || (!showHidden && ((hideComplete && thisAreaFullyChecked) || (hideIncomplete && !thisAreaFullyChecked))) ||
(onlyShowAvailable && areaChecksAccessible[rcArea] == 0) (onlyShowAvailable && areaChecksAvailable[rcArea] == 0)
) { ) {
doDraw = false; doDraw = false;
} else { } else {
@ -1072,14 +1072,14 @@ void CheckTrackerWindow::DrawElement() {
if (isThisAreaSpoiled) { if (isThisAreaSpoiled) {
if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) { if (showVOrMQ && RandomizerCheckObjects::AreaIsDungeon(rcArea)) {
if (OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(DungeonSceneLookupByArea(rcArea))->IsMQ()) { if (OTRGlobals::Instance->gRandoContext->GetDungeons()->GetDungeonFromScene(DungeonSceneLookupByArea(rcArea))->IsMQ()) {
ImGui::Text("(%d / %d / %d) - MQ", areaChecksAccessible[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); ImGui::Text("(%d / %d / %d) - MQ", areaChecksAvailable[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]);
UIWidgets::Tooltip("Available / Checked / Total"); UIWidgets::Tooltip("Available / Checked / Total");
} else { } else {
ImGui::Text("(%d / %d / %d) - Vanilla", areaChecksAccessible[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); ImGui::Text("(%d / %d / %d) - Vanilla", areaChecksAvailable[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]);
UIWidgets::Tooltip("Available / Checked / Total"); UIWidgets::Tooltip("Available / Checked / Total");
} }
} else { } else {
ImGui::Text("(%d / %d / %d)", areaChecksAccessible[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]); ImGui::Text("(%d / %d / %d)", areaChecksAvailable[rcArea], areaChecksGotten[rcArea], areaCheckTotals[rcArea]);
UIWidgets::Tooltip("Available / Checked / Total"); UIWidgets::Tooltip("Available / Checked / Total");
} }
} else { } else {
@ -1095,7 +1095,7 @@ void CheckTrackerWindow::DrawElement() {
} }
for (auto rc : checks) { for (auto rc : checks) {
if (doDraw && isThisAreaSpoiled && !filterChecksHidden[rc] && if (doDraw && isThisAreaSpoiled && !filterChecksHidden[rc] &&
(!onlyShowAvailable || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAccessible())) { (!onlyShowAvailable || OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->IsAvailable())) {
DrawLocation(rc); DrawLocation(rc);
} }
} }
@ -1529,7 +1529,7 @@ void DrawLocation(RandomizerCheck rc) {
Rando::ItemLocation* itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); Rando::ItemLocation* itemLoc = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
RandomizerCheckStatus status = itemLoc->GetCheckStatus(); RandomizerCheckStatus status = itemLoc->GetCheckStatus();
bool skipped = itemLoc->GetIsSkipped(); bool skipped = itemLoc->GetIsSkipped();
bool accessible = itemLoc->IsAccessible(); bool available = itemLoc->IsAvailable();
if (status == RCSHOW_COLLECTED) { if (status == RCSHOW_COLLECTED) {
if (!showHidden && hideCollected) { if (!showHidden && hideCollected) {
return; return;
@ -1606,17 +1606,17 @@ void DrawLocation(RandomizerCheck rc) {
OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(false); OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(false);
areaChecksGotten[loc->GetArea()]--; areaChecksGotten[loc->GetArea()]--;
totalChecksGotten--; totalChecksGotten--;
if (accessible) { if (available) {
areaChecksAccessible[loc->GetArea()]++; areaChecksAvailable[loc->GetArea()]++;
totalChecksAccessible++; totalChecksAvailable++;
} }
} else { } else {
OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(true); OTRGlobals::Instance->gRandoContext->GetItemLocation(rc)->SetIsSkipped(true);
areaChecksGotten[loc->GetArea()]++; areaChecksGotten[loc->GetArea()]++;
totalChecksGotten++; totalChecksGotten++;
if (accessible) { if (available) {
areaChecksAccessible[loc->GetArea()]--; areaChecksAvailable[loc->GetArea()]--;
totalChecksAccessible--; totalChecksAvailable--;
} }
} }
UpdateOrdering(loc->GetArea()); UpdateOrdering(loc->GetArea());
@ -1637,7 +1637,7 @@ void DrawLocation(RandomizerCheck rc) {
} else { } else {
ImGui::PushStyleColor(ImGuiCol_Text, styleColor); ImGui::PushStyleColor(ImGuiCol_Text, styleColor);
} }
ImGui::Text("%s", accessible ? ICON_FA_UNLOCK : ICON_FA_LOCK); ImGui::Text("%s", available ? ICON_FA_UNLOCK : ICON_FA_LOCK);
ImGui::PopStyleColor(); ImGui::PopStyleColor();
ImGui::SameLine(); ImGui::SameLine();
@ -1791,47 +1791,47 @@ void ImGuiDrawTwoColorPickerSection(const char* text, const char* cvarMainName,
UIWidgets::PopStyleCombobox(); UIWidgets::PopStyleCombobox();
} }
void RecalculateAccessibleChecks() { void RecalculateAvailableChecks() {
StartPerformanceTimer(PT_RECALCULATE_ACCESSIBLE_CHECKS); StartPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS);
std::vector<RandomizerCheck> targetLocations; std::vector<RandomizerCheck> targetLocations;
targetLocations.reserve(RR_MAX); targetLocations.reserve(RR_MAX);
for (auto& location : Rando::StaticData::GetLocationTable()) { for (auto& location : Rando::StaticData::GetLocationTable()) {
RandomizerCheck rc = location.GetRandomizerCheck(); RandomizerCheck rc = location.GetRandomizerCheck();
Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
itemLocation->SetAccessible(false); itemLocation->SetAvailable(false);
if (!itemLocation->HasObtained()) { if (!itemLocation->HasObtained()) {
targetLocations.emplace_back(rc); targetLocations.emplace_back(rc);
} }
} }
std::vector<RandomizerCheck> accessibleChecks = ReachabilitySearch(targetLocations, RG_NONE, true); std::vector<RandomizerCheck> availableChecks = ReachabilitySearch(targetLocations, RG_NONE, true);
for (auto& rc : accessibleChecks) { for (auto& rc : availableChecks) {
const auto& location = Rando::StaticData::GetLocation(rc); const auto& location = Rando::StaticData::GetLocation(rc);
const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); const auto& itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
if (location->GetRCType() == RCTYPE_SHOP && itemLocation->GetCheckStatus() == RCSHOW_IDENTIFIED) { if (location->GetRCType() == RCTYPE_SHOP && itemLocation->GetCheckStatus() == RCSHOW_IDENTIFIED) {
if (CanBuyAnother(rc)) { if (CanBuyAnother(rc)) {
itemLocation->SetAccessible(true); itemLocation->SetAvailable(true);
} }
} else { } else {
itemLocation->SetAccessible(true); itemLocation->SetAvailable(true);
} }
} }
totalChecksAccessible = 0; totalChecksAvailable = 0;
for (auto& [rcArea, vec] : checksByArea) { for (auto& [rcArea, vec] : checksByArea) {
areaChecksAccessible[rcArea] = 0; areaChecksAvailable[rcArea] = 0;
for (auto& rc : vec) { for (auto& rc : vec) {
Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc); Rando::ItemLocation* itemLocation = OTRGlobals::Instance->gRandoContext->GetItemLocation(rc);
if (itemLocation->IsAccessible() && !itemLocation->GetIsSkipped() && !itemLocation->HasObtained() && IsVisibleInCheckTracker(rc)) { if (itemLocation->IsAvailable() && !itemLocation->GetIsSkipped() && !itemLocation->HasObtained() && IsVisibleInCheckTracker(rc)) {
areaChecksAccessible[rcArea]++; areaChecksAvailable[rcArea]++;
} }
} }
totalChecksAccessible += areaChecksAccessible[rcArea]; totalChecksAvailable += areaChecksAvailable[rcArea];
} }
StopPerformanceTimer(PT_RECALCULATE_ACCESSIBLE_CHECKS); StopPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS);
SPDLOG_INFO("Recalculate Accessible Checks Time: {}ms", GetPerformanceTimer(PT_RECALCULATE_ACCESSIBLE_CHECKS).count()); SPDLOG_INFO("Recalculate Available Checks Time: {}ms", GetPerformanceTimer(PT_RECALCULATE_AVAILABLE_CHECKS).count());
} }

View file

@ -61,5 +61,5 @@ void UpdateAllOrdering();
void UpdateAllAreas(); void UpdateAllAreas();
void RecalculateAllAreaTotals(); void RecalculateAllAreaTotals();
void SpoilAreaFromCheck(RandomizerCheck rc); void SpoilAreaFromCheck(RandomizerCheck rc);
void RecalculateAccessibleChecks(); void RecalculateAvailableChecks();
} // namespace CheckTracker } // namespace CheckTracker