summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/DataSet.elm24
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm8
-rw-r--r--src/shared/battle-characters/BattleCharacters/Struct/Skill.elm8
-rw-r--r--src/shared/battle-map/BattleMap/Struct/DataSet.elm4
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Map.elm14
-rw-r--r--src/shared/battle-map/BattleMap/Struct/Tile.elm12
6 files changed, 40 insertions, 30 deletions
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/DataSet.elm b/src/shared/battle-characters/BattleCharacters/Struct/DataSet.elm
index 4e3050a..3e938a2 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/DataSet.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/DataSet.elm
@@ -75,23 +75,23 @@ type alias Type =
new : Type
new =
{
- weapons = (Dict.new),
- armors = (Dict.new),
- glyphs = (Dict.new),
- glyph_boards = (Dict.new),
- portraits = (Dict.new),
- skills = (Dict.new)
+ weapons = (Dict.empty),
+ armors = (Dict.empty),
+ glyphs = (Dict.empty),
+ glyph_boards = (Dict.empty),
+ portraits = (Dict.empty),
+ skills = (Dict.empty)
}
is_ready : Type -> Bool
is_ready data_set =
(
- (data_set.portraits /= (Dict.empty))
- && (data_set.weapons /= (Dict.empty))
- && (data_set.armors /= (Dict.empty))
- && (data_set.glyph_boards /= (Dict.empty))
- && (data_set.glyphs /= (Dict.empty))
- && (data_set.skills /= (Dict.empty))
+ (not (Dict.isEmpty data_set.portraits))
+ && (not (Dict.isEmpty data_set.weapons))
+ && (not (Dict.isEmpty data_set.armors))
+ && (not (Dict.isEmpty data_set.glyph_boards))
+ && (not (Dict.isEmpty data_set.glyphs))
+ && (not (Dict.isEmpty data_set.skills))
)
---- Accessors -----------------------------------------------------------------
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm b/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm
index 8fe92c0..66fd764 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Portrait.elm
@@ -3,7 +3,7 @@ module BattleCharacters.Struct.Portrait exposing
Type,
Ref,
find,
- default,
+ none,
get_id,
get_name,
get_body_id,
@@ -41,10 +41,10 @@ find : (Dict.Dict Ref Type) -> Ref -> Type
find dict ref =
case (Dict.get ref dict) of
(Just e) -> e
- Nothing -> default
+ Nothing -> none
-default : Type
-default =
+none : Type
+none =
{
id = "cat",
name = "Black Cat",
diff --git a/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm b/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm
index 709c17f..cc0dcae 100644
--- a/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm
+++ b/src/shared/battle-characters/BattleCharacters/Struct/Skill.elm
@@ -3,7 +3,7 @@ module BattleCharacters.Struct.Skill exposing
Type,
Ref,
find,
- default,
+ none,
get_id,
get_name,
get_cost,
@@ -54,10 +54,10 @@ find : (Dict.Dict Ref Type) -> Ref -> Type
find dict ref =
case (Dict.get ref dict) of
(Just e) -> e
- Nothing -> default
+ Nothing -> none
-default : Type
-default =
+none : Type
+none =
{
id = "",
name = "Skill Not Found",
diff --git a/src/shared/battle-map/BattleMap/Struct/DataSet.elm b/src/shared/battle-map/BattleMap/Struct/DataSet.elm
index f292443..d81daaf 100644
--- a/src/shared/battle-map/BattleMap/Struct/DataSet.elm
+++ b/src/shared/battle-map/BattleMap/Struct/DataSet.elm
@@ -31,13 +31,13 @@ type alias Type =
new : Type
new =
{
- tiles = (Dict.new)
+ tiles = (Dict.empty)
}
is_ready : Type -> Bool
is_ready data_set =
(
- (data_set.tiles /= (Dict.empty))
+ (not (Dict.isEmpty data_set.tiles))
)
---- Accessors -----------------------------------------------------------------
diff --git a/src/shared/battle-map/BattleMap/Struct/Map.elm b/src/shared/battle-map/BattleMap/Struct/Map.elm
index d2c950f..73a1cfe 100644
--- a/src/shared/battle-map/BattleMap/Struct/Map.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Map.elm
@@ -34,6 +34,7 @@ import Util.Array
import Battle.Struct.Omnimods
-- Battle Map ------------------------------------------------------------------
+import BattleMap.Struct.DataSet
import BattleMap.Struct.Location
import BattleMap.Struct.Marker
import BattleMap.Struct.Tile
@@ -183,22 +184,19 @@ solve_tiles tiles map =
get_omnimods_at : (
BattleMap.Struct.Location.Type ->
- (Dict.Dict BattleMap.Struct.Tile.Ref BattleMap.Struct.Tile.Type) ->
+ BattleMap.Struct.DataSet.Type ->
Type ->
Battle.Struct.Omnimods.Type
)
-get_omnimods_at loc tiles_solver map =
+get_omnimods_at loc dataset map =
case (try_getting_tile_at loc map) of
Nothing -> (Battle.Struct.Omnimods.none)
(Just tile_inst) ->
- case
- (Dict.get
+ (BattleMap.Struct.Tile.get_omnimods
+ (BattleMap.Struct.DataSet.get_tile
(BattleMap.Struct.TileInstance.get_class_id tile_inst)
- tiles_solver
)
- of
- Nothing -> (Battle.Struct.Omnimods.none)
- (Just tile) -> (BattleMap.Struct.Tile.get_omnimods tile)
+ )
decoder : (Json.Decode.Decoder Type)
decoder =
diff --git a/src/shared/battle-map/BattleMap/Struct/Tile.elm b/src/shared/battle-map/BattleMap/Struct/Tile.elm
index 9145b44..53ec2e1 100644
--- a/src/shared/battle-map/BattleMap/Struct/Tile.elm
+++ b/src/shared/battle-map/BattleMap/Struct/Tile.elm
@@ -9,6 +9,7 @@ module BattleMap.Struct.Tile exposing
get_cost,
get_omnimods,
get_family,
+ none,
decoder
)
@@ -75,3 +76,14 @@ decoder =
|> (Json.Decode.Pipeline.required "de" Json.Decode.int)
|> (Json.Decode.Pipeline.required "omni" Battle.Struct.Omnimods.decoder)
)
+
+none : Type
+none =
+ {
+ id = "-1",
+ name = "Not Found",
+ crossing_cost = 999,
+ family = "-1",
+ depth = 0,
+ omnimods = (Battle.Struct.Omnimods.none)
+ }