| 1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
 | -module(bm_character_turn_update).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-record
(
   type,
   {
      data :: bm_character_turn_data:type(),
      timeline :: list(any()),
      db :: list(sh_db_query:op())
   }
).
-opaque type() :: #type{}.
-export_type([type/0]).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-export
(
   [
      new/1,
      get_data/1,
      get_timeline/1,
      get_db/1,
      set_data/2,
      add_to_timeline/2,
      add_to_db/2
   ]
).
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec new (bm_character_turn_data:type()) -> type().
new (Data) ->
   #type
   {
      data = Data,
      timeline = [],
      db = []
   }.
-spec get_data (type()) -> bm_character_turn_data:type().
get_data (Update) -> Update#type.data.
-spec get_timeline (type()) -> list(any()).
get_timeline (Update) -> Update#type.timeline.
-spec get_db (type()) -> list(sh_db_query:op()).
get_db (Update) -> Update#type.db.
-spec set_data (bm_character_turn_data:type(), type()) -> type().
set_data (Data, Update) ->
   Update#type{ data = Data}.
-spec add_to_timeline (bm_turn_result:type(), type()) -> type().
add_to_timeline (Item, Update) ->
   Update#type{ timeline = [bm_turn_result:encode(Item)|Update#type.timeline] }.
-spec add_to_db (sh_db_query:op(), type()) -> type().
add_to_db (Item, Update) ->
   Update#type{ db = [Item|Update#type.db] }.
 |