summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-06-15 16:16:03 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-06-15 16:16:03 +0200
commit3cbeffc662a6c4a2cace888ba45b37e88fbf5eeb (patch)
tree4db9d0afffdc66e0bf9d9ee413afda7d9b0e8dd4
parentaaece890baf272688a741bda4b7f974ec2677e43 (diff)
Woops, that puts markers outside the map.
-rw-r--r--src/battlemap/src/Data/Tiles.elm2
-rw-r--r--src/battlemap/src/Struct/RangeIndicator.elm11
2 files changed, 8 insertions, 5 deletions
diff --git a/src/battlemap/src/Data/Tiles.elm b/src/battlemap/src/Data/Tiles.elm
index a357b0c..2b6a582 100644
--- a/src/battlemap/src/Data/Tiles.elm
+++ b/src/battlemap/src/Data/Tiles.elm
@@ -14,4 +14,4 @@ get_cost i =
0 -> 6
1 -> 12
2 -> 24
- _ -> Constants.Movement.cost_when_out_of_bounds
+ _ -> Constants.Movement.cost_when_occupied_tile
diff --git a/src/battlemap/src/Struct/RangeIndicator.elm b/src/battlemap/src/Struct/RangeIndicator.elm
index cead782..20a75c7 100644
--- a/src/battlemap/src/Struct/RangeIndicator.elm
+++ b/src/battlemap/src/Struct/RangeIndicator.elm
@@ -88,7 +88,7 @@ generate_neighbor search_params neighbor_loc dir src_indicator =
let
node_cost = (search_params.cost_function neighbor_loc)
new_dist =
- if (node_cost == Constants.Movement.cost_when_out_of_bounds)
+ if (node_cost == Constants.Movement.cost_when_occupied_tile)
then
(search_params.maximum_distance + 1)
else
@@ -134,9 +134,12 @@ generate_neighbor search_params neighbor_loc dir src_indicator =
candidate_is_acceptable : (SearchParameters -> Int -> Type -> Bool)
candidate_is_acceptable search_params cost candidate =
(
- (candidate.distance <= search_params.maximum_distance)
- ||
- (candidate.atk_range <= search_params.maximum_attack_range)
+ (cost /= Constants.Movement.cost_when_out_of_bounds)
+ &&
+ (
+ (candidate.distance <= search_params.maximum_distance)
+ || (candidate.atk_range <= search_params.maximum_attack_range)
+ )
)
candidate_is_an_improvement : (