summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-02-26 18:04:55 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-02-26 18:04:55 +0100 |
commit | 3d945fe5726bf8da486973328a5e8f58f15d3663 (patch) | |
tree | 86fd707fe51baad576302d90ab79ed6bf89c063d /src/map-editor/src/Comm | |
parent | 12f4b4b01426871577c620df6060c946866131a4 (diff) |
Splits Tile & TileInstance (Map Editor only).
Diffstat (limited to 'src/map-editor/src/Comm')
-rw-r--r-- | src/map-editor/src/Comm/SendMapUpdate.elm | 28 | ||||
-rw-r--r-- | src/map-editor/src/Comm/SetMap.elm | 49 |
2 files changed, 2 insertions, 75 deletions
diff --git a/src/map-editor/src/Comm/SendMapUpdate.elm b/src/map-editor/src/Comm/SendMapUpdate.elm index c324ee5..d2ae2c9 100644 --- a/src/map-editor/src/Comm/SendMapUpdate.elm +++ b/src/map-editor/src/Comm/SendMapUpdate.elm @@ -13,7 +13,7 @@ import Comm.Send import Struct.Event import Struct.Map import Struct.Model -import Struct.Tile +import Struct.TileInstance -------------------------------------------------------------------------------- -- TYPES ------------------------------------------------------------------------ @@ -22,30 +22,6 @@ import Struct.Tile -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -encode_tile_border_values : Struct.Tile.Border -> (List String) -encode_tile_border_values border = - [ - (Struct.Tile.get_border_type_id border), - (Struct.Tile.get_border_variant_id border) - ] - -encode_tile_instance : Struct.Tile.Instance -> Json.Encode.Value -encode_tile_instance tile_inst = - (Json.Encode.list - (Json.Encode.string) - ( - [ - (Struct.Tile.get_type_id tile_inst), - (Struct.Tile.get_variant_id tile_inst) - ] - ++ - (List.concatMap - (encode_tile_border_values) - (Struct.Tile.get_borders tile_inst) - ) - ) - ) - encode_map : Struct.Model.Type -> (Maybe Json.Encode.Value) encode_map model = (Just @@ -59,7 +35,7 @@ encode_map model = ( "t", (Json.Encode.list - (encode_tile_instance) + (Struct.TileInstance.encode) (Array.toList (Struct.Map.get_tiles model.map)) ) ) diff --git a/src/map-editor/src/Comm/SetMap.elm b/src/map-editor/src/Comm/SetMap.elm index 62e33a4..06fa34c 100644 --- a/src/map-editor/src/Comm/SetMap.elm +++ b/src/map-editor/src/Comm/SetMap.elm @@ -21,55 +21,6 @@ import Struct.TileInstance -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- -deserialize_tile_borders : ( - (List String) -> - (List Struct.Tile.Border) -> - (List Struct.Tile.Border) - ) -deserialize_tile_borders rem_ints current_borders = - case rem_ints of - [] -> (List.reverse current_borders) - (a :: (b :: c)) -> - (deserialize_tile_borders - c - ((Struct.Tile.new_border a b) :: current_borders) - ) - - _ -> [] - -deserialize_tile_instance : ( - Int -> - Int -> - (List String) -> - Struct.Tile.Instance - ) -deserialize_tile_instance map_width index t = - case t of - (a :: (b :: c)) -> - (Struct.Tile.new_instance - { - x = (modBy map_width index), - y = (index // map_width) - } - a - b - Constants.Movement.cost_when_out_of_bounds - "-1" - (deserialize_tile_borders c []) - ) - - _ -> - (Struct.Tile.new_instance - { - x = (modBy map_width index), - y = (index // map_width) - } - "0" - "0" - Constants.Movement.cost_when_out_of_bounds - "-1" - [] - ) -------------------------------------------------------------------------------- -- EXPORTED -------------------------------------------------------------------- |