summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/battle/src/Comm/SetMap.elm')
-rw-r--r-- | src/battle/src/Comm/SetMap.elm | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/battle/src/Comm/SetMap.elm b/src/battle/src/Comm/SetMap.elm index 44a6136..407d214 100644 --- a/src/battle/src/Comm/SetMap.elm +++ b/src/battle/src/Comm/SetMap.elm @@ -1,12 +1,15 @@ module Comm.SetMap exposing (decode) -- Elm ------------------------------------------------------------------------- +import Dict + import Json.Decode -- Map ------------------------------------------------------------------------- import Constants.Movement import Struct.Map +import Struct.MapMarker import Struct.ServerReply import Struct.Tile @@ -17,7 +20,8 @@ type alias MapData = { w : Int, h : Int, - t : (List (List String)) + t : (List (List String)), + m : (Dict.Dict String Struct.MapMarker.Type) } -------------------------------------------------------------------------------- @@ -86,12 +90,19 @@ decode : (Json.Decode.Decoder Struct.ServerReply.Type) decode = (Json.Decode.map internal_decoder - (Json.Decode.map3 MapData + (Json.Decode.map4 MapData (Json.Decode.field "w" Json.Decode.int) (Json.Decode.field "h" Json.Decode.int) (Json.Decode.field "t" (Json.Decode.list (Json.Decode.list Json.Decode.string)) ) + (Json.Decode.field + "m" + (Json.Decode.map + (Dict.fromList) + (Json.Decode.keyValuePairs (Struct.MapMarker.decoder)) + ) + ) ) ) |