| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2017-10-20 16:36:31 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2017-10-20 16:36:31 +0200 | 
| commit | 090560af836c645f509fd1fa22fd401b0d85f0e4 (patch) | |
| tree | 8aa4c3b9761e03a327e40f8771fef3f01ab85b0c | |
| parent | c185856591d072479333693abdc18968139f639b (diff) | |
Fixes being able to leave the map.
No idea how it still worked when the characters where outside the map...
| -rw-r--r-- | src/battlemap/src/Battlemap.elm | 34 | 
1 files changed, 20 insertions, 14 deletions
| diff --git a/src/battlemap/src/Battlemap.elm b/src/battlemap/src/Battlemap.elm index a3a0c76..c524576 100644 --- a/src/battlemap/src/Battlemap.elm +++ b/src/battlemap/src/Battlemap.elm @@ -67,20 +67,26 @@ tile_cost_function bmap start_loc char_list loc =     then        0     else -      case -         (Array.get (location_to_index bmap loc) bmap.content) -      of -         (Just tile) -> -            if -               (List.any -                  (\c -> ((Character.get_location c) == loc)) -                  char_list -               ) -            then -               Constants.Movement.cost_when_occupied_tile -            else -               (Battlemap.Tile.get_cost tile) -         Nothing -> Constants.Movement.cost_when_out_of_bounds +      if (has_location bmap loc) +      then +         case +            (Array.get (location_to_index bmap loc) bmap.content) +         of +            (Just tile) -> +               if +                  (List.any +                     (\c -> ((Character.get_location c) == loc)) +                     char_list +                  ) +               then +                  Constants.Movement.cost_when_occupied_tile +               else +                  (Battlemap.Tile.get_cost tile) + +            Nothing -> Constants.Movement.cost_when_out_of_bounds +      else +         Constants.Movement.cost_when_out_of_bounds +  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- | 


