summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/battle/btl_shim.erl6
-rw-r--r--src/battle/game-logic/btl_movement.erl4
-rw-r--r--src/battle/reply/btl_set_map.erl4
-rw-r--r--src/battle/struct/btl_battle.erl6
-rw-r--r--src/battle/struct/btl_map.erl18
-rw-r--r--src/battle/struct/btl_tile.erl49
-rw-r--r--src/battle/struct/btl_tile.erl.m449
-rw-r--r--src/map/map_shim.erl67
-rw-r--r--src/map/reply/map_add_tile.erl6
-rw-r--r--src/map/reply/map_set_map.erl6
-rw-r--r--src/map/struct/map_map.erl22
-rw-r--r--src/map/struct/map_tile.erl124
-rw-r--r--src/map/struct/map_tile.erl.m4113
13 files changed, 250 insertions, 224 deletions
diff --git a/src/battle/btl_shim.erl b/src/battle/btl_shim.erl
index e13660c..ec5627a 100644
--- a/src/battle/btl_shim.erl
+++ b/src/battle/btl_shim.erl
@@ -158,15 +158,15 @@ generate_random_battle () ->
UsedTileIDs =
array:sparse_foldl
(
- fun (_IX, TileID, CurrentTileIDs) ->
+ fun (_IX, TileInstance, CurrentTileIDs) ->
sets:add_element
(
- btl_tile:extract_main_class_id(TileID),
+ btl_tile:extract_main_class_id(TileInstance),
CurrentTileIDs
)
end,
sets:new(),
- btl_map:get_tile_ids(Map)
+ btl_map:get_tile_instances(Map)
),
Battle =
diff --git a/src/battle/game-logic/btl_movement.erl b/src/battle/game-logic/btl_movement.erl
index e19e7f7..ec903e8 100644
--- a/src/battle/game-logic/btl_movement.erl
+++ b/src/battle/game-logic/btl_movement.erl
@@ -30,8 +30,8 @@ cross (_Map, _ForbiddenLocations, [], Cost, Location) ->
{Location, Cost};
cross (Map, ForbiddenLocations, [Step|NextSteps], Cost, Location) ->
NextLocation = btl_location:apply_direction(Step, Location),
- NextTileID = btl_map:get_tile_id(NextLocation, Map),
- NextTileClassID = btl_tile:extract_main_class_id(NextTileID),
+ NextTileInstance = btl_map:get_tile_instance(NextLocation, Map),
+ NextTileClassID = btl_tile:extract_main_class_id(NextTileInstance),
NextTile = btl_tile:from_class_id(NextTileClassID),
NextCost = (Cost + btl_tile:get_cost(NextTile)),
IsForbidden =
diff --git a/src/battle/reply/btl_set_map.erl b/src/battle/reply/btl_set_map.erl
index e7e4f25..c0dd2ca 100644
--- a/src/battle/reply/btl_set_map.erl
+++ b/src/battle/reply/btl_set_map.erl
@@ -27,8 +27,8 @@ generate (Map) ->
<<"t">>,
lists:map
(
- fun btl_tile:id_to_int_list/1,
- array:sparse_to_list(btl_map:get_tile_ids(Map))
+ fun btl_tile:instance_to_int_list/1,
+ array:sparse_to_list(btl_map:get_tile_instances(Map))
)
}
]
diff --git a/src/battle/struct/btl_battle.erl b/src/battle/struct/btl_battle.erl
index 22c96f6..b7f158a 100644
--- a/src/battle/struct/btl_battle.erl
+++ b/src/battle/struct/btl_battle.erl
@@ -12,7 +12,7 @@
id :: id(),
used_armor_ids :: list(shr_armor:id()),
used_weapon_ids :: list(shr_weapon:id()),
- used_tile_ids :: list(btl_tile:id()),
+ used_tile_ids :: list(btl_tile:class_id()),
map :: btl_map:type(),
characters :: array:array(btl_character:type()),
players :: array:array(btl_player:type()),
@@ -92,7 +92,7 @@ get_used_weapon_ids (Battle) -> Battle#battle.used_weapon_ids.
-spec get_used_armor_ids (type()) -> list(shr_armor:id()).
get_used_armor_ids (Battle) -> Battle#battle.used_armor_ids.
--spec get_used_tile_ids (type()) -> list(btl_tile:id()).
+-spec get_used_tile_ids (type()) -> list(btl_tile:class_id()).
get_used_tile_ids (Battle) -> Battle#battle.used_tile_ids.
-spec get_map (type()) -> btl_map:type().
@@ -189,7 +189,7 @@ set_current_player_turn (PlayerTurn, Battle) ->
list(btl_character:type()),
list(shr_weapon:id()),
list(shr_armor:id()),
- list(btl_tile:id())
+ list(btl_tile:class_id())
)
-> type().
new (ID, PlayersAsList, Map, CharactersAsList, UWIDs, UAIDs, UTIDs) ->
diff --git a/src/battle/struct/btl_map.erl b/src/battle/struct/btl_map.erl
index ce39b19..cfa8c1e 100644
--- a/src/battle/struct/btl_map.erl
+++ b/src/battle/struct/btl_map.erl
@@ -12,7 +12,7 @@
id :: id(),
width :: integer(),
height :: integer(),
- tile_ids :: array:array(btl_tile:id())
+ tile_ids :: array:array(btl_tile:instance())
}
).
@@ -30,8 +30,8 @@
get_id/1,
get_width/1,
get_height/1,
- get_tile_ids/1,
- get_tile_id/2
+ get_tile_instances/1,
+ get_tile_instance/2
]
).
@@ -72,11 +72,11 @@ get_width (Map) -> Map#map.width.
-spec get_height (type()) -> integer().
get_height (Map) -> Map#map.height.
--spec get_tile_ids (type()) -> array:array(btl_tile:id()).
-get_tile_ids (Map) -> Map#map.tile_ids.
+-spec get_tile_instances (type()) -> array:array(btl_tile:instance()).
+get_tile_instances (Map) -> Map#map.tile_ids.
--spec get_tile_id (btl_location:type(), type()) -> btl_tile:id().
-get_tile_id (Location, Map) ->
+-spec get_tile_instance (btl_location:type(), type()) -> btl_tile:instance().
+get_tile_instance (Location, Map) ->
TileIX = location_to_array_index(Map#map.width, Location),
array:get(TileIX, Map#map.tile_ids).
@@ -89,12 +89,12 @@ get_tile_id (Location, Map) ->
)
-> type().
from_list (ID, Width, Height, List) ->
- TileIDs = lists:map(fun btl_tile:id_from_ints/1, List),
+ TileInstances = lists:map(fun btl_tile:instance_from_ints/1, List),
#map
{
id = list_to_binary(integer_to_list(ID)),
width = Width,
height = Height,
- tile_ids = array:from_list(TileIDs)
+ tile_ids = array:from_list(TileInstances)
}.
diff --git a/src/battle/struct/btl_tile.erl b/src/battle/struct/btl_tile.erl
index 60886ca..45e8ad3 100644
--- a/src/battle/struct/btl_tile.erl
+++ b/src/battle/struct/btl_tile.erl
@@ -14,11 +14,14 @@
).
-opaque class_id() :: non_neg_integer().
--opaque id() :: {class_id(), class_id(), non_neg_integer()}.
+-opaque instance() :: (
+ {class_id(), class_id(), non_neg_integer()}
+ | non_neg_integer()
+).
-opaque type() :: #tile{}.
--export_type([type/0, class_id/0, id/0]).
+-export_type([type/0, class_id/0, instance/0]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -36,8 +39,8 @@
-export
(
[
- id_to_int_list/1,
- id_from_ints/1
+ instance_to_int_list/1,
+ instance_from_ints/1
]
).
@@ -58,14 +61,23 @@
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec extract_main_class_id (id()) -> class_id().
-extract_main_class_id ({M, _, _}) -> M.
+-spec extract_main_class_id (instance()) -> class_id().
+extract_main_class_id (M) when is_integer(M) ->
+ M;
+extract_main_class_id ({M, _, _}) ->
+ M.
--spec extract_border_class_id (id()) -> class_id().
-extract_border_class_id ({_, B, _}) -> B.
+-spec extract_border_class_id (instance()) -> class_id().
+extract_border_class_id (M) when is_integer(M) ->
+ M;
+extract_border_class_id ({_, B, _}) ->
+ B.
--spec extract_variant_ix (id()) -> class_id().
-extract_variant_ix ({_, _, V}) -> V.
+-spec extract_variant_ix (instance()) -> non_neg_integer().
+extract_variant_ix (M) when is_integer(M) ->
+ 0;
+extract_variant_ix ({_, _, V}) ->
+ V.
-spec from_class_id (class_id()) -> type().
@@ -112,11 +124,16 @@ get_cost (Tile) -> Tile#tile.cost.
-spec get_name (type()) -> binary().
get_name (Tile) -> Tile#tile.name.
--spec id_from_ints
+-spec instance_from_ints
(
{non_neg_integer(), non_neg_integer(), non_neg_integer()}
- ) -> id().
-id_from_ints ({M, B, V}) -> {M, B, V}.
-
--spec id_to_int_list (id()) -> list(non_neg_integer()).
-id_to_int_list ({M, B, V}) -> [M, B, V].
+ ) -> instance().
+instance_from_ints ({M, B, V}) ->
+ case (M == B) of
+ true -> M;
+ _ -> {M, B, V}
+ end.
+
+-spec instance_to_int_list (instance()) -> list(non_neg_integer()).
+instance_to_int_list (M) when is_integer(M) -> [M];
+instance_to_int_list ({M, B, V}) -> [M, B, V].
diff --git a/src/battle/struct/btl_tile.erl.m4 b/src/battle/struct/btl_tile.erl.m4
index 170b855..3b3ee53 100644
--- a/src/battle/struct/btl_tile.erl.m4
+++ b/src/battle/struct/btl_tile.erl.m4
@@ -14,11 +14,14 @@
).
-opaque class_id() :: non_neg_integer().
--opaque id() :: {class_id(), class_id(), non_neg_integer()}.
+-opaque instance() :: (
+ {class_id(), class_id(), non_neg_integer()}
+ | non_neg_integer()
+).
-opaque type() :: #tile{}.
--export_type([type/0, class_id/0, id/0]).
+-export_type([type/0, class_id/0, instance/0]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -36,8 +39,8 @@
-export
(
[
- id_to_int_list/1,
- id_from_ints/1
+ instance_to_int_list/1,
+ instance_from_ints/1
]
).
@@ -58,14 +61,23 @@
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec extract_main_class_id (id()) -> class_id().
-extract_main_class_id ({M, _, _}) -> M.
+-spec extract_main_class_id (instance()) -> class_id().
+extract_main_class_id (M) when is_integer(M) ->
+ M;
+extract_main_class_id ({M, _, _}) ->
+ M.
--spec extract_border_class_id (id()) -> class_id().
-extract_border_class_id ({_, B, _}) -> B.
+-spec extract_border_class_id (instance()) -> class_id().
+extract_border_class_id (M) when is_integer(M) ->
+ M;
+extract_border_class_id ({_, B, _}) ->
+ B.
--spec extract_variant_ix (id()) -> class_id().
-extract_variant_ix ({_, _, V}) -> V.
+-spec extract_variant_ix (instance()) -> non_neg_integer().
+extract_variant_ix (M) when is_integer(M) ->
+ 0;
+extract_variant_ix ({_, _, V}) ->
+ V.
-spec from_class_id (class_id()) -> type().
m4_include(__MAKEFILE_DATA_DIR/tile/global.m4.conf)m4_dnl
@@ -86,11 +98,16 @@ get_cost (Tile) -> Tile#tile.cost.
-spec get_name (type()) -> binary().
get_name (Tile) -> Tile#tile.name.
--spec id_from_ints
+-spec instance_from_ints
(
{non_neg_integer(), non_neg_integer(), non_neg_integer()}
- ) -> id().
-id_from_ints ({M, B, V}) -> {M, B, V}.
-
--spec id_to_int_list (id()) -> list(non_neg_integer()).
-id_to_int_list ({M, B, V}) -> [M, B, V].
+ ) -> instance().
+instance_from_ints ({M, B, V}) ->
+ case (M == B) of
+ true -> M;
+ _ -> {M, B, V}
+ end.
+
+-spec instance_to_int_list (instance()) -> list(non_neg_integer()).
+instance_to_int_list (M) when is_integer(M) -> [M];
+instance_to_int_list ({M, B, V}) -> [M, B, V].
diff --git a/src/map/map_shim.erl b/src/map/map_shim.erl
index ef23027..dc673be 100644
--- a/src/map/map_shim.erl
+++ b/src/map/map_shim.erl
@@ -12,41 +12,42 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%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}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}
].
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/src/map/reply/map_add_tile.erl b/src/map/reply/map_add_tile.erl
index ab0d80b..1047231 100644
--- a/src/map/reply/map_add_tile.erl
+++ b/src/map/reply/map_add_tile.erl
@@ -21,10 +21,8 @@ generate (Tile) ->
{
[
{<<"msg">>, <<"add_tile">>},
- {<<"id">>, map_tile:get_id(Tile)},
+ {<<"id">>, map_tile:get_class_id(Tile)},
{<<"nam">>, map_tile:get_name(Tile)},
- {<<"ct">>, map_tile:get_cost(Tile)},
- {<<"rmi">>, map_tile:get_range_minimum(Tile)},
- {<<"rma">>, map_tile:get_range_maximum(Tile)}
+ {<<"ct">>, map_tile:get_cost(Tile)}
]
}.
diff --git a/src/map/reply/map_set_map.erl b/src/map/reply/map_set_map.erl
index 336c9b2..a4fc01a 100644
--- a/src/map/reply/map_set_map.erl
+++ b/src/map/reply/map_set_map.erl
@@ -25,7 +25,11 @@ generate (Map) ->
{<<"h">>, map_map:get_height(Map)},
{
<<"t">>,
- array:sparse_to_list(map_map:get_tile_class_ids(Map))
+ lists:map
+ (
+ fun map_tile:instance_to_int_list/1,
+ array:sparse_to_list(map_map:get_tile_instances(Map))
+ )
}
]
}.
diff --git a/src/map/struct/map_map.erl b/src/map/struct/map_map.erl
index d5a2a7c..db7ea3e 100644
--- a/src/map/struct/map_map.erl
+++ b/src/map/struct/map_map.erl
@@ -13,7 +13,7 @@
owner :: binary(),
width :: integer(),
height :: integer(),
- tile_class_ids :: array:array(map_tile:class_id())
+ tile_instances :: array:array(map_tile:instance())
}
).
@@ -32,8 +32,8 @@
get_owner/1,
get_width/1,
get_height/1,
- get_tile_class_ids/1,
- get_tile_class_id/2
+ get_tile_instances/1,
+ get_tile_instance/2
]
).
@@ -77,13 +77,13 @@ 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(map_tile:class_id()).
-get_tile_class_ids (Map) -> Map#map.tile_class_ids.
+-spec get_tile_instances (type()) -> array:array(map_tile:instance()).
+get_tile_instances (Map) -> Map#map.tile_instances.
--spec get_tile_class_id (map_location:type(), type()) -> map_tile:class_id().
-get_tile_class_id (Location, Map) ->
+-spec get_tile_instance (map_location:type(), type()) -> map_tile:instance().
+get_tile_instance (Location, Map) ->
TileIX = location_to_array_index(Map#map.width, Location),
- array:get(TileIX, Map#map.tile_class_ids).
+ array:get(TileIX, Map#map.tile_instances).
-spec from_list
(
@@ -91,11 +91,11 @@ get_tile_class_id (Location, Map) ->
binary(),
non_neg_integer(),
non_neg_integer(),
- list(non_neg_integer())
+ list({non_neg_integer(), non_neg_integer(), non_neg_integer()})
)
-> type().
from_list (ID, Owner, Width, Height, List) ->
- TileClassIDs = lists:map(fun map_tile:class_id_from_int/1, List),
+ TileInstances = lists:map(fun map_tile:instance_from_ints/1, List),
#map
{
@@ -103,5 +103,5 @@ from_list (ID, Owner, Width, Height, List) ->
owner = Owner,
width = Width,
height = Height,
- tile_class_ids = array:from_list(TileClassIDs)
+ tile_instances = array:from_list(TileInstances)
}.
diff --git a/src/map/struct/map_tile.erl b/src/map/struct/map_tile.erl
deleted file mode 100644
index 58ef658..0000000
--- a/src/map/struct/map_tile.erl
+++ /dev/null
@@ -1,124 +0,0 @@
--module(map_tile).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--record
-(
- tile,
- {
- id :: id(),
- name :: binary(),
- cost :: non_neg_integer(),
- class_range_min :: non_neg_integer(),
- class_range_max :: non_neg_integer()
- }
-).
-
--opaque id() :: non_neg_integer().
--opaque class_id() :: non_neg_integer().
--opaque type() :: #tile{}.
-
--export_type([type/0, class_id/0, id/0]).
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export
-(
- [
- get_id/1,
- get_name/1,
- get_cost/1,
- get_range_minimum/1,
- get_range_maximum/1,
- from_id/1,
- cost_when_oob/0
- ]
-).
-
--export
-(
- [
- class_id_to_type_id/1,
- class_id_from_int/1
- ]
-).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
--spec class_id_to_type_id (class_id()) -> id().
-class_id_to_type_id (ClassID) ->
- case ClassID of
- 0 -> 0;
- 1 -> 1;
- 2 -> 2;
- N when ((N >= 3) and (N =< 17)) -> 3
- end.
-
--spec from_id (id()) -> type().
-from_id (0) ->
- #tile
- {
- id = 0,
- name = <<"[Grassland] Grass">>,
- cost = 6,
- class_range_min = 0,
- class_range_max = 0
- };
-from_id (1) ->
- #tile
- {
- id = 1,
- name = <<"[Grassland] Mushroom Infestation">>,
- cost = 12,
- class_range_min = 1,
- class_range_max = 1
- };
-from_id (2) ->
- #tile
- {
- id = 2,
- name = <<"[Grassland] Tree Remains">>,
- cost = 24,
- class_range_min = 2,
- class_range_max = 2
- };
-from_id (3) ->
- #tile
- {
- id = 3,
- name = <<"[Grassland] Clear Water">>,
- cost = cost_when_occupied(),
- class_range_min = 3,
- class_range_max = 17
- }.
-
--spec cost_when_oob () -> non_neg_integer().
-cost_when_oob () -> 255.
-
--spec cost_when_occupied () -> non_neg_integer().
-cost_when_occupied () -> 201.
-
--spec get_id (type()) -> non_neg_integer().
-get_id (Tile) -> Tile#tile.id.
-
--spec get_cost (type()) -> non_neg_integer().
-get_cost (Tile) -> Tile#tile.cost.
-
--spec get_name (type()) -> binary().
-get_name (Tile) -> Tile#tile.name.
-
--spec get_range_minimum (type()) -> non_neg_integer().
-get_range_minimum (Tile) -> Tile#tile.class_range_min.
-
--spec get_range_maximum (type()) -> non_neg_integer().
-get_range_maximum (Tile) -> Tile#tile.class_range_max.
-
--spec class_id_from_int (non_neg_integer()) -> id().
-class_id_from_int (I) -> I.
diff --git a/src/map/struct/map_tile.erl.m4 b/src/map/struct/map_tile.erl.m4
new file mode 100644
index 0000000..95757e6
--- /dev/null
+++ b/src/map/struct/map_tile.erl.m4
@@ -0,0 +1,113 @@
+-module(map_tile).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-record
+(
+ tile,
+ {
+ id :: class_id(),
+ name :: binary(),
+ cost :: non_neg_integer()
+ }
+).
+
+-opaque class_id() :: non_neg_integer().
+-opaque instance() :: (
+ {class_id(), class_id(), non_neg_integer()}
+ | non_neg_integer()
+).
+
+-opaque type() :: #tile{}.
+
+-export_type([type/0, class_id/0, instance/0]).
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-export
+(
+ [
+ get_class_id/1,
+ get_name/1,
+ get_cost/1,
+ from_class_id/1,
+ cost_when_oob/0
+ ]
+).
+
+-export
+(
+ [
+ instance_to_int_list/1,
+ instance_from_ints/1
+ ]
+).
+
+-export
+(
+ [
+ extract_main_class_id/1,
+ extract_border_class_id/1,
+ extract_variant_ix/1
+ ]
+).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+-spec extract_main_class_id (instance()) -> class_id().
+extract_main_class_id (M) when is_integer(M) ->
+ M;
+extract_main_class_id ({M, _, _}) ->
+ M.
+
+-spec extract_border_class_id (instance()) -> class_id().
+extract_border_class_id (M) when is_integer(M) ->
+ M;
+extract_border_class_id ({_, B, _}) ->
+ B.
+
+-spec extract_variant_ix (instance()) -> non_neg_integer().
+extract_variant_ix (M) when is_integer(M) ->
+ 0;
+extract_variant_ix ({_, _, V}) ->
+ V.
+
+-spec from_class_id (class_id()) -> type().
+m4_include(__MAKEFILE_DATA_DIR/tile/global.m4.conf)m4_dnl
+__TILE_CLASS_USE_ERLANG_STYLE
+m4_include(__MAKEFILE_DATA_DIR/tile/grassland.m4d)m4_dnl
+from_class_id(_) ->
+ from_class_id(0).
+
+-spec cost_when_oob () -> non_neg_integer().
+cost_when_oob () -> __TILE_COST_WHEN_OOB.
+
+-spec get_class_id (type()) -> non_neg_integer().
+get_class_id (Tile) -> Tile#tile.id.
+
+-spec get_cost (type()) -> non_neg_integer().
+get_cost (Tile) -> Tile#tile.cost.
+
+-spec get_name (type()) -> binary().
+get_name (Tile) -> Tile#tile.name.
+
+-spec instance_from_ints
+ (
+ {non_neg_integer(), non_neg_integer(), non_neg_integer()}
+ ) -> instance().
+instance_from_ints ({M, B, V}) ->
+ case (M == B) of
+ true -> M;
+ _ -> {M, B, V}
+ end.
+
+-spec instance_to_int_list (instance()) -> list(non_neg_integer()).
+instance_to_int_list (M) when is_integer(M) -> [M];
+instance_to_int_list ({M, B, V}) -> [M, B, V].