summaryrefslogtreecommitdiff
blob: 86b9c6e9e4f4cbf9ba0ec654fdc535cacead02ca (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module Update exposing (..)

import Model exposing (Model, model)

import Battlemap.Direction exposing (..)

import Battlemap.Navigator as Nr exposing (go)

type Msg = DirectionRequest Direction | None

update : Msg -> Model -> Model
update msg model =
   case msg of
      (DirectionRequest d) ->
         (case model.navigator of
            Nothing -> model
            (Just nav) ->
               let
                  (new_bmap, new_nav) =
                     (Nr.go
                        model.battlemap
                        nav
                        d
                     )
               in
                  {model |
                     battlemap = new_bmap,
                     navigator = (Just new_nav)
                  }
         )
      _ -> model