mirror of
https://github.com/MarioSpore/Grinch-AP.git
synced 2025-10-21 20:21:32 -06:00
Core: assert that items have a single reference (#1075)
* Core: assert that items have a single reference * Fix duplicate item reference in The Witness * Ori: fix duplicate item references * DKC3: fix duplicate item references * RL: fix duplicate item references * SA2B: fix duplicate item references * SMW: fix duplicate item references Co-authored-by: NewSoupVi <57900059+NewSoupVi@users.noreply.github.com>
This commit is contained in:
@@ -79,8 +79,16 @@ def call_single(world: "MultiWorld", method_name: str, player: int, *args: Any)
|
||||
def call_all(world: "MultiWorld", method_name: str, *args: Any) -> None:
|
||||
world_types: Set[AutoWorldRegister] = set()
|
||||
for player in world.player_ids:
|
||||
prev_item_count = len(world.itempool)
|
||||
world_types.add(world.worlds[player].__class__)
|
||||
call_single(world, method_name, player, *args)
|
||||
if __debug__:
|
||||
new_items = world.itempool[prev_item_count:]
|
||||
for i, item in enumerate(new_items):
|
||||
for other in new_items[i+1:]:
|
||||
assert item is not other, (
|
||||
f"Duplicate item reference of \"{item.name}\" in \"{world.worlds[player].game}\" "
|
||||
f"of player \"{world.player_name[player]}\". Please make a copy instead.")
|
||||
|
||||
for world_type in world_types:
|
||||
stage_callable = getattr(world_type, f"stage_{method_name}", None)
|
||||
|
||||
Reference in New Issue
Block a user