summaryrefslogtreecommitdiff
blob: bdc4238d9ee44658318afb6baae1f4b7844f60f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
module BattleMap.Comm.AddDataSetItem exposing (prefix, get_decoder_for)

-- Elm -------------------------------------------------------------------------
import Json.Decode

-- Battle Map ------------------------------------------------------------------
import BattleMap.Comm.AddTile

-- Local Module ----------------------------------------------------------------
import Struct.ServerReply

--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------

--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
prefix : String
prefix = "amds"

get_decoder_for : String -> (Json.Decode.Decoder Struct.ServerReply.Type)
get_decoder_for reply_type =
   case reply_type of
      "amds_tile" -> (BattleMap.Comm.AddTile.decode)

      other ->
         (Json.Decode.fail
            (
               "Unknown server command \""
               ++ other
               ++ "\""
            )
         )