summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/battlemap/src/Send/LoadBattlemap.elm')
-rw-r--r--src/battlemap/src/Send/LoadBattlemap.elm39
1 files changed, 4 insertions, 35 deletions
diff --git a/src/battlemap/src/Send/LoadBattlemap.elm b/src/battlemap/src/Send/LoadBattlemap.elm
index e7dc82a..71758cf 100644
--- a/src/battlemap/src/Send/LoadBattlemap.elm
+++ b/src/battlemap/src/Send/LoadBattlemap.elm
@@ -1,12 +1,9 @@
-module Send.LoadBattlemap exposing (try_sending)
+module Send.LoadBattlemap exposing (try)
-- Elm -------------------------------------------------------------------------
-import Http
-
import Dict
import Json.Encode
-import Json.Decode
-- Battlemap -------------------------------------------------------------------
import Constants.IO
@@ -47,37 +44,9 @@ try_encoding model =
_ ->
Nothing
-decode : (Json.Decode.Decoder (Dict.Dict String (List String))) --Send.Reply)
-decode =
- (Json.Decode.dict
- (Json.Decode.list Json.Decode.string)
- )
-
--- Reply:
--- {
--- TYPES: (list Instr-Type),
--- DATA: (list Instr-Data)
--- }
---
--- Instr-Type : display-message, move-char, etc...
--- Instr-Data : {category: int, content: string}, {char_id: string, x: int, y: int}
-
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-try_sending : Model.Type -> (Maybe (Cmd Event.Type))
-try_sending model =
- case (try_encoding model) of
- (Just serial) ->
- (Just
- (Http.send
- Event.ServerReplied
- (Http.post
- Constants.IO.battlemap_loading_handler
- (Http.jsonBody serial)
- (decode)
- )
- )
- )
-
- Nothing -> Nothing
+try : Model.Type -> (Maybe (Cmd Event.Type))
+try model =
+ (Send.try_sending model Constants.IO.battlemap_loading_handler try_encoding)