about summary refs log tree commit diff
path: root/src/Xanthous/Game/Draw.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xanthous/Game/Draw.hs')
-rw-r--r--src/Xanthous/Game/Draw.hs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/Xanthous/Game/Draw.hs b/src/Xanthous/Game/Draw.hs
index 6527af743953..36abe161198e 100644
--- a/src/Xanthous/Game/Draw.hs
+++ b/src/Xanthous/Game/Draw.hs
@@ -35,16 +35,15 @@ drawMessages (MessageHistory (lastMessage :| _) True) = txt lastMessage
 --   (MessageHistory (lastMessage :| _) True) -> txt lastMessage
 
 drawEntities :: (Draw a, Show a) => EntityMap a -> Widget Name
-drawEntities em@(fromNullable . positions -> Just entityPositions)
+drawEntities em
   = vBox rows
   where
-    maxPosition = maximum entityPositions
-    maxY = maxPosition ^. y
-    maxX = maxPosition ^. x
+    entityPositions = positions em
+    maxY = fromMaybe 0 $ maximumOf (folded . y) entityPositions
+    maxX = fromMaybe 0 $ maximumOf (folded . x) entityPositions
     rows = mkRow <$> [0..maxY]
     mkRow rowY = hBox $ renderEntityAt . flip Position rowY <$> [0..maxX]
     renderEntityAt pos = maybe (str " ") draw $ em ^? atPosition pos . folded
-drawEntities _ = emptyWidget
 
 drawMap :: GameState -> Widget Name
 drawMap game