Added apply-by functions
This commit is contained in:
parent
313992efaf
commit
fa9bda5e7a
@ -2,15 +2,22 @@ module Map.Creation
|
|||||||
where
|
where
|
||||||
|
|
||||||
import Map.Types
|
import Map.Types
|
||||||
|
import Data.Array
|
||||||
|
|
||||||
-- | Generate a new Map of given Type and Size
|
-- | Generate a new Map of given Type and Size
|
||||||
--
|
--
|
||||||
-- TODO:
|
-- TODO:
|
||||||
-- 1. Should take Size -> Type -> Playmap
|
-- 1. Should take Size -> Type -> Playmap
|
||||||
-- 2. plug together helper-functions for that terraintype
|
-- 2. plug together helper-functions for that terraintype
|
||||||
newMap :: Int -> Int -> PlayMap
|
newMap :: MapType -> (Int, Int) -> PlayMap
|
||||||
newMap = undefined
|
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
|
-- | Basic Terrain-Generator. Will not implement "abnormal" Stuff for given Biome
|
||||||
-- (like Deserts on Grass-Islands or Grass on Deserts)
|
-- (like Deserts on Grass-Islands or Grass on Deserts)
|
||||||
|
@ -32,7 +32,6 @@ mnh2D (a,b) (c,d) = abs (a-c) + abs (b-d)
|
|||||||
mapEmpty :: PlayMap
|
mapEmpty :: PlayMap
|
||||||
mapEmpty = array ((0,0), (199,199)) [((a,b), (Minimal (a,b))) | a <- [0..199], b <- [0..199]]
|
mapEmpty = array ((0,0), (199,199)) [((a,b), (Minimal (a,b))) | a <- [0..199], b <- [0..199]]
|
||||||
|
|
||||||
-- TODO: Stripify
|
|
||||||
mapCenterMountain :: PlayMap
|
mapCenterMountain :: PlayMap
|
||||||
mapCenterMountain = array ((0,0),(199,199)) nodes
|
mapCenterMountain = array ((0,0),(199,199)) nodes
|
||||||
where
|
where
|
||||||
|
Loading…
x
Reference in New Issue
Block a user