From 58a598da8e0784c5386473324981e34a77e0c882 Mon Sep 17 00:00:00 2001 From: Jonas Betzendahl Date: Sun, 9 Feb 2014 20:18:03 +0100 Subject: [PATCH] Added Creation and StaticMaps modules --- src/Map/Creation.hs | 7 +++++++ src/Map/StaticMaps.hs | 9 +++++++++ src/Map/Types.hs | 16 ++++++++++------ 3 files changed, 26 insertions(+), 6 deletions(-) create mode 100644 src/Map/Creation.hs create mode 100644 src/Map/StaticMaps.hs diff --git a/src/Map/Creation.hs b/src/Map/Creation.hs new file mode 100644 index 0000000..12f04eb --- /dev/null +++ b/src/Map/Creation.hs @@ -0,0 +1,7 @@ +module Map.Creation +where + +import Map.Types + +newMap :: Int -> Int -> PlayMap +newMap = undefined diff --git a/src/Map/StaticMaps.hs b/src/Map/StaticMaps.hs new file mode 100644 index 0000000..fb0a540 --- /dev/null +++ b/src/Map/StaticMaps.hs @@ -0,0 +1,9 @@ +module Map.StaticMaps +where + +import Map.Types + +import Data.Array + +emptyMap :: PlayMap +emptyMap = array ((0,0), (100,100)) [((a,b), (Minimal (a,b) 0.5)) | a <- [0..100], b <- [0..100]] diff --git a/src/Map/Types.hs b/src/Map/Types.hs index c653c64..22ca269 100644 --- a/src/Map/Types.hs +++ b/src/Map/Types.hs @@ -3,11 +3,13 @@ where import PioneerTypes -newtype XCoord = XCoord Int -newtype YCoord = YCoord Int -newtype ZCoord = ZCoord Float +import Data.Array -newtype Coord = Coord (XCoord, YCoord, ZCoord) +type PlayMap = Array (XCoord, YCoord) Node + +type XCoord = Int +type YCoord = Int +type ZCoord = Float -- | Ownership information, Parameter to occupied is player number data PlayerInfo = NoPlayer @@ -40,5 +42,7 @@ data TileType = Ocean | Mountain -- ^ Not accessible deriving (Eq) -data Node = Full Coord TileType BuildInfo PlayerInfo PathInfo ResInfo StorInfo - | Minimal Coord +-- TODO: Record Syntax +data Node = Full (XCoord, YCoord) ZCoord TileType BuildInfo PlayerInfo PathInfo ResInfo StorInfo + | Minimal (XCoord, YCoord) ZCoord -- defaults to empty green grass node on height 0.5 +