summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle/src/Comm')
-rw-r--r--src/battle/src/Comm/SetMap.elm48
1 files changed, 29 insertions, 19 deletions
diff --git a/src/battle/src/Comm/SetMap.elm b/src/battle/src/Comm/SetMap.elm
index e74471d..af930f2 100644
--- a/src/battle/src/Comm/SetMap.elm
+++ b/src/battle/src/Comm/SetMap.elm
@@ -23,37 +23,47 @@ 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] ->
- (Struct.Tile.new_instance
- (index % map_width)
- (index // map_width)
- type_id
- type_id
- 0
- Constants.Movement.cost_when_out_of_bounds
- )
-
- [type_id, border_id, variant_ix] ->
+ (a :: (b :: c)) ->
(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
+ (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
+ []
)
internal_decoder : MapData -> Struct.ServerReply.Type