From 1d2f7efe4639152a82cbe67d84927b31bdb0b640 Mon Sep 17 00:00:00 2001 From: Fabian Dill Date: Fri, 22 Jan 2021 07:51:09 +0100 Subject: [PATCH] sort shops explicitly --- Rom.py | 3 ++- Shops.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Rom.py b/Rom.py index 7d035f8c..1d2c57c6 100644 --- a/Rom.py +++ b/Rom.py @@ -1551,7 +1551,8 @@ def patch_race_rom(rom, world, player): def write_custom_shops(rom, world, player): - shops = [shop for shop in world.shops if shop.custom and shop.region.player == player] + shops = sorted([shop for shop in world.shops if shop.custom and shop.region.player == player], + key=lambda shop: shop.region.name) shop_data = bytearray() items_data = bytearray() diff --git a/Shops.py b/Shops.py index 33cb080f..ad65ada6 100644 --- a/Shops.py +++ b/Shops.py @@ -288,7 +288,7 @@ total_dynamic_shop_slots = sum(3 for shopname, data in shop_table.items() if not SHOP_ID_START = 0x400000 shop_table_by_location_id = {cnt: s for cnt, s in enumerate( - (f"{name} Slot {num}" for num in range(1, 4) for name in shop_table), start=SHOP_ID_START)} + (f"{name} Slot {num}" for name in sorted(shop_table) for num in range(1, 4)), start=SHOP_ID_START)} shop_table_by_location_id[(SHOP_ID_START + total_shop_slots)] = "Old Man Sword Cave" shop_table_by_location_id[(SHOP_ID_START + total_shop_slots + 1)] = "Take-Any #1" shop_table_by_location_id[(SHOP_ID_START + total_shop_slots + 2)] = "Take-Any #2"