| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2019-06-06 17:54:05 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2019-06-06 17:54:05 +0200 | 
| commit | 5fd8f5d303e8915cc74a52e5b86d1fd8f073cb4d (patch) | |
| tree | c732d37accd97348ff0f886021bcbb8f48dff0fb /src/shared | |
| parent | c3afe2633025641dd02e05d6c55dd9cafc42b8a2 (diff) | |
Fixes some of the issues I've found.
Diffstat (limited to 'src/shared')
| -rw-r--r-- | src/shared/struct/inventory/shr_equipment.erl | 16 | ||||
| -rw-r--r-- | src/shared/struct/shr_character.erl | 18 | 
2 files changed, 21 insertions, 13 deletions
| diff --git a/src/shared/struct/inventory/shr_equipment.erl b/src/shared/struct/inventory/shr_equipment.erl index b56a83c..830896c 100644 --- a/src/shared/struct/inventory/shr_equipment.erl +++ b/src/shared/struct/inventory/shr_equipment.erl @@ -502,16 +502,16 @@ decode (Map) ->        glyphs = maps:get(?GLYPHS_FIELD, Map)     }. --spec encode (unresolved()) -> {list({binary(), any()})}. -encode (EqRef) -> +-spec encode (either()) -> {list({binary(), any()})}. +encode (Eq) ->     {        [ -         {?PRIMARY_WEAPON_FIELD, EqRef#shr_eq_ref.primary}, -         {?SECONDARY_WEAPON_FIELD, EqRef#shr_eq_ref.secondary}, -         {?ARMOR_FIELD, EqRef#shr_eq_ref.armor}, -         {?PORTRAIT_FIELD, EqRef#shr_eq_ref.portrait}, -         {?GLYPH_BOARD_FIELD, EqRef#shr_eq_ref.glyph_board}, -         {?GLYPHS_FIELD, EqRef#shr_eq_ref.glyphs} +         {?PRIMARY_WEAPON_FIELD, get_primary_weapon_id(Eq)}, +         {?SECONDARY_WEAPON_FIELD, get_secondary_weapon_id(Eq)}, +         {?ARMOR_FIELD, get_armor_id(Eq)}, +         {?PORTRAIT_FIELD, get_portrait_id(Eq)}, +         {?GLYPH_BOARD_FIELD, get_glyph_board_id(Eq)}, +         {?GLYPHS_FIELD, get_glyph_ids(Eq)}        ]     }. diff --git a/src/shared/struct/shr_character.erl b/src/shared/struct/shr_character.erl index 87a9be8..27cf81d 100644 --- a/src/shared/struct/shr_character.erl +++ b/src/shared/struct/shr_character.erl @@ -416,16 +416,24 @@ decode (Map) ->        is_using_secondary = maps:get(?IS_USING_SECONDARY_FIELD, Map)     }. --spec encode (unresolved()) -> {list({binary(), any()})}. -encode (CharRef) -> +-spec encode (either()) -> {list({binary(), any()})}. +encode (Character) ->     {        [ -         {?NAME_FIELD, CharRef#shr_char_ref.name}, +         {?NAME_FIELD, get_name(Character)},           {              ?EQUIPMENT_FIELD, -            shr_equipment:encode(CharRef#shr_char_ref.equipment) +            shr_equipment:encode(get_equipment(Character))           }, -         {?IS_USING_SECONDARY_FIELD, CharRef#shr_char_ref.is_using_secondary} +         { +            ?IS_USING_SECONDARY_FIELD, +            ( +               case Character of +                  #shr_char_ref{is_using_secondary = R} -> R; +                  #shr_char{is_using_secondary = R} -> R +               end +            ) +         }        ]     }. | 


