| summaryrefslogtreecommitdiff | 
diff options
| author | nsensfel <SpamShield0@noot-noot.org> | 2018-09-05 18:08:36 +0200 | 
|---|---|---|
| committer | nsensfel <SpamShield0@noot-noot.org> | 2018-09-05 18:08:36 +0200 | 
| commit | 27e74e26dbcf1a7a68fe90b1fa3ca72e3c8da07b (patch) | |
| tree | 2af5e37f747940952a173d86fe051f894cc91a37 /src/map | |
| parent | 324416df92a5192be02e9a1285a623c37c01ef77 (diff) | |
Adds map for player2, player_db cached as 'any'.
Diffstat (limited to 'src/map')
| -rw-r--r-- | src/map/map_handler.erl | 14 | ||||
| -rw-r--r-- | src/map/map_shim.erl | 8 | 
2 files changed, 17 insertions, 5 deletions
| diff --git a/src/map/map_handler.erl b/src/map/map_handler.erl index 0866315..e4bcb60 100644 --- a/src/map/map_handler.erl +++ b/src/map/map_handler.erl @@ -27,7 +27,19 @@ start (TimedCachesManagerPid) ->              <<"0">>,              any,              any, -            map_shim:generate_random_map() +            map_shim:generate_random_map(0, <<"0">>) +         ) +   end, +   case shr_database:fetch(map_db, <<"1">>, admin) of +      {ok, _} -> ok; +      not_found -> +         shr_database:insert_at +         ( +            map_db, +            <<"1">>, +            any, +            any, +            map_shim:generate_random_map(1, <<"1">>)           )     end,     shr_timed_caches_manager:new_cache(TimedCachesManagerPid, map_db, none), diff --git a/src/map/map_shim.erl b/src/map/map_shim.erl index de87bc2..a7f00cc 100644 --- a/src/map/map_shim.erl +++ b/src/map/map_shim.erl @@ -7,7 +7,7 @@  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --export([generate_random_map/0]). +-export([generate_random_map/2]).  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -52,8 +52,8 @@ demo_map () ->  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec generate_random_map () -> map_map:type(). -generate_random_map () -> -   Map = map_map:from_list(0, <<"0">>, 32, 32, demo_map()), +-spec generate_random_map (non_neg_integer(), binary()) -> map_map:type(). +generate_random_map (ID, Owner) -> +   Map = map_map:from_list(ID, Owner, 32, 32, demo_map()),     Map. | 


