summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/battle/game-logic/btl_movement.erl')
-rw-r--r--src/battle/game-logic/btl_movement.erl60
1 files changed, 0 insertions, 60 deletions
diff --git a/src/battle/game-logic/btl_movement.erl b/src/battle/game-logic/btl_movement.erl
deleted file mode 100644
index dd7eff9..0000000
--- a/src/battle/game-logic/btl_movement.erl
+++ /dev/null
@@ -1,60 +0,0 @@
--module(btl_movement).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--export([cross/4]).
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-
-
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
--spec cross
- (
- btl_map:type(),
- list(btl_location:type()),
- list(btl_direction:enum()),
- non_neg_integer(),
- btl_location:type()
- )
- -> {btl_location:type(), non_neg_integer()}.
-cross (_Map, _ForbiddenLocations, [], Cost, Location) ->
- {Location, Cost};
-cross (Map, ForbiddenLocations, [Step|NextSteps], Cost, Location) ->
- NextLocation = btl_location:apply_direction(Step, Location),
- NextTileInstance = btl_map:get_tile_instance(NextLocation, Map),
- NextTileClassID = shr_tile:extract_main_class_id(NextTileInstance),
- NextTile = shr_tile:from_class_id(NextTileClassID),
- NextCost = (Cost + shr_tile:get_cost(NextTile)),
- IsForbidden =
- lists:foldl
- (
- fun (ForbiddenLocation, Prev) ->
- (Prev or (NextLocation == ForbiddenLocation))
- end,
- false,
- ForbiddenLocations
- ),
-
- IsForbidden = false,
-
- cross(Map, ForbiddenLocations, NextSteps, NextCost, NextLocation).
-
--spec cross
- (
- btl_map:type(),
- list(btl_location:type()),
- list(btl_direction:enum()),
- btl_location:type()
- )
- -> {btl_location:type(), non_neg_integer()}.
-cross (Map, ForbiddenLocations, Path, Location) ->
- cross(Map, ForbiddenLocations, Path, 0, Location).