summaryrefslogtreecommitdiff |
diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/battlemap.erl | 22 | ||||
-rw-r--r-- | src/character.erl | 30 | ||||
-rw-r--r-- | src/handler.erl | 1 | ||||
-rw-r--r-- | src/timed_cache_data.hrl | 5 |
4 files changed, 4 insertions, 54 deletions
diff --git a/src/battlemap.erl b/src/battlemap.erl deleted file mode 100644 index 4366852..0000000 --- a/src/battlemap.erl +++ /dev/null @@ -1,22 +0,0 @@ --module(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) - } - ] - } - ). diff --git a/src/character.erl b/src/character.erl deleted file mode 100644 index aa0d5f0..0000000 --- a/src/character.erl +++ /dev/null @@ -1,30 +0,0 @@ --module(character). --export([encode_in_json/1]). - -encode_in_json ( - { - ID, - Name, - Icon, - Portrait, - {X, Y}, - Team, - MovementPoints, - AttackRange - } -) -> - jiffy:encode( - { - [ - {<<"id">>, ID}, - {<<"name">>, Name}, - {<<"icon">>, Icon}, - {<<"portrait">>, Portrait}, - {<<"loc_x">>, X}, - {<<"loc_y">>, Y}, - {<<"team">>, Team}, - {<<"mov_pts">>, MovementPoints}, - {<<"atk_rg">>, AttackRange} - ] - } - ). diff --git a/src/handler.erl b/src/handler.erl index 9270aa4..5f6ced4 100644 --- a/src/handler.erl +++ b/src/handler.erl @@ -6,7 +6,6 @@ start(_YawsParams) -> gen_server:cast(Pid, {add, battlemap_db, none}), gen_server:cast(Pid, {add, battlemap_instance_db, none}), gen_server:cast(Pid, {add, character_db, none}), - gen_server:cast(Pid, {add, character_instance_db, none}), gen_server:cast(Pid, {add, character_turn_db, none}), gen_server:cast(Pid, {add, player_data_db, none}), ok. diff --git a/src/timed_cache_data.hrl b/src/timed_cache_data.hrl index b0d7ba6..e91be25 100644 --- a/src/timed_cache_data.hrl +++ b/src/timed_cache_data.hrl @@ -1,6 +1,9 @@ +%% TODO: add types. -record(battlemap, {id, width, height, content, instances}). -record(battlemap_instance, {id, chars, curr_player, rem_chars, last_turn}). -record(character, {id, name, icon, portrait, mov_pts, atk_rg}). --record(character_instance, {id, x, y, team}). -record(character_turn, {id, path, target}). -record(player, {id, battlemaps, characters}). + +%% Not stored in its own timed cache. +-record(character_instance, {x, y, team}). |