| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-03-15 23:10:22 +0100 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2019-03-15 23:10:22 +0100 | 
| commit | a3c380b2813c9928a2ee600c276295c7803e9e66 (patch) | |
| tree | 825d2ce62f4bb223bd26e9441f266a29fa61f0d0 /src/shared/battle-map/BattleMap/Struct/Location.elm | |
| parent | 0a2aa713a3e9babfeab8be394cd7066265184458 (diff) | |
Got everything to compile again.
Diffstat (limited to 'src/shared/battle-map/BattleMap/Struct/Location.elm')
| -rw-r--r-- | src/shared/battle-map/BattleMap/Struct/Location.elm | 31 | 
1 files changed, 31 insertions, 0 deletions
| diff --git a/src/shared/battle-map/BattleMap/Struct/Location.elm b/src/shared/battle-map/BattleMap/Struct/Location.elm index 3443150..da3b8ef 100644 --- a/src/shared/battle-map/BattleMap/Struct/Location.elm +++ b/src/shared/battle-map/BattleMap/Struct/Location.elm @@ -27,6 +27,13 @@ type alias Ref = (Int, Int)  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- +new : Int -> Int -> Type +new x y = +   { +      x = x, +      y = y +   } +  neighbor : BattleMap.Struct.Direction.Type -> Type -> Type  neighbor dir loc =     case dir of @@ -68,3 +75,27 @@ encode loc =           ( "y", (Json.Encode.int loc.y) )        ]     ) + +neighbors : Type -> (List Type) +neighbors loc = +   [ +      {loc | x = (loc.x + 1)}, +      {loc | x = (loc.x - 1)}, +      {loc | y = (loc.y - 1)}, +      {loc | y = (loc.y + 1)} +   ] + +get_full_neighborhood : Type -> (List Type) +get_full_neighborhood loc = +   [ +      {loc | x = (loc.x - 1), y = (loc.y - 1)}, +      {loc | y = (loc.y - 1)}, +      {loc | x = (loc.x + 1), y = (loc.y - 1)}, +      {loc | x = (loc.x - 1)}, +      {loc | x = (loc.x + 1)}, +      {loc | x = (loc.x - 1), y = (loc.y + 1)}, +      {loc | y = (loc.y + 1)}, +      {loc | x = (loc.x + 1), y = (loc.y + 1)} +   ] + + | 


