summaryrefslogtreecommitdiff
path: root/src/reply
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2018-02-28 13:59:39 +0100
committernsensfel <SpamShield0@noot-noot.org>2018-02-28 13:59:39 +0100
commit5235345620c0d4a6669ccc6badc387902ea8c92a (patch)
tree0a8989ffd29b0a9d8ab997d763f15268d18de06a /src/reply
parent8ed3e625a5576b6f43b966ee77e0f6de282a074e (diff)
Adds more types specifications.
Diffstat (limited to 'src/reply')
-rw-r--r--src/reply/add_char.erl12
-rw-r--r--src/reply/set_map.erl2
2 files changed, 14 insertions, 0 deletions
diff --git a/src/reply/add_char.erl b/src/reply/add_char.erl
index 7d30bac..42c3359 100644
--- a/src/reply/add_char.erl
+++ b/src/reply/add_char.erl
@@ -12,6 +12,11 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec attributes_as_json
+ (
+ attributes:struct()
+ ) ->
+ {list({binary(), non_neg_integer()})}.
attributes_as_json (Attributes) ->
{
[
@@ -24,6 +29,7 @@ attributes_as_json (Attributes) ->
]
}.
+-spec encode (non_neg_integer(), character_instance:struct()) -> binary().
encode (IX, CharacterInstance) ->
Character = character_instance:get_character(CharacterInstance),
{X, Y} = character_instance:get_location(CharacterInstance),
@@ -56,5 +62,11 @@ encode (IX, CharacterInstance) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec generate
+ (
+ non_neg_integer(),
+ character_instance:struct()
+ )
+ -> list(binary()).
generate (IX, CharacterInstance) ->
[<<"add_char">>, encode(IX, CharacterInstance)].
diff --git a/src/reply/set_map.erl b/src/reply/set_map.erl
index 5a2cf55..0941239 100644
--- a/src/reply/set_map.erl
+++ b/src/reply/set_map.erl
@@ -12,6 +12,7 @@
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec encode (battlemap:struct()) -> binary().
encode (Battlemap) ->
jiffy:encode
(
@@ -27,5 +28,6 @@ encode (Battlemap) ->
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+-spec generate (battlemap:struct()) -> list(binary()).
generate (Battlemap) ->
[<<"set_map">>, encode(Battlemap)].