Fix: Various Rando generation crashes (#3108)
* fix rando gen crash when not enough remaining items to place * fix rando gen crash due to missing granny shop hint * add error sound if rando gen fails
This commit is contained in:
@@ -548,13 +548,13 @@ static void CalculateWotH() {
|
||||
static void FastFill(std::vector<uint32_t> items, std::vector<uint32_t> locations, bool endOnItemsEmpty = false) {
|
||||
//Loop until locations are empty, or also end if items are empty and the parameters specify to end then
|
||||
while (!locations.empty() && (!endOnItemsEmpty || !items.empty())) {
|
||||
uint32_t loc = RandomElement(locations, true);
|
||||
Location(loc)->SetAsHintable();
|
||||
PlaceItemInLocation(loc, RandomElement(items, true));
|
||||
|
||||
if (items.empty() && !endOnItemsEmpty) {
|
||||
items.push_back(GetJunkItem());
|
||||
}
|
||||
|
||||
uint32_t loc = RandomElement(locations, true);
|
||||
Location(loc)->SetAsHintable();
|
||||
PlaceItemInLocation(loc, RandomElement(items, true));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user