summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src/battle/src/Struct/Tile.elm')
-rw-r--r-- | src/battle/src/Struct/Tile.elm | 67 |
1 files changed, 47 insertions, 20 deletions
diff --git a/src/battle/src/Struct/Tile.elm b/src/battle/src/Struct/Tile.elm index 0077e7f..9783672 100644 --- a/src/battle/src/Struct/Tile.elm +++ b/src/battle/src/Struct/Tile.elm @@ -3,16 +3,21 @@ module Struct.Tile exposing Ref, Type, Instance, + Border, new, new_instance, + new_border, error_tile_instance, get_id, get_name, + get_borders, + get_border_type_id, + get_border_variant_ix, get_cost, get_instance_cost, get_location, - get_icon_id, get_type_id, + get_variant_ix, get_local_variant_ix, solve_tile_instance, decoder @@ -49,13 +54,19 @@ type alias Type = crossing_cost : Int } +type alias Border = + { + type_id : Int, + variant_ix : Int + } + type alias Instance = { location : Struct.Location.Type, + crossing_cost : Int, type_id : Int, - border_id : Int, variant_ix : Int, - crossing_cost : Int + borders : (List Border) } -------------------------------------------------------------------------------- @@ -84,14 +95,28 @@ new id name crossing_cost = crossing_cost = crossing_cost } -new_instance : Int -> Int -> Int -> Int -> Int -> Int -> Instance -new_instance x y type_id border_id variant_ix crossing_cost = +new_border : Int -> Int -> Border +new_border a b = { - location = {x = x, y = y}, + type_id = a, + variant_ix = b + } + +new_instance : ( + Struct.Location.Type -> + Int -> + Int -> + Int -> + (List Border) -> + Instance + ) +new_instance location type_id variant_ix crossing_cost borders = + { + location = location, type_id = type_id, - border_id = border_id, variant_ix = variant_ix, - crossing_cost = crossing_cost + crossing_cost = crossing_cost, + borders = borders } error_tile_instance : Int -> Int -> Instance @@ -99,9 +124,9 @@ error_tile_instance x y = { location = {x = x, y = y}, type_id = 0, - border_id = 0, variant_ix = 0, - crossing_cost = Constants.Movement.cost_when_out_of_bounds + crossing_cost = Constants.Movement.cost_when_out_of_bounds, + borders = [] } get_id : Type -> Int @@ -119,19 +144,21 @@ get_name tile = tile.name get_location : Instance -> Struct.Location.Type get_location tile_inst = tile_inst.location -get_icon_id : Instance -> String -get_icon_id tile_inst = - ( - (toString tile_inst.type_id) - ++ "-" - ++ (toString tile_inst.border_id) - ++ "-" - ++ (toString tile_inst.variant_ix) - ) - get_type_id : Instance -> Int get_type_id tile_inst = tile_inst.type_id +get_border_type_id : Border -> Int +get_border_type_id tile_border = tile_border.type_id + +get_borders : Instance -> (List Border) +get_borders tile_inst = tile_inst.borders + +get_variant_ix : Instance -> Int +get_variant_ix tile_inst = tile_inst.variant_ix + +get_border_variant_ix : Border -> Int +get_border_variant_ix tile_border = tile_border.variant_ix + get_local_variant_ix : Instance -> Int get_local_variant_ix tile_inst = ( |