| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-07-02 18:06:33 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-07-02 18:06:33 +0200 | 
| commit | b985839577086b75a76d6e4647e806948af1fde8 (patch) | |
| tree | 3c0cbffde61b2fb5258f1ccf6bbcc54385203a9f /src | |
| parent | e045bdeec5ad17f43fbab7bde0ffe588dc0b90f0 (diff) | |
Separates player ID and player IX.
Diffstat (limited to 'src')
18 files changed, 69 insertions, 67 deletions
| diff --git a/src/battlemap/src/ElmModule/View.elm b/src/battlemap/src/ElmModule/View.elm index 8dd4eac..49b88fe 100644 --- a/src/battlemap/src/ElmModule/View.elm +++ b/src/battlemap/src/ElmModule/View.elm @@ -35,7 +35,7 @@ view model =           (Html.Lazy.lazy2              (View.Controlled.get_html)              model.char_turn -            model.player_id +            model.player_ix           ),           (Html.div              [ diff --git a/src/battlemap/src/Struct/Character.elm b/src/battlemap/src/Struct/Character.elm index eab7b62..db84ce9 100644 --- a/src/battlemap/src/Struct/Character.elm +++ b/src/battlemap/src/Struct/Character.elm @@ -3,7 +3,7 @@ module Struct.Character exposing        Type,        Rank(..),        get_index, -      get_player_id, +      get_player_ix,        get_name,        get_rank,        get_icon_id, @@ -50,7 +50,7 @@ type alias PartiallyDecoded =        prt : String,        lc : Struct.Location.Type,        hea : Int, -      pla : String, +      pla : Int,        ena : Bool,        att : Struct.Attributes.Type,        awp : Int, @@ -72,7 +72,7 @@ type alias Type =        portrait : String,        location : Struct.Location.Type,        health : Int, -      player_id : String, +      player_ix : Int,        enabled : Bool,        attributes : Struct.Attributes.Type,        statistics : Struct.Statistics.Type, @@ -106,7 +106,7 @@ finish_decoding add_char =              health = add_char.hea,              attributes = add_char.att,              statistics = (Struct.Statistics.new add_char.att weapon_set armor), -            player_id = add_char.pla, +            player_ix = add_char.pla,              enabled = add_char.ena,              weapons = weapon_set,              armor = armor @@ -126,8 +126,8 @@ get_name c = c.name  get_rank : Type -> Rank  get_rank c = c.rank -get_player_id : Type -> String -get_player_id c = c.player_id +get_player_ix : Type -> Int +get_player_ix c = c.player_ix  get_icon_id : Type -> String  get_icon_id c = c.icon @@ -199,7 +199,7 @@ decoder =           |> (Json.Decode.Pipeline.required "prt" Json.Decode.string)           |> (Json.Decode.Pipeline.required "lc" (Struct.Location.decoder))           |> (Json.Decode.Pipeline.required "hea" Json.Decode.int) -         |> (Json.Decode.Pipeline.required "pla" Json.Decode.string) +         |> (Json.Decode.Pipeline.required "pla" Json.Decode.int)           |> (Json.Decode.Pipeline.required "ena" Json.Decode.bool)           |> (Json.Decode.Pipeline.required "att" (Struct.Attributes.decoder))           |> (Json.Decode.Pipeline.required "awp" Json.Decode.int) diff --git a/src/battlemap/src/Struct/Model.elm b/src/battlemap/src/Struct/Model.elm index ecb3a70..71a13b0 100644 --- a/src/battlemap/src/Struct/Model.elm +++ b/src/battlemap/src/Struct/Model.elm @@ -49,6 +49,7 @@ type alias Type =        tiles: (Dict.Dict Struct.Tile.Ref Struct.Tile.Type),        error: (Maybe Struct.Error.Type),        player_id: String, +      player_ix: Int,        ui: Struct.UI.Type,        char_turn: Struct.CharacterTurn.Type,        timeline: (Array.Array Struct.TurnResult.Type) @@ -72,6 +73,7 @@ new =        tiles = (Dict.empty),        error = Nothing,        player_id = "0", +      player_ix = 0,        ui = (Struct.UI.default),        char_turn = (Struct.CharacterTurn.new),        timeline = (Array.empty) diff --git a/src/battlemap/src/Update/SwitchTeam.elm b/src/battlemap/src/Update/SwitchTeam.elm index 355ff3c..d9c9879 100644 --- a/src/battlemap/src/Update/SwitchTeam.elm +++ b/src/battlemap/src/Update/SwitchTeam.elm @@ -17,14 +17,14 @@ apply_to : (        (Struct.Model.Type, (Cmd Struct.Event.Type))     )  apply_to model = -   if (model.player_id == "0") +   if (model.player_ix == 0)     then        ( -         (Struct.Model.reset {model | player_id = "1"}), +         (Struct.Model.reset {model | player_id = "1", player_ix = 1}),           Cmd.none        )     else        ( -         (Struct.Model.reset {model | player_id = "0"}), +         (Struct.Model.reset {model | player_id = "0", player_ix = 0}),           Cmd.none        ) diff --git a/src/battlemap/src/View/Battlemap/Character.elm b/src/battlemap/src/View/Battlemap/Character.elm index 68b6137..e16325e 100644 --- a/src/battlemap/src/View/Battlemap/Character.elm +++ b/src/battlemap/src/View/Battlemap/Character.elm @@ -74,7 +74,7 @@ get_alliance_class : (        (Html.Attribute Struct.Event.Type)     )  get_alliance_class model char = -   if ((Struct.Character.get_player_id char) == model.player_id) +   if ((Struct.Character.get_player_ix char) == model.player_ix)     then        (Html.Attributes.class "battlemap-character-ally")     else @@ -127,7 +127,7 @@ get_body_html char =           (Html.Attributes.class              (                 "asset-character-team-body-" -               ++ (Struct.Character.get_player_id char) +               ++ (toString (Struct.Character.get_player_ix char))              )           )        ] diff --git a/src/battlemap/src/View/Character.elm b/src/battlemap/src/View/Character.elm index d7bcfef..838aac4 100644 --- a/src/battlemap/src/View/Character.elm +++ b/src/battlemap/src/View/Character.elm @@ -41,7 +41,7 @@ get_alliance_class : (        (Html.Attribute Struct.Event.Type)     )  get_alliance_class model char = -   if ((Struct.Character.get_player_id char) == model.player_id) +   if ((Struct.Character.get_player_ix char) == model.player_ix)     then        (Html.Attributes.class "battlemap-character-ally")     else @@ -94,7 +94,7 @@ get_icon_body_html char =           (Html.Attributes.class              (                 "asset-character-team-body-" -               ++ (Struct.Character.get_player_id char) +               ++ (toString (Struct.Character.get_player_ix char))              )           )        ] @@ -183,16 +183,16 @@ get_portrait_armor_html char =  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_portrait_html : ( -      String -> +      Int ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_portrait_html viewer_id char = +get_portrait_html viewer_ix char =     (Html.div        [           (Html.Attributes.class              ( -               if ((Struct.Character.get_player_id char) == viewer_id) +               if ((Struct.Character.get_player_ix char) == viewer_ix)                 then                    "battlemap-character-ally"                 else @@ -204,7 +204,7 @@ get_portrait_html viewer_id char =              (                 "battlemap-character-portrait-team-"                 ++ -               (Struct.Character.get_player_id char) +               (toString (Struct.Character.get_player_ix char))              )           ),           (Html.Events.onClick diff --git a/src/battlemap/src/View/Controlled.elm b/src/battlemap/src/View/Controlled.elm index 6116970..8a36fb8 100644 --- a/src/battlemap/src/View/Controlled.elm +++ b/src/battlemap/src/View/Controlled.elm @@ -97,8 +97,8 @@ get_available_actions char_turn =  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- -get_html : Struct.CharacterTurn.Type -> String -> (Html.Html Struct.Event.Type) -get_html char_turn player_id = +get_html : Struct.CharacterTurn.Type -> Int -> (Html.Html Struct.Event.Type) +get_html char_turn player_ix =     case        (Struct.CharacterTurn.try_getting_active_character char_turn)     of @@ -108,7 +108,7 @@ get_html char_turn player_id =              [                 (View.Controlled.CharacterCard.get_summary_html                    char_turn -                  player_id +                  player_ix                    char                 ),                 ( diff --git a/src/battlemap/src/View/Controlled/CharacterCard.elm b/src/battlemap/src/View/Controlled/CharacterCard.elm index 28a507f..a6d6bb0 100644 --- a/src/battlemap/src/View/Controlled/CharacterCard.elm +++ b/src/battlemap/src/View/Controlled/CharacterCard.elm @@ -429,11 +429,11 @@ get_attributes char weapon armor =  -- EXPORTED --------------------------------------------------------------------  --------------------------------------------------------------------------------  get_minimal_html : ( -      String -> +      Int ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_minimal_html player_id char = +get_minimal_html player_ix char =     (Html.div        [           (Html.Attributes.class "battlemap-character-card"), @@ -446,7 +446,7 @@ get_minimal_html player_id char =                 (Html.Attributes.class "battlemap-character-card-top")              ]              [ -               (View.Character.get_portrait_html player_id char), +               (View.Character.get_portrait_html player_ix char),                 (get_health_bar char),                 (get_inactive_movement_bar char)              ] @@ -456,11 +456,11 @@ get_minimal_html player_id char =  get_summary_html : (        Struct.CharacterTurn.Type -> -      String -> +      Int ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_summary_html char_turn player_id char = +get_summary_html char_turn player_ix char =     let        weapon_set = (Struct.Character.get_weapons char)        main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set) @@ -478,7 +478,7 @@ get_summary_html char_turn player_id char =                    (Html.Attributes.class "battlemap-character-card-top")                 ]                 [ -                  (View.Character.get_portrait_html player_id char), +                  (View.Character.get_portrait_html player_ix char),                    (get_health_bar char),                    (get_movement_bar char_turn char)                 ] @@ -491,11 +491,11 @@ get_summary_html char_turn player_id char =        )  get_full_html : ( -      String -> +      Int ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_full_html player_id char = +get_full_html player_ix char =     let        weapon_set = (Struct.Character.get_weapons char)        main_weapon = (Struct.WeaponSet.get_active_weapon weapon_set) @@ -514,7 +514,7 @@ get_full_html player_id char =                    (Html.Attributes.class "battlemap-character-card-top")                 ]                 [ -                  (View.Character.get_portrait_html player_id char), +                  (View.Character.get_portrait_html player_ix char),                    (get_health_bar char),                    (get_inactive_movement_bar char)                 ] diff --git a/src/battlemap/src/View/Controlled/Targets.elm b/src/battlemap/src/View/Controlled/Targets.elm index b851555..5a7c605 100644 --- a/src/battlemap/src/View/Controlled/Targets.elm +++ b/src/battlemap/src/View/Controlled/Targets.elm @@ -30,7 +30,7 @@ get_target_info_html model char_ref =                 "Attacking "                 ++ char.name                 ++ " (player " -               ++ (Struct.Character.get_player_id char) +               ++ (toString (Struct.Character.get_player_ix char))                 ++ "): "                 ++                 (toString diff --git a/src/battlemap/src/View/MessageBoard/Animator/Attack.elm b/src/battlemap/src/View/MessageBoard/Animator/Attack.elm index c640979..211ada4 100644 --- a/src/battlemap/src/View/MessageBoard/Animator/Attack.elm +++ b/src/battlemap/src/View/MessageBoard/Animator/Attack.elm @@ -184,7 +184,7 @@ get_attacker_card maybe_attack char =        )        [           (View.Controlled.CharacterCard.get_minimal_html -            (Struct.Character.get_player_id char) +            (Struct.Character.get_player_ix char)              char           )        ] @@ -231,7 +231,7 @@ get_defender_card maybe_attack char =              ]        )        [ -         (View.Controlled.CharacterCard.get_minimal_html "" char) +         (View.Controlled.CharacterCard.get_minimal_html -1 char)        ]     ) diff --git a/src/battlemap/src/View/SubMenu.elm b/src/battlemap/src/View/SubMenu.elm index 9e87b6e..8537452 100644 --- a/src/battlemap/src/View/SubMenu.elm +++ b/src/battlemap/src/View/SubMenu.elm @@ -39,7 +39,7 @@ get_inner_html model tab =           (Html.Lazy.lazy2              (View.SubMenu.Characters.get_html)              model.characters -            model.player_id +            model.player_ix           )        Struct.UI.SettingsTab -> @@ -72,7 +72,7 @@ get_html model =                             (Html.Lazy.lazy3                                (View.Controlled.CharacterCard.get_summary_html)                                model.char_turn -                              model.player_id +                              model.player_ix                                char                             )                          ] diff --git a/src/battlemap/src/View/SubMenu/Characters.elm b/src/battlemap/src/View/SubMenu/Characters.elm index 31819e5..be5bac4 100644 --- a/src/battlemap/src/View/SubMenu/Characters.elm +++ b/src/battlemap/src/View/SubMenu/Characters.elm @@ -17,11 +17,11 @@ import View.Controlled.CharacterCard  -- LOCAL -----------------------------------------------------------------------  --------------------------------------------------------------------------------  get_character_element_html : ( -      String -> +      Int ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_character_element_html player_id char = +get_character_element_html player_ix char =     (Html.div        [           (Html.Attributes.class "battlemap-characters-element"), @@ -44,7 +44,7 @@ get_character_element_html player_id char =           )        ]        [ -         (View.Controlled.CharacterCard.get_minimal_html player_id char) +         (View.Controlled.CharacterCard.get_minimal_html player_ix char)        ]     ) @@ -53,17 +53,17 @@ get_character_element_html player_id char =  --------------------------------------------------------------------------------  get_html : (        (Array.Array Struct.Character.Type) -> -      String -> +      Int ->        (Html.Html Struct.Event.Type)     ) -get_html characters player_id = +get_html characters player_ix =     (Html.div        [           (Html.Attributes.class "battlemap-tabmenu-content"),           (Html.Attributes.class "battlemap-tabmenu-characters-tab")        ]        (List.map -         (get_character_element_html player_id) +         (get_character_element_html player_ix)           (Array.toList characters)        )     ) diff --git a/src/battlemap/src/View/SubMenu/Status.elm b/src/battlemap/src/View/SubMenu/Status.elm index c64bc2d..f67c85e 100644 --- a/src/battlemap/src/View/SubMenu/Status.elm +++ b/src/battlemap/src/View/SubMenu/Status.elm @@ -42,7 +42,7 @@ get_html model =                    (Just char) ->                       (Html.Lazy.lazy2                          (View.SubMenu.Status.CharacterInfo.get_html) -                        model.player_id +                        model.player_ix                          char                       ) diff --git a/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm b/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm index cbe776a..a927158 100644 --- a/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm +++ b/src/battlemap/src/View/SubMenu/Status/CharacterInfo.elm @@ -17,18 +17,18 @@ import View.Controlled.CharacterCard  --------------------------------------------------------------------------------  -- EXPORTED --------------------------------------------------------------------  -------------------------------------------------------------------------------- -get_html: ( -      String -> +get_html : ( +      Int ->        Struct.Character.Type ->        (Html.Html Struct.Event.Type)     ) -get_html player_id char = +get_html player_ix char =     (Html.div        [           (Html.Attributes.class "battlemap-tabmenu-character-info")        ]        [           (Html.text ("Focusing:")), -         (View.Controlled.CharacterCard.get_full_html player_id char) +         (View.Controlled.CharacterCard.get_full_html player_ix char)        ]     ) diff --git a/src/battlemap/src/View/SubMenu/Timeline.elm b/src/battlemap/src/View/SubMenu/Timeline.elm index 5677da7..e6a449f 100644 --- a/src/battlemap/src/View/SubMenu/Timeline.elm +++ b/src/battlemap/src/View/SubMenu/Timeline.elm @@ -26,30 +26,30 @@ import View.SubMenu.Timeline.PlayerTurnStart  --------------------------------------------------------------------------------  get_turn_result_html : (        (Array.Array Struct.Character.Type) -> -      String -> +      Int ->        Struct.TurnResult.Type ->        (Html.Html Struct.Event.Type)     ) -get_turn_result_html characters player_id turn_result = +get_turn_result_html characters player_ix turn_result =     case turn_result of        (Struct.TurnResult.Moved movement) ->           (View.SubMenu.Timeline.Movement.get_html              characters -            player_id +            player_ix              movement           )        (Struct.TurnResult.Attacked attack) ->           (View.SubMenu.Timeline.Attack.get_html              characters -            player_id +            player_ix              attack           )        (Struct.TurnResult.SwitchedWeapon weapon_switch) ->           (View.SubMenu.Timeline.WeaponSwitch.get_html              characters -            player_id +            player_ix              weapon_switch           ) @@ -64,11 +64,11 @@ get_turn_result_html characters player_id turn_result =  true_get_html : (        (Array.Array Struct.Character.Type) -> -      String -> +      Int ->        (Array.Array Struct.TurnResult.Type) ->        (Html.Html Struct.Event.Type)     ) -true_get_html characters player_id turn_results = +true_get_html characters player_ix turn_results =     (Html.div        [           (Html.Attributes.class "battlemap-tabmenu-content"), @@ -76,7 +76,7 @@ true_get_html characters player_id turn_results =        ]        (Array.toList           (Array.map -            (get_turn_result_html characters player_id) +            (get_turn_result_html characters player_ix)              turn_results           )        ) @@ -90,6 +90,6 @@ get_html model =     (Html.Lazy.lazy3        (true_get_html)        model.characters -      model.player_id +      model.player_ix        model.timeline     ) diff --git a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm index f41598b..875bc89 100644 --- a/src/battlemap/src/View/SubMenu/Timeline/Attack.elm +++ b/src/battlemap/src/View/SubMenu/Timeline/Attack.elm @@ -121,11 +121,11 @@ get_attack_html attacker defender attack =  --------------------------------------------------------------------------------  get_html : (        (Array.Array Struct.Character.Type) -> -      String -> +      Int ->        Struct.TurnResult.Attack ->        (Html.Html Struct.Event.Type)     ) -get_html characters player_id attack = +get_html characters player_ix attack =     case        (           (Array.get attack.attacker_index characters), @@ -140,8 +140,8 @@ get_html characters player_id attack =              ]              (                 [ -                  (View.Character.get_portrait_html player_id atkchar), -                  (View.Character.get_portrait_html player_id defchar), +                  (View.Character.get_portrait_html player_ix atkchar), +                  (View.Character.get_portrait_html player_ix 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 36b0410..2f7acd3 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 Array  +import Array  import Html  import Html.Attributes @@ -23,11 +23,11 @@ import View.Character  --------------------------------------------------------------------------------  get_html : (        (Array.Array Struct.Character.Type) -> -      String -> +      Int ->        Struct.TurnResult.Movement ->        (Html.Html Struct.Event.Type)     ) -get_html characters player_id movement = +get_html characters player_ix movement =     case (Array.get movement.character_index characters) of        (Just char) ->           (Html.div @@ -36,7 +36,7 @@ get_html characters player_id movement =                 (Html.Attributes.class "battlemap-timeline-movement")              ]              [ -               (View.Character.get_portrait_html player_id char), +               (View.Character.get_portrait_html player_ix 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 31d1a19..e66cfed 100644 --- a/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm +++ b/src/battlemap/src/View/SubMenu/Timeline/WeaponSwitch.elm @@ -23,11 +23,11 @@ import View.Character  --------------------------------------------------------------------------------  get_html : (        (Array.Array Struct.Character.Type) -> -      String -> +      Int ->        Struct.TurnResult.WeaponSwitch ->        (Html.Html Struct.Event.Type)     ) -get_html characters player_id weapon_switch = +get_html characters player_ix weapon_switch =     case (Array.get weapon_switch.character_index characters) of        (Just char) ->           (Html.div @@ -36,7 +36,7 @@ get_html characters player_id weapon_switch =                 (Html.Attributes.class "battlemap-timeline-weapon-switch")              ]              [ -               (View.Character.get_portrait_html player_id char), +               (View.Character.get_portrait_html player_ix char),                 (Html.text                    (                       (Struct.Character.get_name char) | 


