summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2017-11-09 17:23:34 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2017-11-09 17:23:34 +0100 |
commit | fde7249bb3b185f2447585e9406775f351133632 (patch) | |
tree | b9c6764dedc7a2352f2c2c44aaa8b3c973a124e2 /src/battlemap_load_state.erl | |
parent | 4ae5a0668bb06afe89f758550a38392f54a6eb45 (diff) |
Implementing a shim for battlemap state loading...
Diffstat (limited to 'src/battlemap_load_state.erl')
-rw-r--r-- | src/battlemap_load_state.erl | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/battlemap_load_state.erl b/src/battlemap_load_state.erl new file mode 100644 index 0000000..3ebdd8b --- /dev/null +++ b/src/battlemap_load_state.erl @@ -0,0 +1,27 @@ +-module(battlemap_load_state). + +-export( + [ + handle/1 + ] +). + +handle (Req) -> + JSONReqMap = jiffy:decode(Req, [return_maps]), + BattlemapID = maps:get(<<"battlemap_id">>, JSONReqMap), + io:format("~nLoading Battlemap ~p...", [BattlemapID]), + Battlemap = timed_cache_object:fetch(battlemaps_db, BattlemapID, 60000), +%% ok = users_manager:ping(UserToken), + jiffy:encode( + { + [ + {<<"types">>, [<<"STATE">>]}, + { + <<"data">>, + [ + battlemap_battlemap:encode_to_json(Battlemap) + ] + } + ] + } + ). |