| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2017-11-17 17:05:54 +0100 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2017-11-17 17:05:54 +0100 | 
| commit | 55d3257033e7ca3818425e280bdee9aa6f24fbcb (patch) | |
| tree | 840feab928232bfe20991a8c4cf50f5c0a993676 /www/handler | |
| parent | f4bd9fdf0e9555837d5c1306fb629372c9a4c0f1 (diff) | |
Using a ets dict to simulate DBs.
Diffstat (limited to 'www/handler')
| -rw-r--r-- | www/handler/battlemap/load_state.yaws | 35 | 
1 files changed, 20 insertions, 15 deletions
| diff --git a/www/handler/battlemap/load_state.yaws b/www/handler/battlemap/load_state.yaws index a9be563..6e613c6 100644 --- a/www/handler/battlemap/load_state.yaws +++ b/www/handler/battlemap/load_state.yaws @@ -1,5 +1,7 @@  <erl> --record(input, {battlemap_id, instance_id}). +-record(input, {player_id, battlemap_id, instance_id}). + +-include("/tmp/timed_cache_data.hrl").  parse_input (Req) ->     JSONReqMap = jiffy:decode(Req, [return_maps]), @@ -44,20 +46,22 @@ generate_reply (Battlemap, _BattlemapInstance, Characters) ->     jiffy:encode     (        [ -         <<"set_map">>, -         generate_set_map(Battlemap) +         [ +            <<"set_map">>, +            generate_set_map(Battlemap) +         ] +         | +         lists:map +         ( +            fun ({CharID, CharInstance}) -> +               [ +                  <<"add_char">>, +                  generate_add_char(CharID, CharInstance) +               ] +            end, +            Characters +         )        ] -      | -      lists:map -      ( -         fun ({CharID, CharInstance}) -> -            [ -               <<"add_char">>, -               generate_add_char(CharID, CharInstance) -            ] -         end, -         Characters -      )     ).  handle (Req) -> @@ -67,7 +71,8 @@ handle (Req) ->        timed_cache:fetch        (           battlemap_instances_db, -         {Input#input.battlemap_id, Input#input.battlemap_instance_id} +         <<"0">> +%         {Input#input.battlemap_id, Input#input.battlemap_instance_id}        ),     Characters =        list:map | 


