aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'elm/battlemap/src/Model.elm')
-rw-r--r--elm/battlemap/src/Model.elm35
1 files changed, 12 insertions, 23 deletions
diff --git a/elm/battlemap/src/Model.elm b/elm/battlemap/src/Model.elm
index 437d118..80a4c2e 100644
--- a/elm/battlemap/src/Model.elm
+++ b/elm/battlemap/src/Model.elm
@@ -1,7 +1,7 @@
module Model exposing
(
Type,
- CharacterSelection,
+ Selection(..),
State(..),
get_state,
invalidate,
@@ -12,55 +12,44 @@ module Model exposing
import Dict
import Battlemap
-import Battlemap.Navigator
import Battlemap.Location
import Battlemap.Tile
-import Battlemap.RangeIndicator
import Error
import Character
-type alias CharacterSelection =
- {
- character: Character.Ref,
- navigator: Battlemap.Navigator.Type,
- range_indicator:
- (Dict.Dict
- Battlemap.Location.Ref
- Battlemap.RangeIndicator.Type
- )
- }
-
type State =
Default
| MovingCharacterWithButtons
| MovingCharacterWithClick
| FocusingTile
+type Selection =
+ None
+ | SelectedCharacter Character.Ref
+ | SelectedTile Battlemap.Location.Ref
+
type alias Type =
{
state: State,
battlemap: Battlemap.Type,
characters: (Dict.Dict Character.Ref Character.Type),
error: (Maybe Error.Type),
- selection: (Maybe CharacterSelection)
+ selection: Selection
}
get_state : Type -> State
get_state model = model.state
-reset : Type -> Type
-reset model =
+reset : Type -> (Dict.Dict Character.Ref Character.Type) -> Type
+reset model characters =
{model |
state = Default,
- selection = Nothing,
+ battlemap = (Battlemap.reset model.battlemap),
+ characters = characters,
error = Nothing,
- battlemap =
- (Battlemap.apply_to_all_tiles
- model.battlemap
- (Battlemap.Tile.reset)
- )
+ selection = None
}
invalidate : Type -> Error.Type -> Type