From cb5f5ff553e7fb8f17c3df05b704bf796a970cc8 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Tue, 2 Apr 2013 02:04:37 -0400 Subject: Fixed bug where Fallen.Map.legalMoves would allow moving off the edge of the map --- Fallen/Map.hs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Fallen/Map.hs b/Fallen/Map.hs index a33b696..6e15aed 100644 --- a/Fallen/Map.hs +++ b/Fallen/Map.hs @@ -46,7 +46,7 @@ module Fallen.Map -- legalMoves :: Map -> Point -> [Tile] -> [Direction] legalMoves m p ts = map fst $ filter legal $ map tileDir directions where tileDir d = (d, getTileAtPos m $ stepInDirection p d) - legal (_,t) = t `elem` ts + legal (d,t) = (t `elem` ts) && (inBounds m $ stepInDirection p d) -- fillMapRect :: Int -> Int -> Int -> Int -> Tile -> Map -> Map fillMapRect x y w h t (Map d xs bg) = if bg == t -- cgit 1.4.1