| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2019-01-04 17:25:39 +0100 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2019-01-04 17:25:39 +0100 | 
| commit | 83cd7ce064b8a46a106dc855d748b1bd7e45af01 (patch) | |
| tree | cee5d4e3d21936925f8108940c35533f9f6484f5 /src/shared/struct/shr_player.erl | |
| parent | 895a5348f521b16b3a6e32d921f7f23ec8f3036e (diff) | |
Removes 'id' field from ataxia entry values.
While sometimes usefull as a way to retrieve the object's ID, they were
both redundant (you can't get the object without its ID anyway) and
bothersome to maintain (insert + update, which would have required
setting up a bounty for any insert).
Diffstat (limited to 'src/shared/struct/shr_player.erl')
| -rw-r--r-- | src/shared/struct/shr_player.erl | 26 | 
1 files changed, 6 insertions, 20 deletions
| diff --git a/src/shared/struct/shr_player.erl b/src/shared/struct/shr_player.erl index eabca96..076c685 100644 --- a/src/shared/struct/shr_player.erl +++ b/src/shared/struct/shr_player.erl @@ -3,13 +3,12 @@  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --type id() :: binary(). +-type id() :: ataxia_id:type().  -record  (     player,     { -      id :: id(),        username :: binary(),        % {salt(crypto:strong_rand_bytes(128)), hash(sha384)}        password :: {binary(), binary()}, @@ -35,7 +34,7 @@  -export  (     [ -      new/4 +      new/3     ]  ). @@ -43,7 +42,6 @@  -export  (     [ -      get_id/1,        get_username/1,        get_password/1,        get_token/1, @@ -56,7 +54,6 @@        get_inventory_id/1,        get_roster_id/1, -      set_id/2,        set_username/2,        set_password/2,        new_token/1, @@ -74,7 +71,6 @@  -export  (     [ -      get_id_field/0,        get_username_field/0,        get_password_field/0,        get_token_field/0, @@ -113,13 +109,12 @@ secure_value (Salt, Val) ->  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec new (binary(), binary(), binary(), binary()) -> type(). -new (ID, Username, Password, Email) -> +-spec new (binary(), binary(), binary()) -> type(). +new (Username, Password, Email) ->     EmptyBattleSlot = shr_battle_summary:none(),     Result =        #player        { -         id = ID,           username = Username,           password = {<<"">>, <<"">>},           token = <<"">>, @@ -160,8 +155,8 @@ new (ID, Username, Password, Email) ->                 EmptyBattleSlot,                 EmptyBattleSlot              ], -         inventory_id = <<"0">>, -         roster_id = <<"0">> +         inventory_id = ataxia_id:null(), +         roster_id = ataxia_id:null()        },     S0Result = set_password(Password, Result), @@ -171,9 +166,6 @@ new (ID, Username, Password, Email) ->     S2Result.  %%%% Accessors --spec get_id (type()) -> id(). -get_id (Player) -> Player#player.id. -  -spec get_username (type()) -> binary().  get_username (Player) -> Player#player.username. @@ -207,9 +199,6 @@ get_roster_id (Player) -> Player#player.roster_id.  -spec get_inventory_id (type()) -> binary().  get_inventory_id (Player) -> Player#player.inventory_id. --spec set_id (binary(), type()) -> type(). -set_id (Val, Player) -> Player#player{ id = Val }. -  -spec set_username (binary(), type()) -> type().  set_username (Val, Player) -> Player#player{ username = Val }. @@ -280,9 +269,6 @@ set_roster_id (RosterID, Player) -> Player#player{ roster_id = RosterID }.  -spec set_inventory_id (binary(), type()) -> type().  set_inventory_id (InvID, Player) -> Player#player{ inventory_id = InvID }. --spec get_id_field () -> non_neg_integer(). -get_id_field () -> #player.id. -  -spec get_username_field () -> non_neg_integer().  get_username_field () -> #player.username. | 


