summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--elm/battlemap/src/Battlemap.elm84
-rw-r--r--elm/battlemap/src/Battlemap/Html.elm82
-rw-r--r--elm/battlemap/src/Battlemap/Navigator.elm18
-rw-r--r--elm/battlemap/src/Battlemap/Navigator/RangeIndicator.elm6
-rw-r--r--elm/battlemap/src/Battlemap/Tile.elm18
-rw-r--r--elm/battlemap/src/Model/EndTurn.elm2
-rw-r--r--elm/battlemap/src/Model/RequestDirection.elm27
-rw-r--r--elm/battlemap/src/Model/SelectCharacter.elm1
-rw-r--r--elm/battlemap/src/Model/SelectTile.elm89
-rw-r--r--elm/battlemap/src/Shim/Battlemap/Tile.elm141
-rw-r--r--elm/battlemap/src/Update.elm2
-rw-r--r--elm/battlemap/src/View/Battlemap.elm26
12 files changed, 197 insertions, 299 deletions
diff --git a/elm/battlemap/src/Battlemap.elm b/elm/battlemap/src/Battlemap.elm
index 888295a..c4aaf06 100644
--- a/elm/battlemap/src/Battlemap.elm
+++ b/elm/battlemap/src/Battlemap.elm
@@ -2,10 +2,11 @@ module Battlemap exposing
(
Type,
reset,
- get_navigator_location,
get_navigator_remaining_points,
set_navigator,
- add_step_to_navigator
+ try_getting_navigator_location,
+ try_getting_navigator_path_to,
+ try_adding_step_to_navigator
)
import Array
@@ -51,13 +52,11 @@ reset bmap =
navigator = Nothing
}
-get_navigator_location : Type -> (Maybe Battlemap.Location.Type)
-get_navigator_location bmap =
+try_getting_navigator_location : Type -> (Maybe Battlemap.Location.Type)
+try_getting_navigator_location bmap =
case bmap.navigator of
(Just navigator) ->
- (Just
- (Battlemap.Navigator.get_current_location navigator)
- )
+ (Just (Battlemap.Navigator.get_current_location navigator))
Nothing -> Nothing
@@ -88,19 +87,18 @@ set_navigator start_loc movement_points attack_range can_cross bmap =
)
}
-add_step_to_navigator : (
+try_adding_step_to_navigator : (
Type ->
- Battlemap.Direction.Type ->
(Battlemap.Location.Type -> Bool) ->
- (Battlemap.Location.Type -> Int) ->
+ Battlemap.Direction.Type ->
(Maybe Type)
)
-add_step_to_navigator bmap dir can_cross cost_fun =
+try_adding_step_to_navigator bmap can_cross dir =
case bmap.navigator of
(Just navigator) ->
let
new_navigator =
- (Battlemap.Navigator.add_step
+ (Battlemap.Navigator.try_adding_step
navigator
dir
(\loc -> ((can_cross loc) && (has_location bmap loc)))
@@ -118,61 +116,15 @@ add_step_to_navigator bmap dir can_cross cost_fun =
Nothing -> Nothing
_ -> Nothing
---------------------------------------------------------------------------------
-apply_to_all_tiles : (
- Type -> (Battlemap.Tile.Type -> Battlemap.Tile.Type) -> Type
- )
-apply_to_all_tiles bmap fun =
- {bmap |
- content = (Array.map fun bmap.content)
- }
-
-apply_to_tile : (
+try_getting_navigator_path_to : (
Type ->
- Battlemap.Location.Type ->
- (Battlemap.Tile.Type -> Battlemap.Tile.Type) ->
- (Maybe Type)
+ Battlemap.Location.Ref ->
+ (Maybe (List Battlemap.Direction.Type))
)
-apply_to_tile bmap loc fun =
- let
- index = (location_to_index bmap loc)
- at_index = (Array.get index bmap.content)
- in
- case at_index of
- Nothing ->
- Nothing
- (Just tile) ->
- (Just
- {bmap |
- content =
- (Array.set
- index
- (fun tile)
- bmap.content
- )
- }
- )
+try_getting_navigator_path_to bmap loc_ref =
+ case bmap.navigator of
+ (Just navigator) ->
+ (Battlemap.Navigator.try_getting_path_to navigator loc_ref)
-apply_to_tile_unsafe : (
- Type ->
- Battlemap.Location.Type ->
- (Battlemap.Tile.Type -> Battlemap.Tile.Type) ->
- Type
- )
-apply_to_tile_unsafe bmap loc fun =
- let
- index = (location_to_index bmap loc)
- at_index = (Array.get index bmap.content)
- in
- case at_index of
- Nothing -> bmap
- (Just tile) ->
- {bmap |
- content =
- (Array.set
- index
- (fun tile)
- bmap.content
- )
- }
+ Nothing -> Nothing
diff --git a/elm/battlemap/src/Battlemap/Html.elm b/elm/battlemap/src/Battlemap/Html.elm
index d7cfc63..2fa6472 100644
--- a/elm/battlemap/src/Battlemap/Html.elm
+++ b/elm/battlemap/src/Battlemap/Html.elm
@@ -19,40 +19,25 @@ type alias GridBuilder =
bmap : Battlemap.Type
}
-nav_level_to_text : Battlemap.Tile.Type -> String
-nav_level_to_text t =
- case t.nav_level of
- Battlemap.Direction.Right -> "R"
- Battlemap.Direction.Left -> "L"
- Battlemap.Direction.Up -> "U"
- Battlemap.Direction.Down -> "D"
- Battlemap.Direction.None -> (toString t.floor_level)
-
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.TileSelected t.location)) ]
- [
- (Html.text
- (case t.mod_level of
- Nothing -> "[_]"
- (Just Battlemap.Tile.CanBeReached) -> "[M]"
- (Just Battlemap.Tile.CanBeAttacked) -> "[A]"
- )
- ),
- (Html.text (nav_level_to_text t))
- ]
- )
- (Just char_id) ->
- (Html.td
- [ (Html.Events.onClick (Event.CharacterSelected char_id)) ]
- [
- (Html.text ("[" ++ char_id ++ "]")),
- (Html.text (nav_level_to_text t))
- ]
- )
+ (Html.td
+ [
+ (Html.Events.onClick
+ (Battlemap.Tile.get_location t)
+ ),
+ (Html.Attribute.class (Battlemap.Tile.get_css_class t))
+ ]
+ [
+ case (Battlemap.Tile.get_character t) of
+ (Just char_id) ->
+ (Character.Html.get_icon
+ (Character.get model char_id)
+ )
+
+ Nothing -> (Html.text "") -- Meaning no element.
+ ]
+ )
foldr_to_html : Battlemap.Tile.Type -> GridBuilder -> GridBuilder
@@ -81,10 +66,11 @@ grid_builder_to_html gb =
else
((Html.tr [] gb.row) :: gb.columns)
-view : Battlemap.Type -> (Html.Html Event.Type)
-view battlemap =
+tiles_grid battlemap =
(Html.table
- []
+ [
+ (Html.Attribute.class "battlemap-tiles-grid")
+ ]
(grid_builder_to_html
(Array.foldr
(foldr_to_html)
@@ -98,3 +84,29 @@ view battlemap =
)
)
)
+
+view : Battlemap.Type -> (Html.Html Event.Type)
+view battlemap =
+ (Html.div
+ [
+ (Html.Attribute.class "battlemap-container")
+ ]
+ [
+ (Html.div
+ [
+ (Html.Attribute.class "battlemap-tiles-container")
+ ]
+ [ (tiles_grid battlemap) ]
+ ),
+ case battlemap.navigator of
+ (Just navigator) ->
+ (Html.div
+ [
+ (Html.Attribute.class "battlemap-navigator-container")
+ ]
+ [ (Battlemap.Navigator.Html.view battlemap.navigator) ]
+ )
+
+ Nothing -> (Html.text "") -- Meaning no element.
+ ]
+ )
diff --git a/elm/battlemap/src/Battlemap/Navigator.elm b/elm/battlemap/src/Battlemap/Navigator.elm
index 2c2734d..ac394b5 100644
--- a/elm/battlemap/src/Battlemap/Navigator.elm
+++ b/elm/battlemap/src/Battlemap/Navigator.elm
@@ -5,7 +5,8 @@ module Battlemap.Navigator exposing
get_current_location,
get_remaining_points,
get_range_markers,
- add_step
+ try_adding_step,
+ try_getting_path_to
)
import Dict
@@ -78,14 +79,14 @@ get_range_markers : (
)
get_range_markers navigator = (Dict.toList navigator.range_indicators)
-add_step : (
+try_adding_step : (
Type ->
Battlemap.Direction.Type ->
(Battlemap.Location.Type -> Bool) ->
(Battlemap.Location.Type -> Int) ->
(Maybe Type)
)
-add_step navigator dir can_cross cost_fun =
+try_adding_step navigator dir can_cross cost_fun =
case
(Battlemap.Navigator.Path.try_following_direction
can_cross
@@ -96,3 +97,14 @@ add_step navigator dir can_cross cost_fun =
of
(Just path) -> (Just {navigator | path = path})
Nothing -> Nothing
+
+try_getting_path_to : (
+ Type ->
+ Battlemap.Location.Ref ->
+ (Maybe (List Battlemap.Direction.Type))
+ )
+try_getting_path_to navigator loc_ref =
+ case (Dict.get loc_ref navigator.range_indicators) of
+ (Just target) ->
+ (Just (Battlemap.Navigator.RangeIndicator.get_path target))
+ Nothing -> Nothing
diff --git a/elm/battlemap/src/Battlemap/Navigator/RangeIndicator.elm b/elm/battlemap/src/Battlemap/Navigator/RangeIndicator.elm
index 9f31d49..a8cac8e 100644
--- a/elm/battlemap/src/Battlemap/Navigator/RangeIndicator.elm
+++ b/elm/battlemap/src/Battlemap/Navigator/RangeIndicator.elm
@@ -2,7 +2,8 @@ module Battlemap.Navigator.RangeIndicator exposing
(
Type,
generate,
- get_marker
+ get_marker,
+ get_path
)
import Dict
@@ -281,3 +282,6 @@ generate location dist atk_dist can_cross_fun =
get_marker : Type -> Battlemap.Marker.Type
get_marker indicator = indicator.marker
+
+get_path : Type -> (List Battlemap.Direction.Type)
+get_path indicator = indicator.path
diff --git a/elm/battlemap/src/Battlemap/Tile.elm b/elm/battlemap/src/Battlemap/Tile.elm
index e90e9bc..828fb67 100644
--- a/elm/battlemap/src/Battlemap/Tile.elm
+++ b/elm/battlemap/src/Battlemap/Tile.elm
@@ -1,27 +1,21 @@
module Battlemap.Tile exposing
(
Type,
- set_character,
- get_character,
+ get_class,
get_cost
)
import Battlemap.Location
-import Character
-
type alias Type =
{
location : Battlemap.Location.Ref,
- floor_level : Int,
- char_level : (Maybe Character.Ref)
+ class : Int,
+ crossing_cost : Int
}
-set_character : (Maybe Character.Ref) -> Type -> Type
-set_character char_ref tile = {tile | char_level = char_ref}
-
-get_character : Type -> (Maybe Character.Ref)
-get_character tile = tile.char_level
+get_class : Type -> Int
+get_class tile = tile.class
get_cost : Type -> Int
-get_cost tile = tile.floor_level
+get_cost tile = tile.crossing_cost
diff --git a/elm/battlemap/src/Model/EndTurn.elm b/elm/battlemap/src/Model/EndTurn.elm
index 788c3a1..441f3b7 100644
--- a/elm/battlemap/src/Model/EndTurn.elm
+++ b/elm/battlemap/src/Model/EndTurn.elm
@@ -14,7 +14,7 @@ make_it_so : Model.Type -> Model.Type
make_it_so model =
case model.selection of
(Model.SelectedCharacter char_id) ->
- case (Battlemap.get_navigator_location model.battlemap) of
+ case (Battlemap.try_getting_navigator_location model.battlemap) of
(Just location) ->
(Model.reset
model
diff --git a/elm/battlemap/src/Model/RequestDirection.elm b/elm/battlemap/src/Model/RequestDirection.elm
index f47a902..cf600e6 100644
--- a/elm/battlemap/src/Model/RequestDirection.elm
+++ b/elm/battlemap/src/Model/RequestDirection.elm
@@ -4,6 +4,10 @@ import Dict
import Battlemap
import Battlemap.Direction
+import Battlemap.Location
+
+
+import Character
import Model
import Error
@@ -14,17 +18,34 @@ make_it_so model dir =
(Model.SelectedCharacter char_id) ->
let
new_bmap =
- (Battlemap.add_step_to_navigator
+ (Battlemap.try_adding_step_to_navigator
model.battlemap
+ (\loc ->
+ (List.all
+ (\char ->
+ (
+ ((Character.get_ref char) == char_id)
+ ||
+ (
+ (Battlemap.Location.get_ref
+ (Character.get_location char)
+ )
+ /=
+ (Battlemap.Location.get_ref loc)
+ )
+ )
+ )
+ (Dict.values model.characters)
+ )
+ )
dir
- (Dict.values model.characters)
)
in
case new_bmap of
(Just bmap) ->
{model |
state = Model.MovingCharacterWithButtons,
- battlemap = new_bmap
+ battlemap = bmap
}
Nothing ->
diff --git a/elm/battlemap/src/Model/SelectCharacter.elm b/elm/battlemap/src/Model/SelectCharacter.elm
index 942e84d..7cc2102 100644
--- a/elm/battlemap/src/Model/SelectCharacter.elm
+++ b/elm/battlemap/src/Model/SelectCharacter.elm
@@ -7,7 +7,6 @@ import Character
import Battlemap
import Model
-import Event
import Error
make_it_so : Model.Type -> Character.Ref -> Model.Type
diff --git a/elm/battlemap/src/Model/SelectTile.elm b/elm/battlemap/src/Model/SelectTile.elm
index 9a01e77..0fe30fa 100644
--- a/elm/battlemap/src/Model/SelectTile.elm
+++ b/elm/battlemap/src/Model/SelectTile.elm
@@ -1,13 +1,8 @@
module Model.SelectTile exposing (apply_to)
-import Dict
-
-import Character
-
import Battlemap
import Battlemap.Direction
import Battlemap.Location
-import Battlemap.Tile
import Model.RequestDirection
import Model.EndTurn
@@ -17,66 +12,40 @@ import Error
autopilot : Battlemap.Direction.Type -> Model.Type -> Model.Type
autopilot dir model =
- (Update.DirectionRequest.apply_to model dir)
+ (Model.RequestDirection.apply_to model dir)
go_to_tile : Model.Type -> Battlemap.Location.Ref -> Model.Type
go_to_tile model loc_ref =
- case model.selection of
- Nothing ->
- (Model.invalidate
- model
- (Error.new
- Error.Programming
- "SelectTile: model moving char, no selection."
- )
- )
- (Just selection) ->
- case (Dict.get loc_ref selection.range_indicator) of
- Nothing -> -- Clicked outside of the range indicator
- (Model.reset model)
- (Just indicator) ->
- let
- new_model =
- (List.foldr
- (autopilot)
- {model |
- battlemap =
- (Battlemap.apply_to_all_tiles
- model.battlemap
- (Battlemap.Tile.set_direction
- Battlemap.Direction.None
- )
- ),
- selection =
- (Just
- {
- selection |
- navigator =
- (Battlemap.Navigator.reset
- selection.navigator
- )
- }
- )
- }
- indicator.path
- )
- in
- if
- (
- (model.state == Model.MovingCharacterWithClick)
- &&
- (
- (Battlemap.Location.get_ref
- selection.navigator.current_location
- )
- == loc_ref
- )
- )
- then
- (Model.EndTurn.apply_to new_model)
- else
+ case (Battlemap.try_getting_navigator_location model.battlemap) of
+ (Just nav_loc) ->
+ if (loc_ref == (Battlemap.Location.get_ref nav_loc))
+ then
+ -- We are already there.
+ if (model.state == Model.MovingCharacterWithClick)
+ then
+ -- And we just clicked on that tile.
+ (Model.EndTurn.apply_to model)
+ else
+ -- And we didn't just click on that tile.
+ {model | state = Model.MovingCharacterWithClick}
+ else
+ -- We have to try getting there.
+ case
+ (Battlemap.try_getting_navigator_path_to
+ model.battlemap
+ loc_ref
+ )
+ of
+ (Just path) ->
+ let
+ new_model = (List.foldr (autopilot) model path)
+ in
{new_model | state = Model.MovingCharacterWithClick}
+ Nothing -> -- Clicked outside of the range indicator
+ (Model.reset model model.characters)
+ Nothing -> -- Clicked outside of the range indicator
+ (Model.reset model model.characters)
apply_to : Model.Type -> Battlemap.Location.Ref -> Model.Type
apply_to model loc_ref =
diff --git a/elm/battlemap/src/Shim/Battlemap/Tile.elm b/elm/battlemap/src/Shim/Battlemap/Tile.elm
index 2335d3d..c243f0a 100644
--- a/elm/battlemap/src/Shim/Battlemap/Tile.elm
+++ b/elm/battlemap/src/Shim/Battlemap/Tile.elm
@@ -4,135 +4,44 @@ import Array
import List
import Battlemap.Location
-import Battlemap.Direction
import Battlemap.Tile
-from_int : Int -> Int -> Int -> Battlemap.Tile.Type
-from_int map_width index i =
- let
+from_int : Int -> Int -> (Int, Int) -> Battlemap.Tile.Type
+from_int map_width index (class, cost) =
+ {
location =
(Battlemap.Location.get_ref
{
x = (index % map_width),
y = (index // map_width)
}
- )
- in
- if (i >= 10)
- then
- {
- location = location,
- floor_level = (i - 10),
- char_level = (Just (toString (i - 10)))
- }
- else
- {
- location = location,
- floor_level = i,
- char_level = Nothing
- }
+ ),
+ class = class,
+ crossing_cost = cost
+ }
generate : Int -> (Array.Array Battlemap.Tile.Type)
generate map_width =
let
as_int_list =
- (
- [
- 10, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0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, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- ++ [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- ]
- )
+ [
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (1, 2), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (1, 2), (1, 2), (1, 2), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (1, 2), (1, 2), (1, 2), (1, 2), (1, 2), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (1, 2), (1, 2), (1, 2), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (1, 2), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1),
+ (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1), (2, 99), (0, 1), (0, 1), (0, 1), (0, 1), (0, 1)
+ ]
as_list = (List.indexedMap (from_int map_width) as_int_list)
in
(Array.fromList as_list)
diff --git a/elm/battlemap/src/Update.elm b/elm/battlemap/src/Update.elm
index c6146e1..1a84481 100644
--- a/elm/battlemap/src/Update.elm
+++ b/elm/battlemap/src/Update.elm
@@ -15,7 +15,7 @@ update event model =
in
case event of
(Event.DirectionRequested d) ->
- (Model.DirectionRequest.apply_to new_model d)
+ (Model.RequestDirection.apply_to new_model d)
(Event.TileSelected loc) ->
(Model.SelectTile.apply_to new_model loc)
diff --git a/elm/battlemap/src/View/Battlemap.elm b/elm/battlemap/src/View/Battlemap.elm
new file mode 100644
index 0000000..1e10a2a
--- /dev/null
+++ b/elm/battlemap/src/View/Battlemap.elm
@@ -0,0 +1,26 @@
+module View.Battlemap exposing (view)
+
+import View.Battlemap.Tile
+import View.Battlemap.Navigator
+
+view : Battlemap.Type -> (Html.Html Event.Type)
+view battlemap =
+ (Html.div
+ [
+ (Html.Attribute.class "battlemap-container")
+ ]
+ [
+ (
+ ,
+ case battlemap.navigator of
+ (Just navigator) ->
+ (Html.div
+ [
+ (Html.Attribute.class "battlemap-navigator-container")
+ ]
+ [ (Battlemap.Navigator.Html.view battlemap.navigator) ]
+ )
+
+ Nothing -> (Html.text "") -- Meaning no element.
+ ]
+ )