summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2017-10-19 13:30:40 +0200
committernsensfel <SpamShield0@noot-noot.org>2017-10-19 13:30:40 +0200
commite008855086d124f0de14eacc858ecb57d23e371c (patch)
treee3fe94dcf2966d17ac970b4b9cbbf6998c1f34a6 /elm/battlemap/src/Battlemap/Location.elm
parentab299e08cee6ee9b2b122ce87b9bdab3b0dd637c (diff)
Starting a more modular approach for the website.
Diffstat (limited to 'elm/battlemap/src/Battlemap/Location.elm')
-rw-r--r--elm/battlemap/src/Battlemap/Location.elm44
1 files changed, 0 insertions, 44 deletions
diff --git a/elm/battlemap/src/Battlemap/Location.elm b/elm/battlemap/src/Battlemap/Location.elm
deleted file mode 100644
index 36f0c4d..0000000
--- a/elm/battlemap/src/Battlemap/Location.elm
+++ /dev/null
@@ -1,44 +0,0 @@
-module Battlemap.Location exposing (..)
-
-import Battlemap.Direction
-
-type alias Type =
- {
- x : Int,
- y : Int
- }
-
-type alias Ref = (Int, Int)
-
-neighbor : Type -> Battlemap.Direction.Type -> Type
-neighbor loc dir =
- case dir of
- Battlemap.Direction.Right -> {loc | x = (loc.x + 1)}
- Battlemap.Direction.Left -> {loc | x = (loc.x - 1)}
- Battlemap.Direction.Up -> {loc | y = (loc.y - 1)}
- Battlemap.Direction.Down -> {loc | y = (loc.y + 1)}
- Battlemap.Direction.None -> loc
-
-get_ref : Type -> Ref
-get_ref l =
- (l.x, l.y)
-
-from_ref : Ref -> Type
-from_ref (x, y) =
- {x = x, y = y}
-
-dist : Type -> Type -> Int
-dist loc_a loc_b =
- if (loc_a.x > loc_b.x)
- then
- if (loc_a.y > loc_b.y)
- then
- ((loc_a.x - loc_b.x) + (loc_a.y - loc_b.y))
- else
- ((loc_a.x - loc_b.x) + (loc_b.y - loc_a.y))
- else
- if (loc_a.y > loc_b.y)
- then
- ((loc_b.x - loc_a.x) + (loc_a.y - loc_b.y))
- else
- ((loc_b.x - loc_a.x) + (loc_b.y - loc_a.y))