| summaryrefslogtreecommitdiff | 
diff options
| author | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-08-02 16:42:51 +0200 | 
|---|---|---|
| committer | Nathanael Sensfelder <SpamShield0@MultiAgentSystems.org> | 2018-08-02 16:42:51 +0200 | 
| commit | c0349f22f281940bd2f9b3cf670b21dc895dca85 (patch) | |
| tree | 8e29927872c4175e1ce7a2b3e108bc23bf56a9e4 | |
| parent | 234193c59f79a71b4aedb5cdcc748fb70ef52712 (diff) | |
Moves to the new tile format.
| -rw-r--r-- | src/battle/btl_shim.erl | 73 | ||||
| -rw-r--r-- | src/battle/game-logic/btl_movement.erl | 6 | ||||
| -rw-r--r-- | src/battle/query/btl_load.erl | 4 | ||||
| -rw-r--r-- | src/battle/reply/btl_add_tile.erl | 6 | ||||
| -rw-r--r-- | src/battle/reply/btl_set_map.erl | 6 | ||||
| -rw-r--r-- | src/battle/struct/btl_map.erl | 22 | ||||
| -rw-r--r-- | src/battle/struct/btl_tile.erl | 92 | ||||
| -rw-r--r-- | src/battle/struct/btl_tile.erl.m4 | 68 | 
8 files changed, 141 insertions, 136 deletions
| diff --git a/src/battle/btl_shim.erl b/src/battle/btl_shim.erl index 07ec687..e13660c 100644 --- a/src/battle/btl_shim.erl +++ b/src/battle/btl_shim.erl @@ -90,41 +90,42 @@ generate_random_characters        [btl_character:get_location(Character)|ForbiddenLocations],        [Character|Result]     ). --spec demo_map () -> list(non_neg_integer()). +-spec demo_map () +   -> list({non_neg_integer(), non_neg_integer(), non_neg_integer()}).  demo_map () ->     [ -      2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, -      2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 1, 2, -      2, 0, 1, 1, 1, 0, 1, 1, 0, 0, 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 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {2, 2, 0}, {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, +      {2, 2, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {2, 2, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {2, 2, 0}, +      {2, 2, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {1, 1, 0}, {1, 1, 0}, {3, 3, 0}, {1, 1, 0}, {3, 3, 0}, {3, 3, 0}, {3, 3, 0}, {2, 2, 0}, +      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, +      {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}, {0, 0, 0}     ].  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% @@ -157,15 +158,15 @@ generate_random_battle () ->     UsedTileIDs =        array:sparse_foldl        ( -         fun (_IX, TileClassID, CurrentTileIDs) -> +         fun (_IX, TileID, CurrentTileIDs) ->              sets:add_element              ( -               btl_tile:class_id_to_type_id(TileClassID), +               btl_tile:extract_main_class_id(TileID),                 CurrentTileIDs              )           end,           sets:new(), -         btl_map:get_tile_class_ids(Map) +         btl_map:get_tile_ids(Map)        ),     Battle = diff --git a/src/battle/game-logic/btl_movement.erl b/src/battle/game-logic/btl_movement.erl index 9acce73..e19e7f7 100644 --- a/src/battle/game-logic/btl_movement.erl +++ b/src/battle/game-logic/btl_movement.erl @@ -30,9 +30,9 @@ cross (_Map, _ForbiddenLocations, [], Cost, Location) ->     {Location, Cost};  cross (Map, ForbiddenLocations, [Step|NextSteps], Cost, Location) ->     NextLocation = btl_location:apply_direction(Step, Location), -   NextTileClassID = btl_map:get_tile_class_id(NextLocation, Map), -   NextTileID = btl_tile:class_id_to_type_id(NextTileClassID), -   NextTile = btl_tile:from_id(NextTileID), +   NextTileID = btl_map:get_tile_id(NextLocation, Map), +   NextTileClassID = btl_tile:extract_main_class_id(NextTileID), +   NextTile = btl_tile:from_class_id(NextTileClassID),     NextCost = (Cost + btl_tile:get_cost(NextTile)),     IsForbidden =        lists:foldl diff --git a/src/battle/query/btl_load.erl b/src/battle/query/btl_load.erl index 7eac627..551ec41 100644 --- a/src/battle/query/btl_load.erl +++ b/src/battle/query/btl_load.erl @@ -118,8 +118,8 @@ generate_reply (QueryState, Input) ->     AddTileList =        lists:map        ( -         fun (TileID) -> -            btl_add_tile:generate(btl_tile:from_id(TileID)) +         fun (TileClassID) -> +            btl_add_tile:generate(btl_tile:from_class_id(TileClassID))           end,           btl_battle:get_used_tile_ids(Battle)        ), diff --git a/src/battle/reply/btl_add_tile.erl b/src/battle/reply/btl_add_tile.erl index 04c4ec2..a7e8f31 100644 --- a/src/battle/reply/btl_add_tile.erl +++ b/src/battle/reply/btl_add_tile.erl @@ -21,10 +21,8 @@ generate (Tile) ->     {        [           {<<"msg">>, <<"add_tile">>}, -         {<<"id">>, btl_tile:get_id(Tile)}, +         {<<"id">>, btl_tile:get_class_id(Tile)},           {<<"nam">>, btl_tile:get_name(Tile)}, -         {<<"ct">>, btl_tile:get_cost(Tile)}, -         {<<"rmi">>, btl_tile:get_range_minimum(Tile)}, -         {<<"rma">>, btl_tile:get_range_maximum(Tile)} +         {<<"ct">>, btl_tile:get_cost(Tile)}        ]     }. diff --git a/src/battle/reply/btl_set_map.erl b/src/battle/reply/btl_set_map.erl index b4025b1..e7e4f25 100644 --- a/src/battle/reply/btl_set_map.erl +++ b/src/battle/reply/btl_set_map.erl @@ -25,7 +25,11 @@ generate (Map) ->           {<<"h">>, btl_map:get_height(Map)},           {              <<"t">>, -            array:sparse_to_list(btl_map:get_tile_class_ids(Map)) +            lists:map +            ( +               fun btl_tile:id_to_int_list/1, +               array:sparse_to_list(btl_map:get_tile_ids(Map)) +            )           }        ]     }. diff --git a/src/battle/struct/btl_map.erl b/src/battle/struct/btl_map.erl index 83cf455..ce39b19 100644 --- a/src/battle/struct/btl_map.erl +++ b/src/battle/struct/btl_map.erl @@ -12,7 +12,7 @@        id :: id(),        width :: integer(),        height :: integer(), -      tile_class_ids :: array:array(btl_tile:class_id()) +      tile_ids :: array:array(btl_tile:id())     }  ). @@ -30,8 +30,8 @@        get_id/1,        get_width/1,        get_height/1, -      get_tile_class_ids/1, -      get_tile_class_id/2 +      get_tile_ids/1, +      get_tile_id/2     ]  ). @@ -72,29 +72,29 @@ get_width (Map) -> Map#map.width.  -spec get_height (type()) -> integer().  get_height (Map) -> Map#map.height. --spec get_tile_class_ids (type()) -> array:array(btl_tile:class_id()). -get_tile_class_ids (Map) -> Map#map.tile_class_ids. +-spec get_tile_ids (type()) -> array:array(btl_tile:id()). +get_tile_ids (Map) -> Map#map.tile_ids. --spec get_tile_class_id (btl_location:type(), type()) -> btl_tile:class_id(). -get_tile_class_id (Location, Map) -> +-spec get_tile_id (btl_location:type(), type()) -> btl_tile:id(). +get_tile_id (Location, Map) ->     TileIX = location_to_array_index(Map#map.width, Location), -   array:get(TileIX, Map#map.tile_class_ids). +   array:get(TileIX, Map#map.tile_ids).  -spec from_list     (        non_neg_integer(),        non_neg_integer(),        non_neg_integer(), -      list(non_neg_integer()) +      list({non_neg_integer(), non_neg_integer(), non_neg_integer()})     )     -> type().  from_list (ID, Width, Height, List) -> -   TileClassIDs = lists:map(fun btl_tile:class_id_from_int/1, List), +   TileIDs = lists:map(fun btl_tile:id_from_ints/1, List),     #map     {        id = list_to_binary(integer_to_list(ID)),        width = Width,        height = Height, -      tile_class_ids = array:from_list(TileClassIDs) +      tile_ids = array:from_list(TileIDs)     }. diff --git a/src/battle/struct/btl_tile.erl b/src/battle/struct/btl_tile.erl index 3abfb9c..60886ca 100644 --- a/src/battle/struct/btl_tile.erl +++ b/src/battle/struct/btl_tile.erl @@ -7,16 +7,15 @@  (     tile,     { -      id :: id(), +      id :: class_id(),        name :: binary(), -      cost :: non_neg_integer(), -      class_range_min :: non_neg_integer(), -      class_range_max :: non_neg_integer() +      cost :: non_neg_integer()     }  ). --opaque id() :: non_neg_integer().  -opaque class_id() :: non_neg_integer(). +-opaque id() :: {class_id(), class_id(), non_neg_integer()}. +  -opaque type() :: #tile{}.  -export_type([type/0, class_id/0, id/0]). @@ -26,12 +25,10 @@  -export  (     [ -      get_id/1, +      get_class_id/1,        get_name/1,        get_cost/1, -      get_range_minimum/1, -      get_range_maximum/1, -      from_id/1, +      from_class_id/1,        cost_when_oob/0     ]  ). @@ -39,8 +36,17 @@  -export  (     [ -      class_id_to_type_id/1, -      class_id_from_int/1 +      id_to_int_list/1, +      id_from_ints/1 +   ] +). + +-export +( +   [ +      extract_main_class_id/1, +      extract_border_class_id/1, +      extract_variant_ix/1     ]  ). @@ -52,63 +58,53 @@  %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec class_id_to_type_id (class_id()) -> id(). -class_id_to_type_id (ClassID) -> -   case ClassID of +-spec extract_main_class_id (id()) -> class_id(). +extract_main_class_id ({M, _, _}) -> M. -      N when ((N >= 0) and (N =< 0)) -> 0; -      N when ((N >= 1) and (N =< 1)) -> 1; -      N when ((N >= 2) and (N =< 2)) -> 2; -      N when ((N >= 3) and (N =< 17)) -> 3; -      _ -> 0 -   end. +-spec extract_border_class_id (id()) -> class_id(). +extract_border_class_id ({_, B, _}) -> B. --spec from_id (id()) -> type(). +-spec extract_variant_ix (id()) -> class_id(). +extract_variant_ix ({_, _, V}) -> V. -from_id (0) -> +-spec from_class_id (class_id()) -> type(). + +from_class_id (0) ->     #tile     {        id = 0,        name = <<"[Grassland] Grass">>, -      cost = 6, -      class_range_min = 0, -      class_range_max = 0 +      cost = 6     }; -from_id (1) -> +from_class_id (1) ->     #tile     {        id = 1,        name = <<"[Grassland] Mushroom Infestation">>, -      cost = 12, -      class_range_min = 1, -      class_range_max = 1 +      cost = 12     }; -from_id (2) -> +from_class_id (2) ->     #tile     {        id = 2,        name = <<"[Grassland] Tree Remains">>, -      cost = 24, -      class_range_min = 2, -      class_range_max = 2 +      cost = 24     }; -from_id (3) -> +from_class_id (3) ->     #tile     {        id = 3,        name = <<"[Grassland] Clear Water">>, -      cost = 201, -      class_range_min = 3, -      class_range_max = 17 +      cost = 201     }; -from_id(_) -> -   from_id(0). +from_class_id(_) -> +   from_class_id(0).  -spec cost_when_oob () -> non_neg_integer().  cost_when_oob () -> 255. --spec get_id (type()) -> non_neg_integer(). -get_id (Tile) -> Tile#tile.id. +-spec get_class_id (type()) -> non_neg_integer(). +get_class_id (Tile) -> Tile#tile.id.  -spec get_cost (type()) -> non_neg_integer().  get_cost (Tile) -> Tile#tile.cost. @@ -116,11 +112,11 @@ get_cost (Tile) -> Tile#tile.cost.  -spec get_name (type()) -> binary().  get_name (Tile) -> Tile#tile.name. --spec get_range_minimum (type()) -> non_neg_integer(). -get_range_minimum (Tile) -> Tile#tile.class_range_min. - --spec get_range_maximum (type()) -> non_neg_integer(). -get_range_maximum (Tile) -> Tile#tile.class_range_max. +-spec id_from_ints +   ( +      {non_neg_integer(), non_neg_integer(), non_neg_integer()} +   ) -> id(). +id_from_ints ({M, B, V}) -> {M, B, V}. --spec class_id_from_int (non_neg_integer()) -> id(). -class_id_from_int (I) -> I. +-spec id_to_int_list (id()) -> list(non_neg_integer()). +id_to_int_list ({M, B, V}) -> [M, B, V]. diff --git a/src/battle/struct/btl_tile.erl.m4 b/src/battle/struct/btl_tile.erl.m4 index 7a8ea21..170b855 100644 --- a/src/battle/struct/btl_tile.erl.m4 +++ b/src/battle/struct/btl_tile.erl.m4 @@ -7,16 +7,15 @@  (     tile,     { -      id :: id(), +      id :: class_id(),        name :: binary(), -      cost :: non_neg_integer(), -      class_range_min :: non_neg_integer(), -      class_range_max :: non_neg_integer() +      cost :: non_neg_integer()     }  ). --opaque id() :: non_neg_integer().  -opaque class_id() :: non_neg_integer(). +-opaque id() :: {class_id(), class_id(), non_neg_integer()}. +  -opaque type() :: #tile{}.  -export_type([type/0, class_id/0, id/0]). @@ -26,12 +25,10 @@  -export  (     [ -      get_id/1, +      get_class_id/1,        get_name/1,        get_cost/1, -      get_range_minimum/1, -      get_range_maximum/1, -      from_id/1, +      from_class_id/1,        cost_when_oob/0     ]  ). @@ -39,8 +36,17 @@  -export  (     [ -      class_id_to_type_id/1, -      class_id_from_int/1 +      id_to_int_list/1, +      id_from_ints/1 +   ] +). + +-export +( +   [ +      extract_main_class_id/1, +      extract_border_class_id/1, +      extract_variant_ix/1     ]  ). @@ -52,27 +58,27 @@  %% EXPORTED FUNCTIONS %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% --spec class_id_to_type_id (class_id()) -> id(). -class_id_to_type_id (ClassID) -> -   case ClassID of -m4_include(__MAKEFILE_DATA_DIR/tile/global.m4.conf)m4_dnl -__TILE_CLASS_USE_ERLANG_SELECT_STYLE -m4_include(__MAKEFILE_DATA_DIR/tile/grassland.m4d)m4_dnl -      _ -> 0 -   end. +-spec extract_main_class_id (id()) -> class_id(). +extract_main_class_id ({M, _, _}) -> M. --spec from_id (id()) -> type(). +-spec extract_border_class_id (id()) -> class_id(). +extract_border_class_id ({_, B, _}) -> B. + +-spec extract_variant_ix (id()) -> class_id(). +extract_variant_ix ({_, _, V}) -> V. + +-spec from_class_id (class_id()) -> type().  m4_include(__MAKEFILE_DATA_DIR/tile/global.m4.conf)m4_dnl  __TILE_CLASS_USE_ERLANG_STYLE  m4_include(__MAKEFILE_DATA_DIR/tile/grassland.m4d)m4_dnl -from_id(_) -> -   from_id(0). +from_class_id(_) -> +   from_class_id(0).  -spec cost_when_oob () -> non_neg_integer().  cost_when_oob () -> __TILE_COST_WHEN_OOB. --spec get_id (type()) -> non_neg_integer(). -get_id (Tile) -> Tile#tile.id. +-spec get_class_id (type()) -> non_neg_integer(). +get_class_id (Tile) -> Tile#tile.id.  -spec get_cost (type()) -> non_neg_integer().  get_cost (Tile) -> Tile#tile.cost. @@ -80,11 +86,11 @@ get_cost (Tile) -> Tile#tile.cost.  -spec get_name (type()) -> binary().  get_name (Tile) -> Tile#tile.name. --spec get_range_minimum (type()) -> non_neg_integer(). -get_range_minimum (Tile) -> Tile#tile.class_range_min. - --spec get_range_maximum (type()) -> non_neg_integer(). -get_range_maximum (Tile) -> Tile#tile.class_range_max. +-spec id_from_ints +   ( +      {non_neg_integer(), non_neg_integer(), non_neg_integer()} +   ) -> id(). +id_from_ints ({M, B, V}) -> {M, B, V}. --spec class_id_from_int (non_neg_integer()) -> id(). -class_id_from_int (I) -> I. +-spec id_to_int_list (id()) -> list(non_neg_integer()). +id_to_int_list ({M, B, V}) -> [M, B, V]. | 


