… | |
… | |
42 | * map pointers. |
42 | * map pointers. |
43 | */ |
43 | */ |
44 | #define MAGIC_MAP_SIZE 50 |
44 | #define MAGIC_MAP_SIZE 50 |
45 | #define MAGIC_MAP_HALF MAGIC_MAP_SIZE/2 |
45 | #define MAGIC_MAP_HALF MAGIC_MAP_SIZE/2 |
46 | |
46 | |
47 | #define MAP_LAYERS 4 |
47 | #define MAP_LAYERS 3 |
48 | |
48 | |
49 | /* This is when the map will reset */ |
49 | /* This is when the map will reset */ |
50 | #define MAP_WHEN_RESET(m) ((m)->reset_time) |
50 | #define MAP_WHEN_RESET(m) ((m)->reset_time) |
51 | |
51 | |
52 | #define MAP_RESET_TIMEOUT(m) ((m)->reset_timeout) |
52 | #define MAP_RESET_TIMEOUT(m) ((m)->reset_timeout) |
… | |
… | |
182 | } |
182 | } |
183 | |
183 | |
184 | // maybe only inline quick flags_ checking? |
184 | // maybe only inline quick flags_ checking? |
185 | object *player () |
185 | object *player () |
186 | { |
186 | { |
|
|
187 | // search from the top, because players are usually on top |
|
|
188 | // make usually == always and this non-amortized O(1) |
|
|
189 | // could gte rid of P_PLAYER, too, then |
187 | if (flags () & P_PLAYER) |
190 | if (flags () & P_PLAYER) |
188 | for (object *op = bottom; op; op = op->above) |
191 | for (object *op = top; op; op = op->below) |
189 | if (op->type == PLAYER) |
192 | if (op->type == PLAYER) |
190 | return op; |
193 | return op; |
191 | |
194 | |
192 | return 0; |
195 | return 0; |
193 | } |
196 | } |
… | |
… | |
342 | int distance_y; |
345 | int distance_y; |
343 | int direction; |
346 | int direction; |
344 | object *part; |
347 | object *part; |
345 | }; |
348 | }; |
346 | |
349 | |
|
|
350 | inline mapspace & |
|
|
351 | object::ms () const |
|
|
352 | { |
|
|
353 | return map->at (x, y); |
|
|
354 | } |
|
|
355 | |
347 | #endif |
356 | #endif |
348 | |
357 | |