summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-26 19:13:04 +0200
committerNathanael Sensfelder <SpamShield0@MultiAgentSystems.org>2017-09-26 19:13:04 +0200
commit33e57128d48a012533c42635f52037fcdedd4c56 (patch)
tree05deb83b77311d25168e5966c14c1bf20f17fb79 /client/elm/battlemap/src/Battlemap
parent9293fb062b0bf66995c72b30e037c762318be000 (diff)
Range indicators are now clickable.
Diffstat (limited to 'client/elm/battlemap/src/Battlemap')
-rw-r--r--client/elm/battlemap/src/Battlemap/Html.elm16
-rw-r--r--client/elm/battlemap/src/Battlemap/Navigator.elm24
-rw-r--r--client/elm/battlemap/src/Battlemap/Tile.elm3
3 files changed, 30 insertions, 13 deletions
diff --git a/client/elm/battlemap/src/Battlemap/Html.elm b/client/elm/battlemap/src/Battlemap/Html.elm
index f67bdf0..6506c0f 100644
--- a/client/elm/battlemap/src/Battlemap/Html.elm
+++ b/client/elm/battlemap/src/Battlemap/Html.elm
@@ -9,12 +9,12 @@ import Battlemap
import Battlemap.Tile
import Battlemap.Direction
-import Update
+import Event
type alias GridBuilder =
{
- row : (List (Html.Html Update.Type)),
- columns : (List (Html.Html Update.Type)),
+ row : (List (Html.Html Event.Type)),
+ columns : (List (Html.Html Event.Type)),
row_size : Int,
bmap : Battlemap.Type
}
@@ -28,12 +28,12 @@ nav_level_to_text t =
Battlemap.Direction.Down -> "D"
Battlemap.Direction.None -> (toString t.floor_level)
-view_battlemap_cell : Battlemap.Tile.Type -> (Html.Html Update.Type)
+view_battlemap_cell : Battlemap.Tile.Type -> (Html.Html Event.Type)
view_battlemap_cell t =
case t.char_level of
Nothing ->
(Html.td
- []
+ [ (Html.Events.onClick (Event.SelectTile t.location)) ]
[
(Html.text
(case t.mod_level of
@@ -47,7 +47,7 @@ view_battlemap_cell t =
)
(Just char_id) ->
(Html.td
- [ (Html.Events.onClick (Update.SelectCharacter char_id)) ]
+ [ (Html.Events.onClick (Event.SelectCharacter char_id)) ]
[
(Html.text ("[" ++ char_id ++ "]")),
(Html.text (nav_level_to_text t))
@@ -73,7 +73,7 @@ foldr_to_html t gb =
row_size = (gb.row_size + 1)
}
-grid_builder_to_html : GridBuilder -> (List (Html.Html Update.Type))
+grid_builder_to_html : GridBuilder -> (List (Html.Html Event.Type))
grid_builder_to_html gb =
if (gb.row_size == 0)
then
@@ -81,7 +81,7 @@ grid_builder_to_html gb =
else
((Html.tr [] gb.row) :: gb.columns)
-view : Battlemap.Type -> (Html.Html Update.Type)
+view : Battlemap.Type -> (Html.Html Event.Type)
view battlemap =
(Html.table
[]
diff --git a/client/elm/battlemap/src/Battlemap/Navigator.elm b/client/elm/battlemap/src/Battlemap/Navigator.elm
index 3a0ca05..b040013 100644
--- a/client/elm/battlemap/src/Battlemap/Navigator.elm
+++ b/client/elm/battlemap/src/Battlemap/Navigator.elm
@@ -1,7 +1,8 @@
module Battlemap.Navigator exposing
(
Type,
- new_navigator
+ new,
+ reset
)
import Set
@@ -17,14 +18,27 @@ type alias Type =
current_location : Battlemap.Location.Type,
visited_locations : (Set.Set Battlemap.Location.Ref),
previous_directions : (List Battlemap.Direction.Type),
- remaining_points : Int
+ remaining_points : Int,
+ starting_location : Battlemap.Location.Type,
+ starting_points : Int
}
-new_navigator : Battlemap.Location.Type -> Int -> Type
-new_navigator start points =
+new : Battlemap.Location.Type -> Int -> Type
+new start points =
{
current_location = start,
visited_locations = Set.empty,
previous_directions = [],
- remaining_points = points
+ remaining_points = points,
+ starting_location = start,
+ starting_points = points
+ }
+
+reset : Type -> Type
+reset nav =
+ {nav |
+ current_location = nav.starting_location,
+ visited_locations = Set.empty,
+ previous_directions = [],
+ remaining_points = nav.starting_points
}
diff --git a/client/elm/battlemap/src/Battlemap/Tile.elm b/client/elm/battlemap/src/Battlemap/Tile.elm
index 6d2a65b..986cb2a 100644
--- a/client/elm/battlemap/src/Battlemap/Tile.elm
+++ b/client/elm/battlemap/src/Battlemap/Tile.elm
@@ -8,6 +8,8 @@ module Battlemap.Tile exposing
)
import Battlemap.Direction
+import Battlemap.Location
+
import Character
type TileModifier =
@@ -16,6 +18,7 @@ type TileModifier =
type alias Type =
{
+ location : Battlemap.Location.Ref,
floor_level : Int,
nav_level : Battlemap.Direction.Type,
char_level : (Maybe Character.Ref),