| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-09-22 14:35:25 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2017-09-22 14:35:25 +0200 | 
| commit | 16abf2b1e598cb89a1d4251c2313e6f2e165f7da (patch) | |
| tree | 403fcc9802772a54fe006f883addd4a8b3b49d16 /client/elm/battlemap/src/Update/DirectionRequest.elm | |
| parent | 2d20dc042a386bc9f66bc5f535403227f9acf1b1 (diff) | |
Clears up Update.elm a bit.
Diffstat (limited to 'client/elm/battlemap/src/Update/DirectionRequest.elm')
| -rw-r--r-- | client/elm/battlemap/src/Update/DirectionRequest.elm | 28 | 
1 files changed, 28 insertions, 0 deletions
| diff --git a/client/elm/battlemap/src/Update/DirectionRequest.elm b/client/elm/battlemap/src/Update/DirectionRequest.elm new file mode 100644 index 0000000..6f30866 --- /dev/null +++ b/client/elm/battlemap/src/Update/DirectionRequest.elm @@ -0,0 +1,28 @@ +module Update.DirectionRequest exposing (apply_to) + +import Dict + +import Battlemap.Direction +import Battlemap.Navigator + +import Model + +apply_to : Model.Type -> Battlemap.Direction.Type -> Model.Type +apply_to model dir = +   case (model.selection, model.navigator) of +      (Nothing, _) -> model +      (_ , Nothing) -> model +      ((Just char_id), (Just nav)) -> +         let +            (new_bmap, new_nav) = +               (Battlemap.Navigator.go +                  model.battlemap +                  nav +                  dir +                  (Dict.values model.characters) +               ) +         in +            {model | +               battlemap = new_bmap, +               navigator = (Just new_nav) +            } | 


