mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 12:11:33 -06:00
OoT: Fix remove not invalidating cached reachability (#5222)
Collecting an item into a CollectionState without sweeping, finding all reachable locations, removing that item from the state, and then finding all reachable locations again could result in more locations being reachable than before the item was initially collected into the CollectionState. This issue was present because OoT was not invalidating its reachable region caches for the different ages when items were removed from the CollectionState. To fix the issue, this PR has updated `OOTWorld.remove()` to invalid its caches, like how `CollectionState.remove()` invalidates the core Archipelago caches.
This commit is contained in:
@@ -1324,10 +1324,20 @@ class OOTWorld(World):
|
||||
state.prog_items[self.player][alt_item_name] -= count
|
||||
if state.prog_items[self.player][alt_item_name] < 1:
|
||||
del (state.prog_items[self.player][alt_item_name])
|
||||
# invalidate caches, nothing can be trusted anymore now
|
||||
state.child_reachable_regions[self.player] = set()
|
||||
state.child_blocked_connections[self.player] = set()
|
||||
state.adult_reachable_regions[self.player] = set()
|
||||
state.adult_blocked_connections[self.player] = set()
|
||||
state._oot_stale[self.player] = True
|
||||
return True
|
||||
changed = super().remove(state, item)
|
||||
if changed:
|
||||
# invalidate caches, nothing can be trusted anymore now
|
||||
state.child_reachable_regions[self.player] = set()
|
||||
state.child_blocked_connections[self.player] = set()
|
||||
state.adult_reachable_regions[self.player] = set()
|
||||
state.adult_blocked_connections[self.player] = set()
|
||||
state._oot_stale[self.player] = True
|
||||
return changed
|
||||
|
||||
|
Reference in New Issue
Block a user