From 49d7ff22aae922ef081bac1aa2a4b47b2b079166 Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Mon, 15 Apr 2024 12:56:19 -0400 Subject: Backwards compatibility for games genned before panels mode options changes --- Archipelago/client.gd | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'Archipelago') diff --git a/Archipelago/client.gd b/Archipelago/client.gd index cafe2f9..63c82f4 100644 --- a/Archipelago/client.gd +++ b/Archipelago/client.gd @@ -128,6 +128,7 @@ var _item_name_to_id = {} # LINGO only var _location_name_to_id = {} # LINGO only var _remote_version = {"major": 0, "minor": 0, "build": 0} +var _gen_version = {"major": 0, "minor": 0, "build": 0} # TODO: caching per MW/slot, reset between connections var _authenticated = false @@ -265,6 +266,7 @@ func _on_data(): if cmd == "RoomInfo": _seed = message["seed_name"] _remote_version = message["version"] + _gen_version = message["generator_version"] var needed_games = [] for game in message["datapackage_checksums"].keys(): @@ -313,8 +315,13 @@ func _on_data(): if _slot_data.has("shuffle_colors"): _color_shuffle = _slot_data["shuffle_colors"] if _slot_data.has("shuffle_doors"): - _door_shuffle = (_slot_data["shuffle_doors"] == 2) - _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) + # TODO: This assumes that panels mode will be releaed in 0.4.6, which is untrue. + if wasGeneratedBeforeVersion({"major": 0, "minor": 4, "build": 6}): + _door_shuffle = (_slot_data["shuffle_doors"] > 0) + _panel_door_shuffle = false + else: + _door_shuffle = (_slot_data["shuffle_doors"] == 2) + _panel_door_shuffle = (_slot_data["shuffle_doors"] == 1) if _slot_data.has("shuffle_paintings"): _painting_shuffle = _slot_data["shuffle_paintings"] if _slot_data.has("shuffle_panels"): @@ -831,3 +838,17 @@ func colorForItemType(flags): return "#d63a22" else: # filler return "#14de9e" + + +func compareVersion(lhs, rhs): + if lhs["major"] == rhs["major"]: + if lhs["minor"] == rhs["minor"]: + return lhs["build"] < rhs["build"] + else: + return lhs["minor"] < rhs["minor"] + else: + return lhs["major"] < rhs["major"] + + +func wasGeneratedBeforeVersion(rhs): + return compareVersion(_gen_version, rhs) -- cgit 1.4.1