pioneers/src/Map/Creation.hs

42 lines
1.3 KiB
Haskell
Raw Normal View History

2014-02-09 20:18:03 +01:00
module Map.Creation
where
import Map.Types
2014-04-23 13:52:43 +02:00
import Data.Array
2014-02-09 20:18:03 +01:00
2014-04-22 11:27:07 +02:00
-- | Generate a new Map of given Type and Size
--
-- TODO:
-- 1. Should take Size -> Type -> Playmap
-- 2. plug together helper-functions for that terraintype
2014-04-23 13:52:43 +02:00
newMap :: MapType -> (Int, Int) -> PlayMap
2014-02-09 20:18:03 +01:00
newMap = undefined
2014-04-22 11:27:07 +02:00
2014-04-23 13:52:43 +02:00
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))
2014-04-22 11:27:07 +02:00
-- | Basic Terrain-Generator. Will not implement "abnormal" Stuff for given Biome
-- (like Deserts on Grass-Islands or Grass on Deserts)
--
-- TODO: Implement Desert-Generator
heightToTerrain :: MapType -> YCoord -> TileType
heightToTerrain GrassIslandMap y
| y < 0.1 = Ocean
| y < 1 = Beach
| y < 5 = Grass
| y < 10 = Hill
| otherwise = Mountain
heightToTerrain _ _ = undefined
type Seed = (XCoord, ZCoord)
-- | Add lakes on generated Map from (possible) Seeds noted before.
--
-- TODO: implement and erode terrain on the way down.
2014-04-23 11:23:24 +02:00
addLakes :: PlayMap -> [Seed] -> PlayMap
2014-04-22 11:27:07 +02:00
addLakes m s = undefined