From 4360b5e478f9a87c8fd7f85e18a857b22066e697 Mon Sep 17 00:00:00 2001 From: Marsh Macy Date: Wed, 29 Nov 2023 14:15:33 -0800 Subject: [PATCH] set dungeon start location fix --- osrlib/osrlib/dungeon.py | 6 ++--- osrlib/poetry.lock | 35 +++++++++++++++--------------- osrlib/pyproject.toml | 2 +- tests/poetry.lock | 9 ++++---- tests/test_integration_saveload.py | 1 + 5 files changed, 27 insertions(+), 26 deletions(-) diff --git a/osrlib/osrlib/dungeon.py b/osrlib/osrlib/dungeon.py index e95a878..0c135e1 100644 --- a/osrlib/osrlib/dungeon.py +++ b/osrlib/osrlib/dungeon.py @@ -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: diff --git a/osrlib/poetry.lock b/osrlib/poetry.lock index 7f52bd0..baf69e1 100644 --- a/osrlib/poetry.lock +++ b/osrlib/poetry.lock @@ -380,19 +380,19 @@ trio = ["trio (>=0.22.0,<0.23.0)"] [[package]] name = "httpx" -version = "0.25.1" +version = "0.25.2" description = "The next generation HTTP client." optional = false python-versions = ">=3.8" files = [ - {file = "httpx-0.25.1-py3-none-any.whl", hash = "sha256:fec7d6cc5c27c578a391f7e87b9aa7d3d8fbcd034f6399f9f79b45bcc12a866a"}, - {file = "httpx-0.25.1.tar.gz", hash = "sha256:ffd96d5cf901e63863d9f1b4b6807861dbea4d301613415d9e6e57ead15fc5d0"}, + {file = "httpx-0.25.2-py3-none-any.whl", hash = "sha256:a05d3d052d9b2dfce0e3896636467f8a5342fb2b902c819428e1ac65413ca118"}, + {file = "httpx-0.25.2.tar.gz", hash = "sha256:8b8fcaa0c8ea7b05edd69a094e63a2094c4efcb48129fb757361bc423c0ad9e8"}, ] [package.dependencies] anyio = "*" certifi = "*" -httpcore = "*" +httpcore = "==1.*" idna = "*" sniffio = "*" @@ -404,13 +404,13 @@ socks = ["socksio (==1.*)"] [[package]] name = "idna" -version = "3.4" +version = "3.6" description = "Internationalized Domain Names in Applications (IDNA)" optional = false python-versions = ">=3.5" files = [ - {file = "idna-3.4-py3-none-any.whl", hash = "sha256:90b77e79eaa3eba6de819a0c442c0b4ceefc341a7a2ab77d7562bf49f425c5c2"}, - {file = "idna-3.4.tar.gz", hash = "sha256:814f528e8dead7d329833b91c5faa87d60bf71824cd12a7530b5526063d02cb4"}, + {file = "idna-3.6-py3-none-any.whl", hash = "sha256:c05567e9c24a6b9faaa835c4821bad0590fbb9d5779e7caa6e1cc4978e7eb24f"}, + {file = "idna-3.6.tar.gz", hash = "sha256:9ecdbbd083b06798ae1e86adcbfe8ab1479cf864e4ee30fe4e46a003d12491ca"}, ] [[package]] @@ -579,13 +579,13 @@ min-versions = ["babel (==2.9.0)", "click (==7.0)", "colorama (==0.4)", "ghp-imp [[package]] name = "mkdocs-material" -version = "9.4.11" +version = "9.4.14" description = "Documentation that simply works" optional = false python-versions = ">=3.8" files = [ - {file = "mkdocs_material-9.4.11-py3-none-any.whl", hash = "sha256:794b81d74df4fd7dee952dd4502f7b6a7913a1fc56021e5f36f8e96eb20ffb25"}, - {file = "mkdocs_material-9.4.11.tar.gz", hash = "sha256:82c2bdbdc8445854f400d12831a8b0f7602efaaead7b264ac3c45aa3aa240755"}, + {file = "mkdocs_material-9.4.14-py3-none-any.whl", hash = "sha256:dbc78a4fea97b74319a6aa9a2f0be575a6028be6958f813ba367188f7b8428f6"}, + {file = "mkdocs_material-9.4.14.tar.gz", hash = "sha256:a511d3ff48fa8718b033e7e37d17abd9cc1de0fdf0244a625ca2ae2387e2416d"}, ] [package.dependencies] @@ -630,13 +630,13 @@ files = [ [[package]] name = "openai" -version = "1.3.5" +version = "1.3.6" description = "The official Python library for the openai API" optional = false python-versions = ">=3.7.1" files = [ - {file = "openai-1.3.5-py3-none-any.whl", hash = "sha256:9437458978fb502e61336c3082e02b09c49feebe0e8516a2b8fb4563e6e4af4e"}, - {file = "openai-1.3.5.tar.gz", hash = "sha256:163e7ece4af76e961f58b75ea20a42b0d0c2a240c2f81b41a3d1c5962463cdf8"}, + {file = "openai-1.3.6-py3-none-any.whl", hash = "sha256:a88063de50706e7a25d9d3dcc0aa4b7e1f59ad40a3b8901af28fec097abeb230"}, + {file = "openai-1.3.6.tar.gz", hash = "sha256:5f1f00658474668d8ecb7e87ceed101632c66e1e57d29aa9e0b1cb21f65a72be"}, ] [package.dependencies] @@ -644,6 +644,7 @@ anyio = ">=3.5.0,<4" distro = ">=1.7.0,<2" httpx = ">=0.23.0,<1" pydantic = ">=1.9.0,<3" +sniffio = "*" tqdm = ">4" typing-extensions = ">=4.5,<5" @@ -904,17 +905,17 @@ windows-terminal = ["colorama (>=0.4.6)"] [[package]] name = "pymdown-extensions" -version = "10.4" +version = "10.5" description = "Extension pack for Python Markdown." optional = false python-versions = ">=3.8" files = [ - {file = "pymdown_extensions-10.4-py3-none-any.whl", hash = "sha256:cfc28d6a09d19448bcbf8eee3ce098c7d17ff99f7bd3069db4819af181212037"}, - {file = "pymdown_extensions-10.4.tar.gz", hash = "sha256:bc46f11749ecd4d6b71cf62396104b4a200bad3498cb0f5dad1b8502fe461a35"}, + {file = "pymdown_extensions-10.5-py3-none-any.whl", hash = "sha256:1f0ca8bb5beff091315f793ee17683bc1390731f6ac4c5eb01e27464b80fe879"}, + {file = "pymdown_extensions-10.5.tar.gz", hash = "sha256:1b60f1e462adbec5a1ed79dac91f666c9c0d241fa294de1989f29d20096cfd0b"}, ] [package.dependencies] -markdown = ">=3.2" +markdown = ">=3.5" pyyaml = "*" [package.extras] diff --git a/osrlib/pyproject.toml b/osrlib/pyproject.toml index 285863b..1faaf47 100644 --- a/osrlib/pyproject.toml +++ b/osrlib/pyproject.toml @@ -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 "] license = "MIT" diff --git a/tests/poetry.lock b/tests/poetry.lock index 9abe675..e76ffdc 100644 --- a/tests/poetry.lock +++ b/tests/poetry.lock @@ -144,13 +144,13 @@ files = [ [[package]] name = "openai" -version = "1.3.5" +version = "1.3.6" description = "The official Python library for the openai API" optional = false python-versions = ">=3.7.1" files = [ - {file = "openai-1.3.5-py3-none-any.whl", hash = "sha256:9437458978fb502e61336c3082e02b09c49feebe0e8516a2b8fb4563e6e4af4e"}, - {file = "openai-1.3.5.tar.gz", hash = "sha256:163e7ece4af76e961f58b75ea20a42b0d0c2a240c2f81b41a3d1c5962463cdf8"}, + {file = "openai-1.3.6-py3-none-any.whl", hash = "sha256:a88063de50706e7a25d9d3dcc0aa4b7e1f59ad40a3b8901af28fec097abeb230"}, + {file = "openai-1.3.6.tar.gz", hash = "sha256:5f1f00658474668d8ecb7e87ceed101632c66e1e57d29aa9e0b1cb21f65a72be"}, ] [package.dependencies] @@ -158,6 +158,7 @@ anyio = ">=3.5.0,<4" distro = ">=1.7.0,<2" httpx = ">=0.23.0,<1" pydantic = ">=1.9.0,<3" +sniffio = "*" tqdm = ">4" typing-extensions = ">=4.5,<5" @@ -166,7 +167,7 @@ datalib = ["numpy (>=1)", "pandas (>=1.2.3)", "pandas-stubs (>=1.1.0.11)"] [[package]] name = "osrlib" -version = "0.1.35" +version = "0.1.44" description = "Turn-based dungeon-crawler game engine for OSR-style RPGs." optional = false python-versions = "^3.11" diff --git a/tests/test_integration_saveload.py b/tests/test_integration_saveload.py index ae46c4b..cc5a7ba 100644 --- a/tests/test_integration_saveload.py +++ b/tests/test_integration_saveload.py @@ -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]