| summaryrefslogtreecommitdiff | 
diff options
Diffstat (limited to 'elm/battlemap/src/Update/EndTurn.elm')
| -rw-r--r-- | elm/battlemap/src/Update/EndTurn.elm | 30 | 
1 files changed, 25 insertions, 5 deletions
| diff --git a/elm/battlemap/src/Update/EndTurn.elm b/elm/battlemap/src/Update/EndTurn.elm index b8b4ee5..ce9da28 100644 --- a/elm/battlemap/src/Update/EndTurn.elm +++ b/elm/battlemap/src/Update/EndTurn.elm @@ -14,10 +14,24 @@ import Error  make_it_so : Model.Type -> Model.Type  make_it_so model =     case model.selection of -      Nothing -> {model | state = (Model.Error Error.Programming)} +      Nothing -> +         (Model.invalidate +            model +            (Error.new +               Error.Programming +               "EndTurn: model moving char, no selection." +            ) +         )        (Just selection) ->           case (Dict.get selection.character model.characters) of -            Nothing -> {model | state = (Model.Error Error.Programming)} +            Nothing -> +               (Model.invalidate +                  model +                  (Error.new +                     Error.Programming +                     "EndTurn: model moving char, unknown char selected." +                  ) +               )              (Just char) ->                 {model |                    state = Model.Default, @@ -54,8 +68,14 @@ make_it_so model =  apply_to : Model.Type -> Model.Type  apply_to model = -   case model.state of +   case (Model.get_state model) of        Model.MovingCharacterWithButtons -> (make_it_so model)        Model.MovingCharacterWithClick -> (make_it_so model) -      _ -> {model | state = (Model.Error Error.IllegalAction)} - +      _ -> +         (Model.invalidate +            model +            (Error.new +               Error.IllegalAction +               "This can only be done while moving a character." +            ) +         ) | 


