Skip to content

Commit

Permalink
set dungeon start location fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mmacy committed Nov 29, 2023
1 parent 0b332c3 commit 4360b5e
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 26 deletions.
6 changes: 2 additions & 4 deletions osrlib/osrlib/dungeon.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,10 +250,8 @@ def __init__(
self.description = description
self.locations = locations
self.start_location_id = start_location_id
if start_location_id is not None:
self.set_start_location(start_location_id) # Also sets self.current_location
else:
self.set_start_location(self.locations[0].id) if len(self.locations) > 0 else None
self.current_location = None
self.set_start_location(start_location_id) # Also sets self.current_location
self.id = id

def set_start_location(self, location_id: int) -> Location:
Expand Down
35 changes: 18 additions & 17 deletions osrlib/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion osrlib/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "osrlib"
version = "0.1.43"
version = "0.1.44"
description = "Turn-based dungeon-crawler game engine for OSR-style RPGs."
authors = ["Marsh Macy <[email protected]>"]
license = "MIT"
Expand Down
9 changes: 5 additions & 4 deletions tests/poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tests/test_integration_saveload.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,7 @@ def test_location_save_load(db):
def test_dungeon_save_load(db):
location = Location(1, 10, 10, [Exit(Direction.NORTH, 2)])
dungeon = Dungeon("TestDungeon", "An example dungeon.", [location])
dungeon.set_start_location(1)
data = dungeon.to_dict()
db.insert(data)
loaded_data = db.all()[0]
Expand Down

0 comments on commit 4360b5e

Please sign in to comment.