summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-08-03 18:00:24 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-08-03 18:00:24 +0200 |
commit | aee23306060ba664e32e6c8463fdf5fb911881a7 (patch) | |
tree | 3e28312f96c07e8f6a369b35dd374af5690b1d93 /src/map-editor/src/Comm | |
parent | ec01963f1f42e7712ee245e8d1acd49ea95fab0c (diff) |
Got it to work and look okay. Only for map-editor
Diffstat (limited to 'src/map-editor/src/Comm')
-rw-r--r-- | src/map-editor/src/Comm/SetMap.elm | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/src/map-editor/src/Comm/SetMap.elm b/src/map-editor/src/Comm/SetMap.elm index 452ab92..7a83320 100644 --- a/src/map-editor/src/Comm/SetMap.elm +++ b/src/map-editor/src/Comm/SetMap.elm @@ -23,40 +23,49 @@ type alias MapData = -------------------------------------------------------------------------------- -- LOCAL ----------------------------------------------------------------------- -------------------------------------------------------------------------------- +deserialize_tile_borders : ( + (List Int) -> + (List Struct.Tile.Border) -> + (List Struct.Tile.Border) + ) +deserialize_tile_borders rem_ints current_borders = + case rem_ints of + [] -> current_borders + (a :: (b :: c)) -> + (deserialize_tile_borders + c + ((Struct.Tile.new_border a b) :: current_borders) + ) + + _ -> [] + deserialize_tile_instance : Int -> Int -> (List Int) -> Struct.Tile.Instance deserialize_tile_instance map_width index t = case t of - [type_id] -> + (a :: (b :: c)) -> (Struct.Tile.new_instance - (index % map_width) - (index // map_width) - type_id - type_id - 0 - Constants.Movement.cost_when_out_of_bounds - -1 - ) - - [type_id, border_id, variant_ix] -> - (Struct.Tile.new_instance - (index % map_width) - (index // map_width) - type_id - border_id - variant_ix + { + x = (index % map_width), + y = (index // map_width) + } + a + b Constants.Movement.cost_when_out_of_bounds -1 + (deserialize_tile_borders c []) ) _ -> (Struct.Tile.new_instance - (index % map_width) - (index // map_width) - 0 + { + x = (index % map_width), + y = (index // map_width) + } 0 0 Constants.Movement.cost_when_out_of_bounds -1 + [] ) internal_decoder : MapData -> Struct.ServerReply.Type |