summaryrefslogtreecommitdiff
blob: 64cf10db4a71f870398af563bbf4b063b756fc2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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)
            }
         ]
      }
   ).