From c9786fd27954c79faf901963003a8b7b3131ca4c Mon Sep 17 00:00:00 2001 From: Nathanael Sensfelder Date: Fri, 15 Sep 2017 17:41:07 +0200 Subject: Adds UI to test the Navigator. --- client/elm/battlemap/src/Battlemap.elm | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'client/elm/battlemap/src/Battlemap.elm') 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 -- cgit v1.2.3-70-g09d2