diff --git a/src/Map/Creation.hs b/src/Map/Creation.hs index 949fd97..0f2c60f 100644 --- a/src/Map/Creation.hs +++ b/src/Map/Creation.hs @@ -2,15 +2,22 @@ module Map.Creation where import Map.Types +import Data.Array -- | Generate a new Map of given Type and Size -- -- TODO: -- 1. Should take Size -> Type -> Playmap -- 2. plug together helper-functions for that terraintype -newMap :: Int -> Int -> PlayMap +newMap :: MapType -> (Int, Int) -> PlayMap newMap = undefined +aplByPlace :: (Node -> Node) -> ((Int,Int) -> Bool) -> PlayMap -> PlayMap +aplByPlace f g mp = array (bounds mp) (map (\(ab,c) -> if g ab then (ab, f c) else (ab,c)) (assocs mp)) + +aplByNode :: (Node -> Node) -> (Node -> Bool) -> PlayMap -> PlayMap +aplByNode f g mp = array (bounds mp) (map (\(ab,c) -> (if g c then (ab, f c) else (ab,c))) (assocs mp)) + -- | Basic Terrain-Generator. Will not implement "abnormal" Stuff for given Biome -- (like Deserts on Grass-Islands or Grass on Deserts) diff --git a/src/Map/StaticMaps.hs b/src/Map/StaticMaps.hs index 34c6136..abe047e 100644 --- a/src/Map/StaticMaps.hs +++ b/src/Map/StaticMaps.hs @@ -32,7 +32,6 @@ mnh2D (a,b) (c,d) = abs (a-c) + abs (b-d) mapEmpty :: PlayMap mapEmpty = array ((0,0), (199,199)) [((a,b), (Minimal (a,b))) | a <- [0..199], b <- [0..199]] --- TODO: Stripify mapCenterMountain :: PlayMap mapCenterMountain = array ((0,0),(199,199)) nodes where