Skip to content

Commit 39a6cf5

Browse files
authored
Merge pull request #51 from ManualForArchipelago/client-improvements
avoid doing string comparisons when removing location buttons
2 parents eaeef91 + 5bd3d42 commit 39a6cf5

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/ManualClient.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,8 @@ async def connection_closed(self):
9898
def suggested_game(self) -> str:
9999
if self.game:
100100
return self.game
101-
return Utils.persistent_load().get("client", {}).get("last_manual_game", "Manual_{\"game\" from game.json}_{\"creator\" from game.json}")
101+
from .Game import game_name # This will at least give us the name of a manual they've installed
102+
return Utils.persistent_load().get("client", {}).get("last_manual_game", game_name)
102103

103104
def get_location_by_name(self, name) -> dict[str, Any]:
104105
location = self.location_table.get(name)
@@ -205,6 +206,7 @@ class LocationsLayoutScrollable(ScrollView):
205206

206207
class TreeViewButton(Button, TreeViewNode):
207208
victory: bool = False
209+
id: int = None
208210

209211
class TreeViewScrollView(ScrollView, TreeViewNode):
210212
pass
@@ -423,6 +425,7 @@ def build_tracker_and_locations_table(self):
423425
for location_id in self.listed_locations[location_category]:
424426
location_button = TreeViewButton(text=self.ctx.location_names[location_id], size_hint=(None, None), height=30, width=400)
425427
location_button.bind(on_press=lambda *args, loc_id=location_id: self.location_button_callback(loc_id, *args))
428+
location_button.id = location_id
426429
category_layout.add_widget(location_button)
427430

428431
# if this is the category that Victory is in, display the Victory button
@@ -563,9 +566,7 @@ def update_tracker_and_locations_table(self, update_highlights=False):
563566
reachable_count += 1
564567
continue
565568

566-
location = self.ctx.get_location_by_name(location_button.text)
567-
568-
if ("victory" not in location or not location["victory"]) and location["id"] not in self.ctx.missing_locations:
569+
if location_button.id and location_button.id not in self.ctx.missing_locations:
569570
import logging
570571

571572
logging.info("location button being removed: " + location_button.text)

src/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ def __init__(self, display_name: str, script_name: Optional[str] = None, func: O
409409
self.version = version
410410

411411
def add_client_to_launcher() -> None:
412-
version = 2024_04_23 # YYYYMMDD
412+
version = 2024_05_05 # YYYYMMDD
413413
found = False
414414
for c in components:
415415
if c.display_name == "Manual Client":

0 commit comments

Comments
 (0)