summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2019-01-07 18:43:09 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2019-01-07 18:43:09 +0100 |
commit | eb78c5f52310b1eaa64a7bc376f119536270a887 (patch) | |
tree | 6cade2f10b36738c7e8a225d7e94783ce7b2c9cc /src/shared/struct/shr_battle_summary.erl | |
parent | 40b20e4355bf753f9a20d387f9c7929ef72450bc (diff) |
Player maps & battles: lists -> orddicts.
Diffstat (limited to 'src/shared/struct/shr_battle_summary.erl')
-rw-r--r-- | src/shared/struct/shr_battle_summary.erl | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/shared/struct/shr_battle_summary.erl b/src/shared/struct/shr_battle_summary.erl index 9af72b4..5169b2c 100644 --- a/src/shared/struct/shr_battle_summary.erl +++ b/src/shared/struct/shr_battle_summary.erl @@ -3,11 +3,14 @@ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-type category() :: (attack | defend | none). + -record ( battle_summary, { - id :: binary(), + id :: ataxia_id:type(), + category :: category(), name :: binary(), last_edit :: binary(), is_players_turn :: boolean() @@ -16,7 +19,7 @@ -opaque type() :: #battle_summary{}. --export_type([type/0]). +-export_type([type/0, category/0]). %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -80,6 +83,7 @@ new (ID, Name, Time, IsPlayersTurn) -> { id = ID, name = Name, + category = none, last_edit = Time, is_players_turn = IsPlayersTurn }. @@ -90,6 +94,7 @@ none () -> { id = <<"">>, name = <<"">>, + category = none, last_edit = <<"">>, is_players_turn = false }. @@ -133,10 +138,11 @@ get_last_edit_field () -> #battle_summary.last_edit. -spec get_is_players_turn_field () -> non_neg_integer(). get_is_players_turn_field () -> #battle_summary.is_players_turn. --spec encode (type()) -> {list(any())}. -encode (BattleSummary) -> +-spec encode ({non_neg_integer(), type()}) -> {list(any())}. +encode ({IX, BattleSummary}) -> { [ + {<<"ix">>, IX}, {<<"id">>, BattleSummary#battle_summary.id}, {<<"nme">>, BattleSummary#battle_summary.name}, {<<"ldt">>, BattleSummary#battle_summary.last_edit}, |