summaryrefslogtreecommitdiff |
diff options
author | nsensfel <SpamShield0@noot-noot.org> | 2018-02-23 11:35:45 +0100 |
---|---|---|
committer | nsensfel <SpamShield0@noot-noot.org> | 2018-02-23 11:35:45 +0100 |
commit | acf9e9f1eb880ffb8ab918c40724eda566aefcc7 (patch) | |
tree | efa3dd6c88d7970632fbe44f322d03b983b02768 /src/shim/battlemap_instance_shim.erl | |
parent | 43e38e5fc54fd58e8230b2b5198b6d8cb625803c (diff) |
Starting a big refactoring...
Diffstat (limited to 'src/shim/battlemap_instance_shim.erl')
-rw-r--r-- | src/shim/battlemap_instance_shim.erl | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/shim/battlemap_instance_shim.erl b/src/shim/battlemap_instance_shim.erl new file mode 100644 index 0000000..94ae7ce --- /dev/null +++ b/src/shim/battlemap_instance_shim.erl @@ -0,0 +1,55 @@ +-module(battlemap_instance_shim). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% TYPES %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-record +( + battlemap_instance, + { + id, + chars, + curr_player, + players, + rem_chars, + last_turn + } +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +-export +( + [ + generate_random/2 + ] +). + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% LOCAL FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% + +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% +generate_random (CharInsts, Players) -> + #battlemap_instance + { + id = <<"0">>, + chars = dict:from_list(CharInsts), + curr_player = 0, + players = array:from_list(Players), + rem_chars = + lists:filtermap + ( + fun ({K, V}) -> + case character_instance:get_owner(V) of + 0 -> {true, K}; + _ -> false + end + end, + CharInsts + ), + last_turn = [] + }. |