From 65c580633339f9bd3bd5bd0cb1d9b408869df5e7 Mon Sep 17 00:00:00 2001 From: Christopher Leggett Date: Wed, 24 Apr 2024 17:09:49 -0400 Subject: [PATCH] Better fix for blank hint issue. (#4070) --- soh/soh/Enhancements/randomizer/3drando/hints.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/soh/soh/Enhancements/randomizer/3drando/hints.cpp b/soh/soh/Enhancements/randomizer/3drando/hints.cpp index ba4fce24b..e007c06af 100644 --- a/soh/soh/Enhancements/randomizer/3drando/hints.cpp +++ b/soh/soh/Enhancements/randomizer/3drando/hints.cpp @@ -964,7 +964,12 @@ static void DistributeHints(std::vector& selected, size_t stoneCount, s for (uint8_t distribution = 0; distribution < distTable.size(); distribution++){ currentWeight -= distTable[distribution].weight; if (currentWeight <= 0){ - if (stoneCount >= distTable[distribution].copies || distTable[distribution].copies == 0){ + if (distTable[distribution].copies == 0) { + // This should only happen if we ran out of locations to place hints of a certain distribution earlier. Skip + // to the next distribution. + break; + } + if (stoneCount >= distTable[distribution].copies){ selected[distribution] += 1; stoneCount -= distTable[distribution].copies; break;