summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornsensfel <SpamShield0@noot-noot.org>2017-11-09 17:23:34 +0100
committernsensfel <SpamShield0@noot-noot.org>2017-11-09 17:23:34 +0100
commitfde7249bb3b185f2447585e9406775f351133632 (patch)
treeb9c6764dedc7a2352f2c2c44aaa8b3c973a124e2 /src/battlemap_battlemap.erl
parent4ae5a0668bb06afe89f758550a38392f54a6eb45 (diff)
Implementing a shim for battlemap state loading...
Diffstat (limited to 'src/battlemap_battlemap.erl')
-rw-r--r--src/battlemap_battlemap.erl22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/battlemap_battlemap.erl b/src/battlemap_battlemap.erl
new file mode 100644
index 0000000..64cf10d
--- /dev/null
+++ b/src/battlemap_battlemap.erl
@@ -0,0 +1,22 @@
+-module(battlemap_battlemap).
+-export([encode_in_json/1]).
+
+encode_in_json (
+ {
+ Width,
+ Height,
+ Tiles
+ }
+) ->
+ jiffy:encode(
+ {
+ [
+ {<<"width">>, Width},
+ {<<"height">>, Height},
+ {
+ <<"content">>,
+ lists:map((fun ({ID, Cost}) -> [ID, Cost] end), Tiles)
+ }
+ ]
+ }
+ ).