From 7082a4088ba06c825eb45f89888fed2f4577ed10 Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Mon, 20 Jan 2020 11:37:37 -0500 Subject: Store revealed positions on the level itself This was a bit of an oversight initially - we should be storing the positions that the character has seen *on the level*, rather than on the entire game state, for obvious reasons. This introduces a GameLevel record, which has this field, the entities, and also the up staircase position, which we can *also* use to position the character after going down to a level we've already visited. --- src/Xanthous/Game/Lenses.hs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'src/Xanthous/Game/Lenses.hs') diff --git a/src/Xanthous/Game/Lenses.hs b/src/Xanthous/Game/Lenses.hs index 010fcb7022b5..8f6053a5ecc6 100644 --- a/src/Xanthous/Game/Lenses.hs +++ b/src/Xanthous/Game/Lenses.hs @@ -39,14 +39,16 @@ initialStateFromSeed :: Int -> GameState initialStateFromSeed seed = let _randomGen = mkStdGen seed chr = mkCharacter - (_characterEntityID, level) + _upStaircasePosition = Position 0 0 + (_characterEntityID, _levelEntities) = EntityMap.insertAtReturningID - (Position 0 0) + _upStaircasePosition (SomeEntity chr) mempty + _levelRevealedPositions = mempty + level = GameLevel {..} _levels = oneLevel level _messageHistory = mempty - _revealedPositions = mempty _promptState = NoPrompt _activePanel = Nothing _debugState = DebugState -- cgit 1.4.1