Core: Improved GER's caching of visited nodes during initialization (#5366)
* Moved the visited update * Renamed visited to seen
This commit is contained in:
@@ -74,13 +74,12 @@ class EntranceLookup:
|
|||||||
if entrance in self._expands_graph_cache:
|
if entrance in self._expands_graph_cache:
|
||||||
return self._expands_graph_cache[entrance]
|
return self._expands_graph_cache[entrance]
|
||||||
|
|
||||||
visited = set()
|
seen = {entrance.connected_region}
|
||||||
q: deque[Region] = deque()
|
q: deque[Region] = deque()
|
||||||
q.append(entrance.connected_region)
|
q.append(entrance.connected_region)
|
||||||
|
|
||||||
while q:
|
while q:
|
||||||
region = q.popleft()
|
region = q.popleft()
|
||||||
visited.add(region)
|
|
||||||
|
|
||||||
# check if the region itself is progression
|
# check if the region itself is progression
|
||||||
if region in region.multiworld.indirect_connections:
|
if region in region.multiworld.indirect_connections:
|
||||||
@@ -103,7 +102,8 @@ class EntranceLookup:
|
|||||||
and exit_ in self._usable_exits):
|
and exit_ in self._usable_exits):
|
||||||
self._expands_graph_cache[entrance] = True
|
self._expands_graph_cache[entrance] = True
|
||||||
return True
|
return True
|
||||||
elif exit_.connected_region and exit_.connected_region not in visited:
|
elif exit_.connected_region and exit_.connected_region not in seen:
|
||||||
|
seen.add(exit_.connected_region)
|
||||||
q.append(exit_.connected_region)
|
q.append(exit_.connected_region)
|
||||||
|
|
||||||
self._expands_graph_cache[entrance] = False
|
self._expands_graph_cache[entrance] = False
|
||||||
|
|||||||
Reference in New Issue
Block a user