summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2019-02-25 18:50:51 +0100
committernsensfel <SpamShield0@noot-noot.org>2019-02-25 18:50:51 +0100
commit12f4b4b01426871577c620df6060c946866131a4 (patch)
tree640b3fff4b7638ab56d9bd11b8c198c019ea57ef
parent06b345326f21c3c6fec602df9b67374e922ba6ac (diff)
[Broken] Working on set_map...
-rw-r--r--src/map-editor/src/Comm/SetMap.elm39
-rw-r--r--src/map-editor/src/Struct/Map.elm57
-rw-r--r--src/map-editor/src/Struct/TileInstance.elm211
-rw-r--r--src/map-editor/src/Struct/Toolbox.elm18
-rw-r--r--src/map-editor/src/Update/PrettifySelectedTiles.elm25
-rw-r--r--src/map-editor/src/Update/SetToolboxTemplate.elm19
-rw-r--r--src/map-editor/src/View/Map/Tile.elm27
-rw-r--r--src/map-editor/src/View/SubMenu/Status/TileInfo.elm20
-rw-r--r--src/map-editor/src/View/Toolbox.elm8
9 files changed, 325 insertions, 99 deletions
diff --git a/src/map-editor/src/Comm/SetMap.elm b/src/map-editor/src/Comm/SetMap.elm
index 5d778d6..62e33a4 100644
--- a/src/map-editor/src/Comm/SetMap.elm
+++ b/src/map-editor/src/Comm/SetMap.elm
@@ -12,17 +12,11 @@ import Struct.Map
import Struct.MapMarker
import Struct.ServerReply
import Struct.Tile
+import Struct.TileInstance
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-type alias MapData =
- {
- w : Int,
- h : Int,
- t : (List (List String)),
- m : (Dict.Dict String Struct.MapMarker.Type)
- }
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
@@ -77,39 +71,12 @@ deserialize_tile_instance map_width index t =
[]
)
-internal_decoder : MapData -> Struct.ServerReply.Type
-internal_decoder map_data =
- (Struct.ServerReply.SetMap
- (Struct.Map.new
- map_data.w
- map_data.h
- (List.indexedMap
- (deserialize_tile_instance map_data.w)
- map_data.t
- )
- )
- )
-
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
decode : (Json.Decode.Decoder Struct.ServerReply.Type)
decode =
(Json.Decode.map
- internal_decoder
- (Json.Decode.map4 MapData
- (Json.Decode.field "w" Json.Decode.int)
- (Json.Decode.field "h" Json.Decode.int)
- (Json.Decode.field
- "t"
- (Json.Decode.list (Json.Decode.list Json.Decode.string))
- )
- (Json.Decode.field
- "m"
- (Json.Decode.map
- (Dict.fromList)
- (Json.Decode.keyValuePairs (Struct.MapMarker.decoder))
- )
- )
- )
+ (\map -> (Struct.ServerReply.SetMap map))
+ (Struct.Map.decoder)
)
diff --git a/src/map-editor/src/Struct/Map.elm b/src/map-editor/src/Struct/Map.elm
index f0f0e5b..5c2e24b 100644
--- a/src/map-editor/src/Struct/Map.elm
+++ b/src/map-editor/src/Struct/Map.elm
@@ -8,7 +8,8 @@ module Struct.Map exposing
get_tiles,
set_tile_to,
solve_tiles,
- try_getting_tile_at
+ try_getting_tile_at,
+ decoder
)
-- Elm -------------------------------------------------------------------------
@@ -16,9 +17,13 @@ import Array
import Dict
--- Map -------------------------------------------------------------------
+import Json.Decode
+
+-- Map Editor ------------------------------------------------------------------
import Struct.Tile
import Struct.Location
+import Struct.TileInstance
+import Struct.MapMarker
--------------------------------------------------------------------------------
-- TYPES -----------------------------------------------------------------------
@@ -27,7 +32,8 @@ type alias Type =
{
width : Int,
height : Int,
- content : (Array.Array Struct.Tile.Instance)
+ content : (Array.Array Struct.TileInstance.Type),
+ markers : (Dict.Dict String Struct.MapMarker.Type)
}
--------------------------------------------------------------------------------
@@ -55,10 +61,10 @@ get_width map = map.width
get_height : Type -> Int
get_height map = map.height
-get_tiles : Type -> (Array.Array Struct.Tile.Instance)
+get_tiles : Type -> (Array.Array Struct.TileInstance.Type)
get_tiles map = map.content
-set_tile_to : Struct.Location.Type -> Struct.Tile.Instance -> Type -> Type
+set_tile_to : Struct.Location.Type -> Struct.TileInstance.Type -> Type -> Type
set_tile_to loc tile_inst map =
{map |
content = (Array.set (location_to_index loc map) tile_inst map.content)
@@ -69,21 +75,23 @@ empty =
{
width = 0,
height = 0,
- content = (Array.empty)
+ content = (Array.empty),
+ markers = (Dict.empty)
}
-new : Int -> Int -> (List Struct.Tile.Instance) -> Type
+new : Int -> Int -> (List Struct.TileInstance.Type) -> Type
new width height tiles =
{
width = width,
height = height,
- content = (Array.fromList tiles)
+ content = (Array.fromList tiles),
+ markers = (Dict.empty)
}
try_getting_tile_at : (
Struct.Location.Type ->
Type ->
- (Maybe Struct.Tile.Instance)
+ (Maybe Struct.TileInstance.Type)
)
try_getting_tile_at loc map =
if (has_location loc map)
@@ -93,5 +101,34 @@ try_getting_tile_at loc map =
solve_tiles : (Dict.Dict Struct.Tile.Ref Struct.Tile.Type) -> Type -> Type
solve_tiles tiles map =
{map |
- content = (Array.map (Struct.Tile.solve_tile_instance tiles) map.content)
+ content = (Array.map (Struct.TileInstance.solve tiles) map.content)
}
+
+decoder : (Json.Decode.Decoder Type)
+decoder =
+ (Json.Decode.andThen
+ (\width ->
+ (Json.Decode.map4
+ Type
+ (Json.Decode.field "w" Json.Decode.int)
+ (Json.Decode.field "h" Json.Decode.int)
+ (Json.Decode.field
+ "t"
+ (Json.Decode.map
+ (Array.indexedMap
+ (Struct.TileInstance.set_location_from_index width)
+ )
+ (Json.Decode.array (Struct.TileInstance.decoder))
+ )
+ )
+ (Json.Decode.field
+ "m"
+ (Json.Decode.map
+ (Dict.fromList)
+ (Json.Decode.keyValuePairs (Struct.MapMarker.decoder))
+ )
+ )
+ )
+ )
+ (Json.Decode.field "w" Json.Decode.int)
+ )
diff --git a/src/map-editor/src/Struct/TileInstance.elm b/src/map-editor/src/Struct/TileInstance.elm
new file mode 100644
index 0000000..6ea4c4a
--- /dev/null
+++ b/src/map-editor/src/Struct/TileInstance.elm
@@ -0,0 +1,211 @@
+module Struct.TileInstance exposing
+ (
+ Type,
+ Border,
+ clone,
+ get_class_id,
+ get_family,
+ default,
+ new_border,
+ error,
+ solve,
+ set_location_from_index,
+ decoder
+ )
+
+-- Elm -------------------------------------------------------------------------
+import Dict
+
+import Json.Decode
+import Json.Decode.Pipeline
+
+-- Map Editor ------------------------------------------------------------------
+import Constants.UI
+import Constants.Movement
+
+import Struct.Tile
+import Struct.Location
+
+--------------------------------------------------------------------------------
+-- TYPES -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+type alias Type =
+ {
+ location : Struct.Location.Type,
+ crossing_cost : Int,
+ family : Struct.Tile.FamilyID,
+ type_id : Struct.Tile.Ref,
+ variant_id : Struct.Tile.VariantID,
+ triggers : (List String),
+ borders : (List Border)
+ }
+
+type alias Border =
+ {
+ type_id : Struct.Tile.Ref,
+ variant_id : Struct.Tile.VariantID
+ }
+
+--------------------------------------------------------------------------------
+-- LOCAL -----------------------------------------------------------------------
+--------------------------------------------------------------------------------
+noise_function : Int -> Int -> Int -> Int
+noise_function a b c =
+ let
+ af = (toFloat a)
+ bf = (toFloat b)
+ cf = (toFloat c)
+ (df, ef) = (toPolar (af, bf))
+ (ff, gf) = (toPolar (bf, af))
+ (hf, jf) = (toPolar (bf, cf))
+ (kf, lf) = (toPolar (cf, bf))
+ (mf, nf) = (toPolar (af, cf))
+ (qf, rf) = (toPolar (cf, af))
+ (resA, resB) = (fromPolar ((df + qf), (ef + nf)))
+ (resC, resD) = (fromPolar ((hf + mf), (jf + gf)))
+ (resE, resF) = (toPolar ((resA - resC), (resB - resD)))
+ in
+ (round (resE - resF))
+
+--------------------------------------------------------------------------------
+-- EXPORTED --------------------------------------------------------------------
+--------------------------------------------------------------------------------
+clone : Struct.Location.Type -> Type -> Type
+clone loc inst = {inst | location = loc}
+
+new_border : Struct.Tile.Ref -> Struct.Tile.VariantID -> Border
+new_border type_id variant_id =
+ {
+ type_id = type_id,
+ variant_id = variant_id
+ }
+
+default : Struct.Tile.Type -> Type
+default tile =
+ {
+ location = {x = 0, y = 0},
+ type_id = (Struct.Tile.get_id tile),
+ variant_id = "0",
+ crossing_cost = (Struct.Tile.get_cost tile),
+ family = (Struct.Tile.get_family tile),
+ triggers = [],
+ borders = []
+ }
+
+error : Int -> Int -> Type
+error x y =
+ {
+ location = {x = x, y = y},
+ type_id = "0",
+ variant_id = "0",
+ family = "0",
+ crossing_cost = Constants.Movement.cost_when_out_of_bounds,
+ triggers = [],
+ borders = []
+ }
+
+get_class_id : Type -> Struct.Tile.Ref
+get_class_id inst = inst.type_id
+
+get_cost : Type -> Int
+get_cost inst = inst.crossing_cost
+
+get_location : Type -> Struct.Location.Type
+get_location inst = inst.location
+
+get_family : Type -> Struct.Tile.FamilyID
+get_family inst = inst.family
+
+set_borders : (List Border) -> Type -> Type
+set_borders borders tile_inst = {tile_inst | borders = borders}
+
+get_borders : Type -> (List Border)
+get_borders tile_inst = tile_inst.borders
+
+get_variant_id : Type -> Struct.Tile.VariantID
+get_variant_id tile_inst = tile_inst.variant_id
+
+get_border_variant_id : Border -> Struct.Tile.VariantID
+get_border_variant_id tile_border = tile_border.variant_id
+
+get_local_variant_ix : Type -> Int
+get_local_variant_ix tile_inst =
+ (modBy
+ Constants.UI.local_variants_per_tile
+ (noise_function
+ tile_inst.location.x
+ tile_inst.location.y
+ tile_inst.crossing_cost
+ )
+ )
+
+solve : (Dict.Dict Struct.Tile.Ref Struct.Tile.Type) -> Type -> Type
+solve tiles tile_inst =
+ case (Dict.get tile_inst.type_id tiles) of
+ (Just tile) ->
+ {tile_inst |
+ crossing_cost = (Struct.Tile.get_cost tile),
+ family = (Struct.Tile.get_family tile)
+ }
+
+ Nothing ->
+ {tile_inst |
+ crossing_cost = -1,
+ family = "-1"
+ }
+
+
+list_to_borders : (
+ (List String) ->
+ (List Border) ->
+ (List Border)
+ )
+list_to_borders list borders =
+ case list of
+ (a :: (b :: c)) ->
+ (list_to_borders
+ c
+ ({ type_id = a, variant_id = b } :: borders)
+ )
+ _ -> (List.reverse borders)
+
+decoder : (Json.Decode.Decoder Type)
+decoder =
+ (Json.Decode.andThen
+ (\tile_data ->
+ case tile_data of
+ (tile_id :: (variant_id :: borders)) ->
+ (Json.Decode.succeed
+ Type
+ |> (Json.Decode.Pipeline.hardcoded {x = 0, y = 0}) -- Location
+ |> (Json.Decode.Pipeline.hardcoded 0) -- Crossing Cost
+ |> (Json.Decode.Pipeline.hardcoded "") -- Family
+ |> (Json.Decode.Pipeline.hardcoded tile_id)
+ |> (Json.Decode.Pipeline.hardcoded variant_id)
+ |>
+ (Json.Decode.Pipeline.required
+ "t"
+ (Json.Decode.list (Json.Decode.string))
+ )
+ |>
+ (Json.Decode.Pipeline.hardcoded
+ (list_to_borders borders [])
+ )
+ )
+ _ -> (Json.Decode.succeed (error 0 0))
+ )
+ (Json.Decode.field "b" (Json.Decode.list (Json.Decode.string)))
+ )
+
+get_border_type_id : Border -> Struct.Tile.Ref
+get_border_type_id tile_border = tile_border.type_id
+
+set_location_from_index : Int -> Int -> Type -> Type
+set_location_from_index map_width index tile_inst =
+ {tile_inst |
+ location =
+ {
+ x = (modBy map_width index),
+ y = (index // map_width)
+ }
+ }
diff --git a/src/map-editor/src/Struct/Toolbox.elm b/src/map-editor/src/Struct/Toolbox.elm
index 2363225..a35ecd7 100644
--- a/src/map-editor/src/Struct/Toolbox.elm
+++ b/src/map-editor/src/Struct/Toolbox.elm
@@ -21,10 +21,10 @@ module Struct.Toolbox exposing
-- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Map Editor ------------------------------------------------------------------
import Struct.Location
import Struct.Map
-import Struct.Tile
+import Struct.TileInstance
import Util.List
@@ -33,7 +33,7 @@ import Util.List
--------------------------------------------------------------------------------
type alias Type =
{
- template : Struct.Tile.Instance,
+ template : Struct.TileInstance.Type,
mode : Mode,
shape : Shape,
selection : (List Struct.Location.Type),
@@ -67,7 +67,7 @@ apply_mode_to loc (tb, map) =
tb,
(Struct.Map.set_tile_to
loc
- (Struct.Tile.clone_instance loc tb.template)
+ (Struct.TileInstance.clone loc tb.template)
map
)
)
@@ -137,14 +137,14 @@ get_filled_tiles selection map loc =
Nothing -> []
(Just target) ->
let
- target_class_id = (Struct.Tile.get_type_id target)
+ target_class_id = (Struct.TileInstance.get_class_id target)
map_match_fun =
(\e ->
(case (Struct.Map.try_getting_tile_at e map) of
Nothing -> False
(Just t) ->
(
- (Struct.Tile.get_type_id t)
+ (Struct.TileInstance.get_class_id t)
== target_class_id
)
)
@@ -185,14 +185,14 @@ get_square_tiles corner map new_loc =
default : Type
default =
{
- template = (Struct.Tile.error_tile_instance 0 0),
+ template = (Struct.TileInstance.error 0 0),
mode = Draw,
shape = Simple,
selection = [],
square_corner = Nothing
}
-get_template : Type -> Struct.Tile.Instance
+get_template : Type -> Struct.TileInstance.Type
get_template tb = tb.template
get_mode : Type -> Mode
@@ -220,7 +220,7 @@ get_shapes =
get_selection : Type -> (List Struct.Location.Type)
get_selection tb = tb.selection
-set_template : Struct.Tile.Instance -> Type -> Type
+set_template : Struct.TileInstance.Type -> Type -> Type
set_template template tb =
{tb |
template = template,
diff --git a/src/map-editor/src/Update/PrettifySelectedTiles.elm b/src/map-editor/src/Update/PrettifySelectedTiles.elm
index ef62479..625c47c 100644
--- a/src/map-editor/src/Update/PrettifySelectedTiles.elm
+++ b/src/map-editor/src/Update/PrettifySelectedTiles.elm
@@ -11,6 +11,7 @@ import Struct.Location
import Struct.Map
import Struct.Model
import Struct.Tile
+import Struct.TileInstance
import Struct.TilePattern
import Struct.Toolbox
@@ -28,7 +29,7 @@ neighborhood_tile_instances loc map =
(List.map
(\e ->
case (Struct.Map.try_getting_tile_at e map) of
- Nothing -> (Struct.Tile.error_tile_instance -1 -1)
+ Nothing -> (Struct.TileInstance.error -1 -1)
(Just t) -> t
)
(Struct.Location.get_full_neighborhood loc)
@@ -36,7 +37,7 @@ neighborhood_tile_instances loc map =
get_nigh_patterns : (
Struct.Tile.FamilyID ->
- (List Struct.Tile.Instance) ->
+ (List Struct.TileInstance.Type) ->
(List (Struct.Tile.FamilyID, Struct.Tile.Ref))
)
get_nigh_patterns source_fm full_neighborhood =
@@ -44,15 +45,15 @@ get_nigh_patterns source_fm full_neighborhood =
(List.foldl
(\e -> \acc ->
let
- e_fm = (Struct.Tile.get_instance_family e)
+ e_fm = (Struct.TileInstance.get_family e)
in
if (e_fm <= source_fm)
then acc
else
(Set.insert
(
- (Struct.Tile.get_instance_family e),
- (Struct.Tile.get_type_id e)
+ (Struct.TileInstance.get_family e),
+ (Struct.TileInstance.get_class_id e)
)
acc
)
@@ -64,9 +65,9 @@ get_nigh_patterns source_fm full_neighborhood =
nigh_pattern_to_border : (
Struct.Model.Type ->
- (List Struct.Tile.Instance) ->
+ (List Struct.TileInstance.Type) ->
(Struct.Tile.FamilyID, Struct.Tile.Ref) ->
- (Struct.Tile.Border)
+ (Struct.TileInstance.Border)
)
nigh_pattern_to_border model full_neighborhood nigh_pattern =
let
@@ -86,14 +87,14 @@ nigh_pattern_to_border model full_neighborhood nigh_pattern =
model.wild_tile_patterns
)
of
- Nothing -> (Struct.Tile.new_border "0" "0")
+ Nothing -> (Struct.TileInstance.new_border "0" "0")
(Just tp) ->
- (Struct.Tile.new_border
+ (Struct.TileInstance.new_border
tid
(Struct.TilePattern.get_variant_id tp)
)
- (Just v) -> (Struct.Tile.new_border tid v)
+ (Just v) -> (Struct.TileInstance.new_border tid v)
apply_to_location : (
Struct.Model.Type ->
@@ -110,11 +111,11 @@ apply_to_location model loc map =
in
(Struct.Map.set_tile_to
loc
- (Struct.Tile.set_borders
+ (Struct.TileInstance.set_borders
(List.map
(nigh_pattern_to_border model full_neighborhood)
(get_nigh_patterns
- (Struct.Tile.get_instance_family base)
+ (Struct.TileInstance.get_family base)
full_neighborhood
)
)
diff --git a/src/map-editor/src/Update/SetToolboxTemplate.elm b/src/map-editor/src/Update/SetToolboxTemplate.elm
index 4a0593d..9ec374d 100644
--- a/src/map-editor/src/Update/SetToolboxTemplate.elm
+++ b/src/map-editor/src/Update/SetToolboxTemplate.elm
@@ -1,10 +1,11 @@
module Update.SetToolboxTemplate exposing (apply_to)
+
-- Elm -------------------------------------------------------------------------
--- Battlemap -------------------------------------------------------------------
+-- Map Editor ------------------------------------------------------------------
import Struct.Event
import Struct.Toolbox
-import Struct.Tile
+import Struct.TileInstance
import Struct.Model
--------------------------------------------------------------------------------
@@ -25,16 +26,10 @@ apply_to model main_class_id variant_id =
{model |
toolbox =
(Struct.Toolbox.set_template
- (Struct.Tile.solve_tile_instance
- model.tiles
- (Struct.Tile.new_instance
- {x = 0, y = 0}
- main_class_id
- variant_id
- 0
- "0"
- []
- )
+ (
+ case (Dict.get main_class_id model.tiles) of
+ (Just tile) -> (Struct.TileInstance.default tile)
+ _ -> (Struct.TileInstance.error 0 0)
)
model.toolbox
)
diff --git a/src/map-editor/src/View/Map/Tile.elm b/src/map-editor/src/View/Map/Tile.elm
index bf112d1..996dd3a 100644
--- a/src/map-editor/src/View/Map/Tile.elm
+++ b/src/map-editor/src/View/Map/Tile.elm
@@ -12,6 +12,7 @@ import Constants.IO
import Struct.Event
import Struct.Location
import Struct.Tile
+import Struct.TileInstance
import Struct.Toolbox
--------------------------------------------------------------------------------
@@ -19,7 +20,7 @@ import Struct.Toolbox
--------------------------------------------------------------------------------
get_layer_html : (
Int ->
- Struct.Tile.Border ->
+ Struct.TileInstancec.Border ->
(Html.Html Struct.Event.Type)
)
get_layer_html index border =
@@ -33,9 +34,9 @@ get_layer_html index border =
(
"url("
++ Constants.IO.tile_assets_url
- ++ (Struct.Tile.get_border_type_id border)
+ ++ (Struct.TileInstance.get_border_class_id border)
++ "-f-"
- ++ (Struct.Tile.get_border_variant_id border)
+ ++ (Struct.TileInstance.get_border_variant_id border)
++ ".svg)"
)
)
@@ -46,7 +47,10 @@ get_layer_html index border =
--------------------------------------------------------------------------------
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_content_html : Struct.Tile.Instance -> (List (Html.Html Struct.Event.Type))
+get_content_html : (
+ Struct.TileInstance.Type ->
+ (List (Html.Html Struct.Event.Type))
+ )
get_content_html tile =
(
(Html.div
@@ -57,7 +61,7 @@ get_content_html tile =
(
"url("
++ Constants.IO.tile_assets_url
- ++ (Struct.Tile.get_type_id tile)
+ ++ (Struct.TileInstance.get_class_id tile)
++ "-bg.svg)"
)
)
@@ -74,9 +78,9 @@ get_content_html tile =
(
"url("
++ Constants.IO.tile_assets_url
- ++ (Struct.Tile.get_type_id tile)
+ ++ (Struct.TileInstance.get_class_id tile)
++ "-v-"
- ++ (Struct.Tile.get_variant_id tile)
+ ++ (Struct.TileInstance.get_variant_id tile)
++ ".svg)"
)
)
@@ -93,12 +97,12 @@ get_content_html tile =
get_html : (
Struct.Toolbox.Type ->
- Struct.Tile.Instance ->
+ Struct.TileInstance.Type ->
(Html.Html Struct.Event.Type)
)
get_html tb tile =
let
- tile_loc = (Struct.Tile.get_location tile)
+ tile_loc = (Struct.TileInstance.get_location tile)
in
(Html.div
[
@@ -117,7 +121,10 @@ get_html tb tile =
(Html.Attributes.class
(
"map-tile-variant-"
- ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile))
+ ++
+ (String.fromInt
+ (Struct.TileInstance.get_local_variant_ix tile)
+ )
)
),
(Html.Attributes.class "clickable"),
diff --git a/src/map-editor/src/View/SubMenu/Status/TileInfo.elm b/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
index 450e52d..166dc42 100644
--- a/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
+++ b/src/map-editor/src/View/SubMenu/Status/TileInfo.elm
@@ -14,6 +14,7 @@ import Struct.Event
import Struct.Location
import Struct.Model
import Struct.Tile
+import Struct.TileInstance
import Util.Html
@@ -22,7 +23,7 @@ import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_icon : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type))
+get_icon : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
get_icon tile =
(Html.div
[
@@ -30,7 +31,10 @@ get_icon tile =
(Html.Attributes.class
(
"map-tile-variant-"
- ++ (String.fromInt (Struct.Tile.get_local_variant_ix tile))
+ ++
+ (String.fromInt
+ (Struct.TileInstance.get_local_variant_ix tile)
+ )
)
)
]
@@ -39,11 +43,11 @@ get_icon tile =
get_name : (
Struct.Model.Type ->
- Struct.Tile.Instance ->
+ Struct.TileInstance.Type ->
(Html.Html Struct.Event.Type)
)
get_name model tile =
- case (Dict.get (Struct.Tile.get_type_id tile) model.tiles) of
+ case (Dict.get (Struct.TileInstance.get_class_id tile) model.tiles) of
Nothing -> (Util.Html.nothing)
(Just tile_type) ->
(Html.div
@@ -55,10 +59,10 @@ get_name model tile =
]
)
-get_cost : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type))
+get_cost : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
get_cost tile =
let
- cost = (Struct.Tile.get_instance_cost tile)
+ cost = (Struct.TileInstance.get_cost tile)
text =
if (cost > Constants.Movement.max_points)
then
@@ -75,10 +79,10 @@ get_cost tile =
]
)
-get_location : (Struct.Tile.Instance -> (Html.Html Struct.Event.Type))
+get_location : (Struct.TileInstance.Type -> (Html.Html Struct.Event.Type))
get_location tile =
let
- tile_location = (Struct.Tile.get_location tile)
+ tile_location = (Struct.TileInstance.get_location tile)
in
(Html.div
[
diff --git a/src/map-editor/src/View/Toolbox.elm b/src/map-editor/src/View/Toolbox.elm
index ff64b56..28e7ba6 100644
--- a/src/map-editor/src/View/Toolbox.elm
+++ b/src/map-editor/src/View/Toolbox.elm
@@ -5,9 +5,10 @@ import Html
import Html.Attributes
import Html.Events
--- Struct.Battlemap -------------------------------------------------------------------
+-- Map Editor ------------------------------------------------------------------
import Struct.Event
import Struct.Tile
+import Struct.TileInstance
import Struct.Toolbox
import View.Map.Tile
@@ -15,7 +16,10 @@ import View.Map.Tile
--------------------------------------------------------------------------------
-- LOCAL -----------------------------------------------------------------------
--------------------------------------------------------------------------------
-get_template_icon_html : Struct.Tile.Instance -> (Html.Html Struct.Event.Type)
+get_template_icon_html : (
+ Struct.TileInstance.Type ->
+ (Html.Html Struct.Event.Type)
+ )
get_template_icon_html template =
(Html.div
[