aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2017-12-05 15:30:20 +0100
committernsensfel <SpamShield0@noot-noot.org>2017-12-05 15:30:20 +0100
commitdc0d49ee836f89161412bc0939f2fbc1e68a7588 (patch)
tree762e0351e4d2a299b100a22f7a96b641cf9b147e /src/battlemap/src/ElmModule/Update.elm
parentc5578c282d0737c4616adcc87132b7f099e1ac0c (diff)
downloadtacticians-client-dc0d49ee836f89161412bc0939f2fbc1e68a7588.zip
tacticians-client-dc0d49ee836f89161412bc0939f2fbc1e68a7588.tar.bz2
Trying to figure out how to organize the code...
Diffstat (limited to 'src/battlemap/src/ElmModule/Update.elm')
-rw-r--r--src/battlemap/src/ElmModule/Update.elm55
1 files changed, 55 insertions, 0 deletions
diff --git a/src/battlemap/src/ElmModule/Update.elm b/src/battlemap/src/ElmModule/Update.elm
new file mode 100644
index 0000000..947b232
--- /dev/null
+++ b/src/battlemap/src/ElmModule/Update.elm
@@ -0,0 +1,55 @@
+module ElmModule.Update exposing (update)
+
+-- Elm -------------------------------------------------------------------------
+
+-- Battlemap -------------------------------------------------------------------
+import Struct.Event
+import Struct.Error
+import Struct.UI
+import Struct.Model
+
+import Update.RequestDirection
+import Update.SelectTile
+import Update.SelectCharacter
+import Update.EndTurn
+import Update.HandleServerReply
+
+import Send.LoadBattlemap
+
+update : (
+ Struct.Event.Type ->
+ Struct.Model.Type ->
+ (Struct.Model.Type, (Cmd Struct.Event.Type))
+ )
+update event model =
+ let
+ new_model = (Struct.Model.clear_error model)
+ in
+ case event of
+ (Struct.Event.DirectionRequested d) ->
+ (Update.RequestDirection.apply_to new_model d)
+
+ (Struct.Event.TileSelected loc) ->
+ (Update.SelectTile.apply_to new_model loc)
+
+ (Struct.Event.CharacterSelected char_id) ->
+ (Update.SelectCharacter.apply_to new_model char_id)
+
+ Struct.Event.TurnEnded ->
+ (Update.EndTurn.apply_to new_model)
+
+ (Struct.Event.ScaleChangeRequested mod) ->
+ (Update.ChangeScale.apply_to new_model mod)
+
+ (Struct.Event.TabSelected tab) ->
+ (Update.SelectTab.apply_to new_model mod)
+
+ Struct.Event.DebugTeamSwitchRequest ->
+ (Update.SwitchTeam.apply_to new_model)
+
+ (Event.DebugLoadBattlemapRequest) ->
+ (Update.SendLoadBattlemapRequest.apply_to new_model)
+
+ (Event.ServerReplied result) ->
+ (Model.HandleServerReply.apply_to model result)
+