summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-10-11 17:49:47 +0200 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-10-11 17:49:47 +0200 |
commit | aea6e1872eeccffdef926b6561767ff59aecf87e (patch) | |
tree | 78b8848ccfa8d6002075bfe738ac0d66682e8add /src/special/spe_map.erl | |
parent | 4182b46e67185e1f024a24e7cba0d82e24f29baa (diff) |
(Broken) 'spe' to add new map to player.
Diffstat (limited to 'src/special/spe_map.erl')
-rw-r--r-- | src/special/spe_map.erl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/src/special/spe_map.erl b/src/special/spe_map.erl new file mode 100644 index 0000000..f12b0aa --- /dev/null +++ b/src/special/spe_map.erl @@ -0,0 +1,52 @@ +-module(spe_map). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export([generate/1]). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-spec generate (binary()) -> map_map:type(). +generate (OwnerID) -> + Map = map_map:default(OwnerID), + + {ok, MapID} = + shr_database:insert + ( + map_db, + any, + [{user, OwnerID}], + Map + ), + + MapSummary = shr_map_summary:new(<<"Untitled Map">>, MapID), + + PlayerUpdateQueryOps = + [ + %% FIXME: shr_db_query:add_to_field handles lists, + %% shr_player:get_map_summaries_field() points to an array. + shr_db_query:add_to_field + ( + shr_player:get_map_summaries_field(), + [MapSummary], + false + ) + ], + + ok = + shr_database:commit + ( + shr_db_query:new(player_db, OwnerID, admin, PlayerUpdateQueryOps) + ), + + Map. |