Speed hacks

- reduce the regions being checked every iteration when updating
- only sweep for crystal access when new locations are found, and when starting a new sphere
This commit is contained in:
compiling
2020-01-23 20:08:37 +11:00
parent b5ea688847
commit 33b849a176

View File

@@ -418,9 +418,8 @@ class CollectionState(object):
new_regions = True
reachable_regions_count = len(rrp)
while new_regions:
region_queue = deque([region for region in player_regions if region not in rrp])
while len(region_queue) > 0:
candidate = region_queue.popleft()
player_regions = [region for region in player_regions if region not in rrp]
for candidate in player_regions:
if candidate.can_reach_private(self):
rrp.add(candidate)
if candidate.type == RegionType.Dungeon:
@@ -778,7 +777,6 @@ class CollectionState(object):
if changed:
if not event:
self.sweep_for_events()
self.sweep_for_crystal_access()
def remove(self, item):
if item.advancement: