mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-19 04:50:05 -07:00
CheckBeatable: move clearing ctx->playthroughBeatable into function (#5408)
This commit is contained in:
parent
1a322c3eb5
commit
626511ffb1
1 changed files with 4 additions and 6 deletions
|
@ -327,13 +327,12 @@ bool IsBeatableWithout(RandomizerCheck excludedCheck, bool replaceItem,
|
||||||
auto ctx = Rando::Context::GetInstance();
|
auto ctx = Rando::Context::GetInstance();
|
||||||
RandomizerGet copy = ctx->GetItemLocation(excludedCheck)->GetPlacedRandomizerGet(); // Copy out item
|
RandomizerGet copy = ctx->GetItemLocation(excludedCheck)->GetPlacedRandomizerGet(); // Copy out item
|
||||||
ctx->GetItemLocation(excludedCheck)->SetPlacedItem(RG_NONE); // Write in empty item
|
ctx->GetItemLocation(excludedCheck)->SetPlacedItem(RG_NONE); // Write in empty item
|
||||||
ctx->playthroughBeatable = false;
|
|
||||||
logic->Reset();
|
logic->Reset();
|
||||||
CheckBeatable(ignore);
|
bool result = CheckBeatable(ignore);
|
||||||
if (replaceItem) {
|
if (replaceItem) {
|
||||||
ctx->GetItemLocation(excludedCheck)->SetPlacedItem(copy); // Immediately put item back
|
ctx->GetItemLocation(excludedCheck)->SetPlacedItem(copy); // Immediately put item back
|
||||||
}
|
}
|
||||||
return ctx->playthroughBeatable;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset non-Logic-class logic, and optionally apply the initial inventory
|
// Reset non-Logic-class logic, and optionally apply the initial inventory
|
||||||
|
@ -581,6 +580,7 @@ void GeneratePlaythrough() {
|
||||||
// return if the seed is currently beatable or not
|
// return if the seed is currently beatable or not
|
||||||
bool CheckBeatable(RandomizerGet ignore /* = RG_NONE*/) {
|
bool CheckBeatable(RandomizerGet ignore /* = RG_NONE*/) {
|
||||||
auto ctx = Rando::Context::GetInstance();
|
auto ctx = Rando::Context::GetInstance();
|
||||||
|
ctx->playthroughBeatable = false;
|
||||||
GetAccessibleLocationsStruct gals(0);
|
GetAccessibleLocationsStruct gals(0);
|
||||||
ResetLogic(ctx, gals, true);
|
ResetLogic(ctx, gals, true);
|
||||||
do {
|
do {
|
||||||
|
@ -929,10 +929,8 @@ static void AssumedFill(const std::vector<RandomizerGet>& items, const std::vect
|
||||||
// If ALR is off, then we check beatability after placing the item.
|
// If ALR is off, then we check beatability after placing the item.
|
||||||
// If the game is beatable, then we can stop placing items with logic.
|
// If the game is beatable, then we can stop placing items with logic.
|
||||||
if (!ctx->GetOption(RSK_ALL_LOCATIONS_REACHABLE)) {
|
if (!ctx->GetOption(RSK_ALL_LOCATIONS_REACHABLE)) {
|
||||||
ctx->playthroughBeatable = false;
|
|
||||||
logic->Reset();
|
logic->Reset();
|
||||||
CheckBeatable();
|
if (CheckBeatable()) {
|
||||||
if (ctx->playthroughBeatable) {
|
|
||||||
SPDLOG_DEBUG("Game beatable, now placing items randomly. " + std::to_string(itemsToPlace.size()) +
|
SPDLOG_DEBUG("Game beatable, now placing items randomly. " + std::to_string(itemsToPlace.size()) +
|
||||||
" major items remaining.\n\n");
|
" major items remaining.\n\n");
|
||||||
FastFill(itemsToPlace, GetEmptyLocations(allowedLocations), true);
|
FastFill(itemsToPlace, GetEmptyLocations(allowedLocations), true);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue