… | |
… | |
458 | y = pos.y; |
458 | y = pos.y; |
459 | |
459 | |
460 | return pos; |
460 | return pos; |
461 | } |
461 | } |
462 | |
462 | |
|
|
463 | // iterate over a rectangular area relative to op |
|
|
464 | // can be used as a single statement, but both iterate macros |
|
|
465 | // invocations must not be followed by a ";" |
|
|
466 | // see common/los.C for usage example |
|
|
467 | #define rectangular_mapspace_iterate_begin(op,dx0,dx1,dy0,dy1) \ |
|
|
468 | for (int dx = (dx0); dx <= (dx1); dx++) \ |
|
|
469 | { \ |
|
|
470 | sint16 nx, ny; \ |
|
|
471 | maptile *m = 0; \ |
|
|
472 | \ |
|
|
473 | for (int dy = (dy0); dy <= (dy1); dy++) \ |
|
|
474 | { \ |
|
|
475 | /* check to see if we can simply go one down quickly, */ \ |
|
|
476 | /* if not, due it the slow way */ \ |
|
|
477 | if (!m || ++ny >= m->height) \ |
|
|
478 | { \ |
|
|
479 | nx = (op)->x + dx; ny = (op)->y + dy; m = (op)->map; \ |
|
|
480 | \ |
|
|
481 | if (xy_normalise (m, nx, ny)) \ |
|
|
482 | m->touch (); \ |
|
|
483 | else \ |
|
|
484 | m = 0; \ |
|
|
485 | } |
|
|
486 | |
|
|
487 | #define rectangular_mapspace_iterate_end \ |
|
|
488 | } \ |
|
|
489 | } |
|
|
490 | |
463 | #endif |
491 | #endif |
464 | |
492 | |