summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/shared/battle-map')
-rw-r--r-- | src/shared/battle-map/BattleMap/Comm/AddTile.elm | 26 | ||||
-rw-r--r-- | src/shared/battle-map/BattleMap/Comm/SetMap.elm | 28 |
2 files changed, 54 insertions, 0 deletions
diff --git a/src/shared/battle-map/BattleMap/Comm/AddTile.elm b/src/shared/battle-map/BattleMap/Comm/AddTile.elm new file mode 100644 index 0000000..e904362 --- /dev/null +++ b/src/shared/battle-map/BattleMap/Comm/AddTile.elm @@ -0,0 +1,26 @@ +module BattleMap.Comm.AddTile exposing (decode) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode + +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Tile + +-- Local Module ---------------------------------------------------------------- +import Struct.ServerReply + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- +internal_decoder : BattleMap.Struct.Tile.Type -> Struct.ServerReply.Type +internal_decoder wp = (Struct.ServerReply.AddTile wp) + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +decode : (Json.Decode.Decoder Struct.ServerReply.Type) +decode = (Json.Decode.map (internal_decoder) (BattleMap.Struct.Tile.decoder)) diff --git a/src/shared/battle-map/BattleMap/Comm/SetMap.elm b/src/shared/battle-map/BattleMap/Comm/SetMap.elm new file mode 100644 index 0000000..bfe8425 --- /dev/null +++ b/src/shared/battle-map/BattleMap/Comm/SetMap.elm @@ -0,0 +1,28 @@ +module BattleMap.Comm.SetMap exposing (decode) + +-- Elm ------------------------------------------------------------------------- +import Json.Decode + +-- Battle Map ------------------------------------------------------------------ +import BattleMap.Struct.Map + +-- Local Module ---------------------------------------------------------------- +import Struct.ServerReply + +-------------------------------------------------------------------------------- +-- TYPES ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +decode : (Json.Decode.Decoder Struct.ServerReply.Type) +decode = + (Json.Decode.map + (\map -> (Struct.ServerReply.SetMap map)) + (BattleMap.Struct.Map.decoder) + ) |