summaryrefslogtreecommitdiff |
diff options
author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-10-09 19:34:02 +0200 |
---|---|---|
committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-10-09 19:34:02 +0200 |
commit | 169d7ff927917f2b0bf4cc6349a483f1031960fc (patch) | |
tree | 30b1a9624c5f0f0f7ca67ebccf19dde3a3cd19b7 /src/roster | |
parent | 80cf57bc91d25a043ed8c1de557ebe1ccbe17022 (diff) |
(Broken) glyphs lists, not arrays...
Diffstat (limited to 'src/roster')
-rw-r--r-- | src/roster/reply/rst_add_char.erl | 2 | ||||
-rw-r--r-- | src/roster/struct/rst_character.erl | 31 |
2 files changed, 17 insertions, 16 deletions
diff --git a/src/roster/reply/rst_add_char.erl b/src/roster/reply/rst_add_char.erl index 1e0d1da..908ce3e 100644 --- a/src/roster/reply/rst_add_char.erl +++ b/src/roster/reply/rst_add_char.erl @@ -33,7 +33,7 @@ generate (IX, Character) -> {<<"awp">>, ActiveWeapon}, {<<"swp">>, SecondaryWeapon}, {<<"ar">>, rst_character:get_armor_id(Character)}, - {<<"gls">>, array:to_list(rst_character:get_glyph_ids(Character))}, + {<<"gls">>, rst_character:get_glyph_ids(Character)}, {<<"gb">>, rst_character:get_glyph_board_id(Character)} ] }. diff --git a/src/roster/struct/rst_character.erl b/src/roster/struct/rst_character.erl index afe370d..2a159e4 100644 --- a/src/roster/struct/rst_character.erl +++ b/src/roster/struct/rst_character.erl @@ -11,7 +11,7 @@ portrait_id :: shr_portrait:id(), weapon_ids :: {shr_weapon:id(), shr_weapon:id()}, armor_id :: shr_armor:id(), - glyph_ids :: array:array(shr_glyph:id()), + glyph_ids :: list(shr_glyph:id()), glyph_board_id :: shr_glyph_board:id() } ). @@ -53,7 +53,7 @@ ( [ decode/1, - random/0 + new/0 ] ). @@ -92,7 +92,7 @@ validate_armor (_Inventory, _Armor) -> % TODO [SECURITY][LOW]: unimplemented ok. --spec validate_glyphs (shr_inventory:type(), array:array(shr_glyph:id())) -> ok. +-spec validate_glyphs (shr_inventory:type(), list(shr_glyph:id())) -> ok. validate_glyphs (_Inventory, _Glyphs) -> % TODO [SECURITY][LOW]: unimplemented ok. @@ -104,7 +104,7 @@ validate_glyph_board (_Inventory, _GlyphBoard) -> -spec validate_glyphs_on_board ( - array:array(shr_glyph:id()), + list(shr_glyph:id()), shr_glyph_board:id() ) -> ok. @@ -128,7 +128,7 @@ get_weapon_ids (Char) -> Char#character.weapon_ids. -spec get_armor_id (type()) -> shr_armor:id(). get_armor_id (Char) -> Char#character.armor_id. --spec get_glyph_ids (type()) -> array:array(shr_glyph:id()). +-spec get_glyph_ids (type()) -> list(shr_glyph:id()). get_glyph_ids (Char) -> Char#character.glyph_ids. -spec get_glyph_board_id (type()) -> shr_glyph_board:id(). @@ -163,7 +163,7 @@ set_weapon_ids (WeaponIDs, Char) -> weapon_ids = WeaponIDs }. --spec set_glyph_ids (array:array(shr_glyph:id()), type()) -> type(). +-spec set_glyph_ids (list(shr_glyph:id()), type()) -> type(). set_glyph_ids (GlyphIDs, Char) -> Char#character { @@ -177,16 +177,17 @@ set_glyph_board_id (GlyphBoardID, Char) -> glyph_board_id = GlyphBoardID }. --spec random () -> type(). -random () -> +-spec new () -> type(). +new () -> + UnarmedID = shr_weapon:get_id(shr_weapon:none()), #character { - name = <<"">>, - portrait_id = <<"0">>, - weapon_ids = {0, 0}, - armor_id = 0, - glyph_ids = array:new(), - glyph_board_id = <<"0">> + name = <<"Nameless">>, + portrait_id = shr_portrait:get_id(shr_portrait:default()), + weapon_ids = {UnarmedID, UnarmedID}, + armor_id = shr_armor:get_id(shr_armor:none()), + glyph_ids = [], + glyph_board_id = shr_glyph_board:get_id(shr_glyph_board:none()) }. -spec get_name_field () -> non_neg_integer(). @@ -218,7 +219,7 @@ decode (JSONReqMap) -> portrait_id = Portrait, weapon_ids = {ActiveWeapon, SecondaryWeapon}, armor_id = Armor, - glyph_ids = array:from_list(GlyphsList), + glyph_ids = GlyphsList, glyph_board_id = GlyphBoard }. |