summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-06-16 00:26:23 +0200
committernsensfel <SpamShield0@noot-noot.org>2018-06-16 00:26:23 +0200
commitcb496ae0c7e163721e103d9b6a6f801013d82066 (patch)
treeef60d4342912fdfc41437e0839d55bb003209425 /src/battlemap/src/View/SubMenu/Timeline
parent748650edc79e8dc24e7cc7a9a2402390de0b5ba1 (diff)
characters as array, took a shot at optimization.
Diffstat (limited to 'src/battlemap/src/View/SubMenu/Timeline')
-rw-r--r--src/battlemap/src/View/SubMenu/Timeline/Attack.elm15
-rw-r--r--src/battlemap/src/View/SubMenu/Timeline/Movement.elm11
-rw-r--r--src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm11
3 files changed, 20 insertions, 17 deletions
diff --git a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm
index 3330007..974867e 100644
--- a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm
+++ b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm
@@ -1,7 +1,7 @@
module View.SubMenu.Timeline.Attack exposing (get_html)
-- Elm -------------------------------------------------------------------------
-import Dict
+import Array
import Html
import Html.Attributes
@@ -121,15 +121,16 @@ get_attack_html attacker defender attack =
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Struct.Model.Type ->
+ (Array.Array Struct.Character.Type) ->
+ String ->
Struct.TurnResult.Attack ->
(Html.Html Struct.Event.Type)
)
-get_html model attack =
+get_html characters player_id attack =
case
(
- (Dict.get (toString attack.attacker_index) model.characters),
- (Dict.get (toString attack.defender_index) model.characters)
+ (Array.get attack.attacker_index characters),
+ (Array.get attack.defender_index characters)
)
of
((Just atkchar), (Just defchar)) ->
@@ -140,8 +141,8 @@ get_html model attack =
]
(
[
- (View.Character.get_portrait_html model.player_id atkchar),
- (View.Character.get_portrait_html model.player_id defchar),
+ (View.Character.get_portrait_html player_id atkchar),
+ (View.Character.get_portrait_html player_id defchar),
(get_title_html atkchar defchar)
]
++
diff --git a/src/battlemap/src/View/SubMenu/Timeline/Movement.elm b/src/battlemap/src/View/SubMenu/Timeline/Movement.elm
index bba9bc1..afc4055 100644
--- a/src/battlemap/src/View/SubMenu/Timeline/Movement.elm
+++ b/src/battlemap/src/View/SubMenu/Timeline/Movement.elm
@@ -1,7 +1,7 @@
module View.SubMenu.Timeline.Movement exposing (get_html)
-- Elm -------------------------------------------------------------------------
-import Dict
+import Array
import Html
import Html.Attributes
@@ -23,12 +23,13 @@ import View.Character
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Struct.Model.Type ->
+ (Array.Array Struct.Character.Type) ->
+ String ->
Struct.TurnResult.Movement ->
(Html.Html Struct.Event.Type)
)
-get_html model movement =
- case (Dict.get (toString movement.character_index) model.characters) of
+get_html characters player_id movement =
+ case (Array.get movement.character_index characters) of
(Just char) ->
(Html.div
[
@@ -36,7 +37,7 @@ get_html model movement =
(Html.Attributes.class "battlemap-timeline-movement")
]
[
- (View.Character.get_portrait_html model.player_id char),
+ (View.Character.get_portrait_html player_id char),
(Html.text
(
(Struct.Character.get_name char)
diff --git a/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm b/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm
index 53122ad..21d07e6 100644
--- a/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm
+++ b/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm
@@ -1,7 +1,7 @@
module View.SubMenu.Timeline.WeaponSwitch exposing (get_html)
-- Elm -------------------------------------------------------------------------
-import Dict
+import Array
import Html
import Html.Attributes
@@ -23,12 +23,13 @@ import View.Character
-- EXPORTED --------------------------------------------------------------------
--------------------------------------------------------------------------------
get_html : (
- Struct.Model.Type ->
+ (Array.Array Struct.Character.Type) ->
+ String ->
Struct.TurnResult.WeaponSwitch ->
(Html.Html Struct.Event.Type)
)
-get_html model weapon_switch =
- case (Dict.get (toString weapon_switch.character_index) model.characters) of
+get_html characters player_id weapon_switch =
+ case (Array.get weapon_switch.character_index characters) of
(Just char) ->
(Html.div
[
@@ -36,7 +37,7 @@ get_html model weapon_switch =
(Html.Attributes.class "battlemap-timeline-weapon-switch")
]
[
- (View.Character.get_portrait_html model.player_id char),
+ (View.Character.get_portrait_html player_id char),
(Html.text
(
(Struct.Character.get_name char)