summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-15 17:41:07 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-15 17:41:07 +0200
commitc9786fd27954c79faf901963003a8b7b3131ca4c (patch)
tree85919cf11c2e54908cfeeebe59acf03283f131c8 /client/elm/battlemap/src/Battlemap.elm
parent9a2d8f37dea8e14afa57affb135def13954df547 (diff)
Adds UI to test the Navigator.
Diffstat (limited to 'client/elm/battlemap/src/Battlemap.elm')
-rw-r--r--client/elm/battlemap/src/Battlemap.elm11
1 files changed, 10 insertions, 1 deletions
diff --git a/client/elm/battlemap/src/Battlemap.elm b/client/elm/battlemap/src/Battlemap.elm
index dbf797a..09b4099 100644
--- a/client/elm/battlemap/src/Battlemap.elm
+++ b/client/elm/battlemap/src/Battlemap.elm
@@ -1,4 +1,4 @@
-module Battlemap exposing (Battlemap, random, apply_to_tile)
+module Battlemap exposing (Battlemap, random, apply_to_tile, has_location)
import Array exposing (Array, set, get)
@@ -25,6 +25,15 @@ location_to_index : Battlemap -> Location -> Int
location_to_index bmap loc =
((loc.y * bmap.width) + loc.x)
+has_location : Battlemap -> Location -> Bool
+has_location bmap loc =
+ (
+ (loc.x >= 0)
+ && (loc.y >= 0)
+ && (loc.x < bmap.width)
+ && (loc.y < bmap.height)
+ )
+
apply_to_tile : Battlemap -> Location -> (Tile -> Tile) -> (Maybe Battlemap)
apply_to_tile bmap loc fun =
let