summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2017-10-18 13:48:58 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2017-10-18 13:48:58 +0200 |
commit | 2805c647010cbcca126ebf162fcbdd691fc72488 (patch) | |
tree | 2e05d66c8177cc5ff5125e2cbc23fdd4b1d05e36 /elm/battlemap/src/Battlemap/Navigator.elm | |
parent | d0dc7f665ba90d126e41048b2d7b992c3e804163 (diff) |
Correcting whatever the compiler tells me is wrong.
Diffstat (limited to 'elm/battlemap/src/Battlemap/Navigator.elm')
-rw-r--r-- | elm/battlemap/src/Battlemap/Navigator.elm | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/elm/battlemap/src/Battlemap/Navigator.elm b/elm/battlemap/src/Battlemap/Navigator.elm index 2c2734d..ac394b5 100644 --- a/elm/battlemap/src/Battlemap/Navigator.elm +++ b/elm/battlemap/src/Battlemap/Navigator.elm @@ -5,7 +5,8 @@ module Battlemap.Navigator exposing get_current_location, get_remaining_points, get_range_markers, - add_step + try_adding_step, + try_getting_path_to ) import Dict @@ -78,14 +79,14 @@ get_range_markers : ( ) get_range_markers navigator = (Dict.toList navigator.range_indicators) -add_step : ( +try_adding_step : ( Type -> Battlemap.Direction.Type -> (Battlemap.Location.Type -> Bool) -> (Battlemap.Location.Type -> Int) -> (Maybe Type) ) -add_step navigator dir can_cross cost_fun = +try_adding_step navigator dir can_cross cost_fun = case (Battlemap.Navigator.Path.try_following_direction can_cross @@ -96,3 +97,14 @@ add_step navigator dir can_cross cost_fun = of (Just path) -> (Just {navigator | path = path}) Nothing -> Nothing + +try_getting_path_to : ( + Type -> + Battlemap.Location.Ref -> + (Maybe (List Battlemap.Direction.Type)) + ) +try_getting_path_to navigator loc_ref = + case (Dict.get loc_ref navigator.range_indicators) of + (Just target) -> + (Just (Battlemap.Navigator.RangeIndicator.get_path target)) + Nothing -> Nothing |