diff options
author | Bardur Arantsson <bardur@scientician.net> | 2015-03-07 16:55:42 +0100 |
---|---|---|
committer | Bardur Arantsson <bardur@scientician.net> | 2015-03-07 16:55:42 +0100 |
commit | 9f1d3f9c27ae3dc717ec781e14fd44626f223641 (patch) | |
tree | 4726ede75f4c1159237e027b99545a83a51b3866 /src/spells1.cc | |
parent | 45fac786776f6664727daf160919f22313061017 (diff) |
Move GRID, GRID_{X,Y} macros to spells1.cc
Diffstat (limited to 'src/spells1.cc')
-rw-r--r-- | src/spells1.cc | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/spells1.cc b/src/spells1.cc index 180fdd75..a619c002 100644 --- a/src/spells1.cc +++ b/src/spells1.cc @@ -50,6 +50,23 @@ using std::chrono::milliseconds; /* Maximum number of tries for teleporting */ #define MAX_TRIES 100 +/* + * Convert a "location" (Y,X) into a "grid" (G) + */ +#define GRID(Y,X) \ + (256 * (Y) + (X)) + +/* + * Convert a "grid" (G) into a "location" (Y) + */ +#define GRID_Y(G) \ + ((int)((G) / 256U)) + +/* + * Convert a "grid" (G) into a "location" (X) + */ +#define GRID_X(G) \ + ((int)((G) % 256U)) /* * Helper function -- return a "nearby" race for polymorphing |