| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-07-12 21:09:37 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-07-12 21:09:37 +0200 | 
| commit | eb7c4865b5311ca559b12fe649ea3f865d1f66b5 (patch) | |
| tree | 8165f1c587e7e8843a4712febf8136a05d105f60 /src | |
| parent | 559f46102c656ace81a262f0edff28b617a7ec88 (diff) | |
The map editor now displays it correctly.
Diffstat (limited to 'src')
| -rw-r--r-- | src/asset/www/data/tiles.json | 38 | ||||
| -rw-r--r-- | src/asset/www/data/tiles.json.m4 | 8 | ||||
| -rw-r--r-- | src/map-editor/src/Comm/LoadTiles.elm | 31 | ||||
| -rw-r--r-- | src/map-editor/src/Comm/Send.elm | 16 | ||||
| -rw-r--r-- | src/map-editor/src/Constants/IO.elm.m4 | 6 | ||||
| -rw-r--r-- | src/map-editor/src/ElmModule/Init.elm | 15 | 
6 files changed, 110 insertions, 4 deletions
| diff --git a/src/asset/www/data/tiles.json b/src/asset/www/data/tiles.json new file mode 100644 index 0000000..0c8f9fc --- /dev/null +++ b/src/asset/www/data/tiles.json @@ -0,0 +1,38 @@ +[ + +   { +      "msg": "add_tile", +      "id": 0, +      "nam": "[Grassland] Grass", +      "ct": 6, +      "rmi": 0, +      "rma": 0 +   }, +   { +      "msg": "add_tile", +      "id": 1, +      "nam": "[Grassland] Mushroom Infestation", +      "ct": 12, +      "rmi": 1, +      "rma": 1 +   }, +   { +      "msg": "add_tile", +      "id": 2, +      "nam": "[Grassland] Tree Remains", +      "ct": 24, +      "rmi": 2, +      "rma": 2 +   }, +   { +      "msg": "add_tile", +      "id": 3, +      "nam": "[Grassland] Clear Water", +      "ct": 201, +      "rmi": 3, +      "rma": 17 +   }, +   { +      "msg": "okay" +   } +] diff --git a/src/asset/www/data/tiles.json.m4 b/src/asset/www/data/tiles.json.m4 new file mode 100644 index 0000000..fcbbd39 --- /dev/null +++ b/src/asset/www/data/tiles.json.m4 @@ -0,0 +1,8 @@ +[ +m4_include(__MAKEFILE_DATA_DIR/tile/global.m4.conf)m4_dnl +__TILE_CLASS_USE_JSON_STYLE +m4_include(__MAKEFILE_DATA_DIR/tile/grassland.m4d)m4_dnl +   { +      "msg": "okay" +   } +] diff --git a/src/map-editor/src/Comm/LoadTiles.elm b/src/map-editor/src/Comm/LoadTiles.elm new file mode 100644 index 0000000..6175e7a --- /dev/null +++ b/src/map-editor/src/Comm/LoadTiles.elm @@ -0,0 +1,31 @@ +module Comm.LoadTiles exposing (try) + +-- Elm ------------------------------------------------------------------------- + +-- Battlemap ------------------------------------------------------------------- +import Comm.Send + +import Constants.IO + +import Struct.Event +import Struct.Model + +-------------------------------------------------------------------------------- +-- TYPES ------------------------------------------------------------------------ +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- LOCAL ----------------------------------------------------------------------- +-------------------------------------------------------------------------------- + +-------------------------------------------------------------------------------- +-- EXPORTED -------------------------------------------------------------------- +-------------------------------------------------------------------------------- +try : Struct.Model.Type -> (Maybe (Cmd Struct.Event.Type)) +try model = +   (Just +      (Comm.Send.empty_request +         model +         Constants.IO.tiles_data_url +      ) +   ) diff --git a/src/map-editor/src/Comm/Send.elm b/src/map-editor/src/Comm/Send.elm index 2b9c4aa..f620f68 100644 --- a/src/map-editor/src/Comm/Send.elm +++ b/src/map-editor/src/Comm/Send.elm @@ -1,4 +1,4 @@ -module Comm.Send exposing (try_sending) +module Comm.Send exposing (try_sending, empty_request)  -- Elm -------------------------------------------------------------------------  import Http @@ -66,3 +66,17 @@ try_sending model recipient try_encoding_fun =           )        Nothing -> Nothing + +empty_request : ( +      Struct.Model.Type -> +      String -> +      (Cmd Struct.Event.Type) +   ) +empty_request model recipient = +   (Http.send +      Struct.Event.ServerReplied +      (Http.get +         recipient +         (Json.Decode.list (decode)) +      ) +   ) diff --git a/src/map-editor/src/Constants/IO.elm.m4 b/src/map-editor/src/Constants/IO.elm.m4 index ed66c79..397efaa 100644 --- a/src/map-editor/src/Constants/IO.elm.m4 +++ b/src/map-editor/src/Constants/IO.elm.m4 @@ -3,6 +3,12 @@ module Constants.IO exposing (..)  base_url : String  base_url = "__CONF_SERVER_URL" +data_url : String +data_url = (base_url ++ "/asset/data/") + +tiles_data_url : String +tiles_data_url = (base_url ++ "/asset/data/tiles.json") +  map_editor_handler_url : String  map_editor_handler_url = (base_url ++ "/handler/map-editor") diff --git a/src/map-editor/src/ElmModule/Init.elm b/src/map-editor/src/ElmModule/Init.elm index 73230a3..09034dc 100644 --- a/src/map-editor/src/ElmModule/Init.elm +++ b/src/map-editor/src/ElmModule/Init.elm @@ -3,6 +3,7 @@ module ElmModule.Init exposing (init)  -- Elm -------------------------------------------------------------------------  -- Battlemap ------------------------------------------------------------------- +import Comm.LoadTiles  import Comm.LoadMap  import Struct.Event @@ -21,8 +22,16 @@ init flags =     let model = (Struct.Model.new flags) in        (           model, -         (case (Comm.LoadMap.try model) of -            (Just cmd) -> cmd -            Nothing -> Cmd.none +         (Cmd.batch +            [ +               (case (Comm.LoadTiles.try model) of +                  (Just cmd) -> cmd +                  Nothing -> Cmd.none +               ), +               (case (Comm.LoadMap.try model) of +                  (Just cmd) -> cmd +                  Nothing -> Cmd.none +               ) +            ]           )        ) | 


