From 95ea0541e621130e4cc5cd7814840b5ec04cca3a Mon Sep 17 00:00:00 2001 From: black-sliver <59490463+black-sliver@users.noreply.github.com> Date: Mon, 31 Oct 2022 20:29:22 +0100 Subject: [PATCH] Core: improve fulfills_accessibility performance --- BaseClasses.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/BaseClasses.py b/BaseClasses.py index 8d641b0b..210c88c4 100644 --- a/BaseClasses.py +++ b/BaseClasses.py @@ -577,10 +577,9 @@ class MultiWorld(): while locations: sphere: List[Location] = [] - for location in locations: - if location.can_reach(state): - assert location not in sphere - sphere.append(location) + for n in range(len(locations) - 1, -1, -1): + if locations[n].can_reach(state): + sphere.append(locations.pop(n)) if not sphere: # ran out of places and did not finish yet, quit @@ -589,7 +588,6 @@ class MultiWorld(): return False for location in sphere: - locations.remove(location) if location.item: state.collect(location.item, True, location)