| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'src/map-editor')
| -rw-r--r-- | src/map-editor/src/Struct/Tile.elm | 12 | ||||
| -rw-r--r-- | src/map-editor/src/View/SubMenu.elm | 2 | ||||
| -rw-r--r-- | src/map-editor/src/View/SubMenu/Tiles.elm | 50 | 
3 files changed, 36 insertions, 28 deletions
| diff --git a/src/map-editor/src/Struct/Tile.elm b/src/map-editor/src/Struct/Tile.elm index 8a3677c..d2c75fc 100644 --- a/src/map-editor/src/Struct/Tile.elm +++ b/src/map-editor/src/Struct/Tile.elm @@ -9,6 +9,7 @@ module Struct.Tile exposing        new,        clone_instance,        new_instance, +      default_instance,        new_border,        error_tile_instance,        get_id, @@ -136,6 +137,17 @@ new_border type_id variant_id =        variant_id = variant_id     } +default_instance : Type -> Instance +default_instance tile = +   (new_instance +      {x = 0, y = 0} +      tile.id +      "0" +      tile.crossing_cost +      tile.family +      [] +   ) +  new_instance : (        Struct.Location.Type ->        Ref -> diff --git a/src/map-editor/src/View/SubMenu.elm b/src/map-editor/src/View/SubMenu.elm index 89ea92f..0b1fbea 100644 --- a/src/map-editor/src/View/SubMenu.elm +++ b/src/map-editor/src/View/SubMenu.elm @@ -29,7 +29,7 @@ get_inner_html model tab =           (View.SubMenu.Status.get_html model)        Struct.UI.TilesTab -> -         (View.SubMenu.Tiles.get_html) +         (View.SubMenu.Tiles.get_html model)        Struct.UI.SettingsTab ->           (View.SubMenu.Settings.get_html model) diff --git a/src/map-editor/src/View/SubMenu/Tiles.elm b/src/map-editor/src/View/SubMenu/Tiles.elm index d2c4c5b..8d97269 100644 --- a/src/map-editor/src/View/SubMenu/Tiles.elm +++ b/src/map-editor/src/View/SubMenu/Tiles.elm @@ -1,12 +1,15 @@  module View.SubMenu.Tiles exposing (get_html)  -- Elm ------------------------------------------------------------------------- +import Dict +  import Html  import Html.Attributes  import Html.Events --- Battlemap ------------------------------------------------------------------- +-- Map Editor ------------------------------------------------------------------  import Struct.Event +import Struct.Model  import Struct.Tile  import View.Map.Tile @@ -14,36 +17,29 @@ import View.Map.Tile  --------------------------------------------------------------------------------  -- LOCAL -----------------------------------------------------------------------  -------------------------------------------------------------------------------- -get_icon_html : Int -> (Html.Html Struct.Event.Type) -get_icon_html index = -   let tile_id = (String.fromInt index) in -      (Html.div -         [ -            (Html.Attributes.class "map-tile"), -            (Html.Attributes.class "map-tiled"), -            (Html.Attributes.class "clickable"), -            (Html.Attributes.class "map-tile-variant-0"), -            (Html.Events.onClick -               (Struct.Event.TemplateRequested (tile_id, "0")) -            ) -         ] -         (View.Map.Tile.get_content_html -            (Struct.Tile.new_instance -               {x = 0, y = 0} -               tile_id -               "0" -               0 -               "0" -               [] -            ) +get_icon_html : ( +      (Struct.Tile.Ref, Struct.Tile.Type) -> +      (Html.Html Struct.Event.Type) +   ) +get_icon_html (ref, tile) = +   (Html.div +      [ +         (Html.Attributes.class "map-tile"), +         (Html.Attributes.class "map-tiled"), +         (Html.Attributes.class "clickable"), +         (Html.Attributes.class "map-tile-variant-0"), +         (Html.Events.onClick +            (Struct.Event.TemplateRequested ((Struct.Tile.get_id tile), "0"))           ) -      ) +      ] +      (View.Map.Tile.get_content_html (Struct.Tile.default_instance tile)) +   )  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- -get_html : (Html.Html Struct.Event.Type) -get_html = +get_html : Struct.Model.Type -> (Html.Html Struct.Event.Type) +get_html model =     (Html.div        [           (Html.Attributes.class "tabmenu-content"), @@ -51,6 +47,6 @@ get_html =        ]        (List.map           (get_icon_html) -         (List.range 0 5) +         (Dict.toList model.tiles)        )     ) | 


