From 959c55c5cac07c4f77c9f908d1011055dc92384d Mon Sep 17 00:00:00 2001 From: Salzkorn Date: Wed, 27 Nov 2024 14:47:14 +0100 Subject: [PATCH] Fix certain layouts leaking empty slots into next data --- worlds/sc2/mission_order/structs.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/worlds/sc2/mission_order/structs.py b/worlds/sc2/mission_order/structs.py index 324cde6b2263..202f780cacd7 100644 --- a/worlds/sc2/mission_order/structs.py +++ b/worlds/sc2/mission_order/structs.py @@ -217,8 +217,7 @@ def fill_depths(self) -> None: # Check for accessible missions cur_missions: Set[SC2MOGenMission] = { mission for mission in next_missions - if not mission.option_empty - and mission.is_unlocked(beaten_missions) + if mission.is_unlocked(beaten_missions) } if len(cur_missions) == 0: raise Exception(f"Mission order ran out of accessible missions during iteration {iterations}") @@ -231,9 +230,7 @@ def fill_depths(self) -> None: # If the beaten missions at depth X unlock a mission, said mission can be beaten at depth X+1 mission.min_depth = mission.entry_rule.get_depth(beaten_missions) + 1 new_next = [ - next_mission for next_mission in mission.next - if not next_mission.option_empty - and not ( + next_mission for next_mission in mission.next if not ( next_mission in cur_missions or next_mission in beaten_missions or next_mission in new_beaten_missions @@ -710,23 +707,15 @@ def __init__(self, world: World, parent: ReferenceType[SC2MOGenCampaign], name: mission.next = [self.missions[idx] for idx in mission.option_next] # Set up missions' prev data - seen_missions: Set[SC2MOGenMission] = set() - cur_missions: List[SC2MOGenMission] = [mission for mission in self.entrances] - while len(cur_missions) > 0: - mission = cur_missions.pop() - seen_missions.add(mission) + for mission in self.missions: for next_mission in mission.next: next_mission.prev.append(mission) - if next_mission not in seen_missions and \ - next_mission not in cur_missions: - cur_missions.append(next_mission) # Remove empty missions from access data for mission in self.missions: if mission.option_empty: for next_mission in mission.next: - if mission in next_mission.prev: - next_mission.prev.remove(mission) + next_mission.prev.remove(mission) mission.next.clear() for prev_mission in mission.prev: prev_mission.next.remove(mission)