aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-03-13 18:12:28 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-03-13 18:12:28 +0100
commitf3868d956b17f9606e7b7321914e7c08316a062c (patch)
treeea4baa16f6a8765e01a03c05f23b5cab3ec41869
parent68cfa3b73e6f7def9641b08c4acf2f0f96685843 (diff)
downloadtacticians-server-f3868d956b17f9606e7b7321914e7c08316a062c.zip
tacticians-server-f3868d956b17f9606e7b7321914e7c08316a062c.tar.bz2
Separates original timeline from updates.
-rw-r--r--src/query/character_turn.erl7
-rw-r--r--src/query/load_state.erl2
-rw-r--r--src/reply/set_timeline.erl27
-rw-r--r--src/reply/turn_results.erl2
4 files changed, 30 insertions, 8 deletions
diff --git a/src/query/character_turn.erl b/src/query/character_turn.erl
index e2b6165..81c3c1f 100644
--- a/src/query/character_turn.erl
+++ b/src/query/character_turn.erl
@@ -147,12 +147,7 @@ update_cache (Battle, Input) ->
-spec generate_reply ( list(any())) -> binary().
generate_reply (EncodedClientUpdate) ->
- jiffy:encode
- (
- [
- turn_results:generate(EncodedClientUpdate)
- ]
- ).
+ jiffy:encode([turn_results:generate(EncodedClientUpdate)]).
handle_actions (RData, Input) ->
Battle = RData#relevant_data.battle,
diff --git a/src/query/load_state.erl b/src/query/load_state.erl
index d92c091..a03a20f 100644
--- a/src/query/load_state.erl
+++ b/src/query/load_state.erl
@@ -74,7 +74,7 @@ generate_reply (QueryState, Input) ->
jiffy:encode
(
[
- turn_results:generate(battle:get_encoded_last_turns_effects(Battle)),
+ set_timeline:generate(battle:get_encoded_last_turns_effects(Battle)),
set_map:generate(battle:get_battlemap(Battle))
|
array:sparse_to_list
diff --git a/src/reply/set_timeline.erl b/src/reply/set_timeline.erl
new file mode 100644
index 0000000..bfe621a
--- /dev/null
+++ b/src/reply/set_timeline.erl
@@ -0,0 +1,27 @@
+-module(set_timeline).
+
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%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Update]),
+ {
+ [
+ {<<"msg">>, <<"set_timeline">>},
+ {<<"cnt">>, EncodedClientUpdate}
+ ]
+ }.
diff --git a/src/reply/turn_results.erl b/src/reply/turn_results.erl
index 8402389..0f3ff25 100644
--- a/src/reply/turn_results.erl
+++ b/src/reply/turn_results.erl
@@ -18,7 +18,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-spec generate (list(any())) -> {list(any())}.
generate (EncodedClientUpdate) ->
- io:format("~nSending timeline:~n~p~n", [EncodedClientUpdate]),
+ io:format("~nSending turn results:~n~p~n", [EncodedClientUpdate]),
{
[
{<<"msg">>, <<"turn_results">>},