From 106b8369bf416eb8c633d1926607a50d8154ff6a Mon Sep 17 00:00:00 2001 From: codemann8 Date: Thu, 31 Mar 2022 08:58:52 -0500 Subject: [PATCH] Exit with error when infinite loop detected in flute shuffle --- OverworldShuffle.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/OverworldShuffle.py b/OverworldShuffle.py index b2dded81..a3c588f4 100644 --- a/OverworldShuffle.py +++ b/OverworldShuffle.py @@ -405,9 +405,13 @@ def link_overworld(world, player): random.shuffle(sector[1]) f = 0 + t = 0 while len(new_spots) < target_spots: if f >= len(sector[1]): f = 0 + t += 1 + if t > 5: + raise GenerationException('Infinite loop detected in flute shuffle') if sector[1][f] not in new_spots: addSpot(flute_regions[sector[1][f]]) f += 1