summaryrefslogtreecommitdiff
path: root/src/map
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-08-02 20:23:01 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2018-08-02 20:23:01 +0200
commit6869f9a8aaab7618dd49cbb47388838fc883ceb9 (patch)
tree271d743e9ece766a3fd6fb21c9c6ca608b06d9c5 /src/map
parentc0349f22f281940bd2f9b3cf670b21dc895dca85 (diff)
Getting the map editor up to date...
Diffstat (limited to 'src/map')
-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
6 files changed, 165 insertions, 173 deletions
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 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec demo_map () -> list(non_neg_integer()).
+-spec demo_map ()
+ -> list({non_neg_integer(), non_neg_integer(), non_neg_integer()}).
demo_map () ->
[
- 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1,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%%%%%%%%%%%%%%%%%%
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].