summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-02-23 11:35:45 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-02-23 11:35:45 +0100
commitacf9e9f1eb880ffb8ab918c40724eda566aefcc7 (patch)
treeefa3dd6c88d7970632fbe44f322d03b983b02768 /src/type/battlemap
parent43e38e5fc54fd58e8230b2b5198b6d8cb625803c (diff)
Starting a big refactoring...
Diffstat (limited to 'src/type/battlemap')
-rw-r--r--src/type/battlemap/cross_5.erl63
1 files changed, 0 insertions, 63 deletions
diff --git a/src/type/battlemap/cross_5.erl b/src/type/battlemap/cross_5.erl
deleted file mode 100644
index dccc4b9..0000000
--- a/src/type/battlemap/cross_5.erl
+++ /dev/null
@@ -1,63 +0,0 @@
-%%
-%% battlemap:cross/5
-%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-next_loc (X, Y, <<"L">>) -> {(X - 1), Y};
-next_loc (X, Y, <<"R">>) -> {(X + 1), Y};
-next_loc (X, Y, <<"U">>) -> {X, (Y - 1)};
-next_loc (X, Y, <<"D">>) -> {X, (Y + 1)}.
-
-loc_to_index(X, Y, Map) ->
- if
- (X < 0) -> error;
- (Y < 0) -> error;
- (X >= Map#battlemap.width) -> error;
- true -> ((Y * Map#battlemap.width) + X)
- end.
-
-calc_new_loc (X, Y, [], Points, _Map, _CharInstsLocs) ->
- io:format("~nPoints remaining: ~p ~n", [Points]),
- true = (Points >= 0),
- {X, Y};
-calc_new_loc (X, Y, [Step|Path], Points, Map, CharInstsLocs) ->
- io:format("~nStep - Points remaining: ~p ~n", [Points]),
- {NX, NY} = next_loc(X, Y, Step),
- TileCost =
- tile:get_cost
- (
- array:get
- (
- loc_to_index(NX, NY, Map),
- Map#battlemap.content
- )
- ),
- io:format("~nStep cost: ~p ~n", [TileCost]),
- NPoints =
- (
- Points
- -
- TileCost
- ),
- false = lists:member({NX, NY}, CharInstsLocs),
- calc_new_loc(NX, NY, Path, NPoints, Map, CharInstsLocs).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-cross (Battlemap, {X, Y}, Points, Path, CharInsts) ->
- calc_new_loc
- (
- X,
- Y,
- Path,
- Points,
- Battlemap,
- lists:map
- (
- fun character_instance:get_location/1,
- CharInsts
- )
- ).