From 5694dd4dff20d5aa9da90344ebe2e4e49a38bed4 Mon Sep 17 00:00:00 2001 From: Yohann D'ANELLO Date: Sun, 10 Jan 2021 19:52:28 +0100 Subject: [PATCH] Update the player inventory when opening the menu/loading the game, fixes #72 --- squirrelbattle/display/menudisplay.py | 1 + squirrelbattle/game.py | 1 + 2 files changed, 2 insertions(+) diff --git a/squirrelbattle/display/menudisplay.py b/squirrelbattle/display/menudisplay.py index 54acaed..ccc3561 100644 --- a/squirrelbattle/display/menudisplay.py +++ b/squirrelbattle/display/menudisplay.py @@ -162,6 +162,7 @@ class PlayerInventoryDisplay(MenuDisplay): def update(self, game: Game) -> None: self.player = game.player self.update_menu(game.inventory_menu) + game.inventory_menu.update_player(self.player) self.store_mode = game.state == GameMode.STORE self.chest_mode = game.state == GameMode.CHEST self.selected = game.state == GameMode.INVENTORY \ diff --git a/squirrelbattle/game.py b/squirrelbattle/game.py index 83da5f3..9cfa721 100644 --- a/squirrelbattle/game.py +++ b/squirrelbattle/game.py @@ -435,6 +435,7 @@ class Game: return self.player = players[0] + self.inventory_menu.update_player(self.player) self.map.compute_visibility(self.player.y, self.player.x, self.player.vision) self.display_actions(DisplayActions.UPDATE)