summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-07-12 17:48:41 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-07-12 17:48:41 +0200 |
commit | a132188ccc244a6d802bd1c32fbf196d4cb53cbd (patch) | |
tree | bd54e576ea8164d3efc801d9c56420218a74e591 /src/map/struct | |
parent | b853df7a1c3efef6b84b90fe8c492611564f8b53 (diff) |
Got it to load the map (full of "error" tiles).
Diffstat (limited to 'src/map/struct')
-rw-r--r-- | src/map/struct/map_direction.erl | 2 | ||||
-rw-r--r-- | src/map/struct/map_location.erl | 4 | ||||
-rw-r--r-- | src/map/struct/map_map.erl (renamed from src/map/struct/map_battlemap.erl) | 13 | ||||
-rw-r--r-- | src/map/struct/map_tile.erl | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/src/map/struct/map_direction.erl b/src/map/struct/map_direction.erl index 9fb5a01..bd61b7d 100644 --- a/src/map/struct/map_direction.erl +++ b/src/map/struct/map_direction.erl @@ -1,4 +1,4 @@ --module(btl_direction). +-module(map_direction). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% diff --git a/src/map/struct/map_location.erl b/src/map/struct/map_location.erl index 9670cb0..edfb85a 100644 --- a/src/map/struct/map_location.erl +++ b/src/map/struct/map_location.erl @@ -1,4 +1,4 @@ --module(btl_location). +-module(map_location). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -44,7 +44,7 @@ validate ({X, Y}) -> -spec get_nowhere () -> type(). get_nowhere () -> nowhere. --spec apply_direction (btl_direction:enum(), type()) -> type(). +-spec apply_direction (map_direction:enum(), type()) -> type(). apply_direction (left, {X, Y}) -> validate({(X - 1), Y}); apply_direction (right, {X, Y}) -> diff --git a/src/map/struct/map_battlemap.erl b/src/map/struct/map_map.erl index 595bcb3..d5a2a7c 100644 --- a/src/map/struct/map_battlemap.erl +++ b/src/map/struct/map_map.erl @@ -13,7 +13,7 @@ owner :: binary(), width :: integer(), height :: integer(), - tile_class_ids :: array:array(btl_tile:class_id()) + tile_class_ids :: array:array(map_tile:class_id()) } ). @@ -50,7 +50,7 @@ -spec location_to_array_index ( non_neg_integer(), - btl_location:type() + map_location:type() ) -> ('error' | non_neg_integer()). location_to_array_index (ArrayWidth, {X, Y}) -> @@ -68,16 +68,19 @@ location_to_array_index (ArrayWidth, {X, Y}) -> -spec get_id (type()) -> id(). get_id (Map) -> Map#map.id. +-spec get_owner (type()) -> binary(). +get_owner (Map) -> Map#map.owner. + -spec get_width (type()) -> integer(). get_width (Map) -> Map#map.width. -spec get_height (type()) -> integer(). get_height (Map) -> Map#map.height. --spec get_tile_class_ids (type()) -> array:array(btl_tile:class_id()). +-spec get_tile_class_ids (type()) -> array:array(map_tile:class_id()). get_tile_class_ids (Map) -> Map#map.tile_class_ids. --spec get_tile_class_id (btl_location:type(), type()) -> btl_tile:class_id(). +-spec get_tile_class_id (map_location:type(), type()) -> map_tile:class_id(). get_tile_class_id (Location, Map) -> TileIX = location_to_array_index(Map#map.width, Location), array:get(TileIX, Map#map.tile_class_ids). @@ -92,7 +95,7 @@ get_tile_class_id (Location, Map) -> ) -> type(). from_list (ID, Owner, Width, Height, List) -> - TileClassIDs = lists:map(fun btl_tile:class_id_from_int/1, List), + TileClassIDs = lists:map(fun map_tile:class_id_from_int/1, List), #map { diff --git a/src/map/struct/map_tile.erl b/src/map/struct/map_tile.erl index 16e671b..58ef658 100644 --- a/src/map/struct/map_tile.erl +++ b/src/map/struct/map_tile.erl @@ -1,4 +1,4 @@ --module(btl_tile). +-module(map_tile). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |