… | |
… | |
518 | #define ordered_mapwalk_end \ |
518 | #define ordered_mapwalk_end \ |
519 | } \ |
519 | } \ |
520 | } |
520 | } |
521 | |
521 | |
522 | // loop over every space in the given maprect, |
522 | // loop over every space in the given maprect, |
523 | // setting m, nx, ny to the map and -coordinate and dx, dy to the offste relative to dx0,dy0 |
523 | // setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0 |
524 | // the iterator code must be a single statement following this macro call, similar to "if" |
524 | // the iterator code must be a single statement following this macro call, similar to "if" |
525 | // "continue" will skip to the next space |
525 | // "continue" will skip to the next space |
526 | #define rect_mapwalk(rect,dx0,dy0) \ |
526 | #define rect_mapwalk(rect,dx0,dy0) \ |
527 | statementvar (maptile *, m, (rect)->m) \ |
527 | statementvar (maptile *, m, (rect)->m) \ |
528 | for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \ |
528 | for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \ |
529 | for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \ |
529 | for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \ |
530 | statementvar (int, dx, nx + (rect)->dx - (dx0)) \ |
530 | statementvar (int, dx, nx + (rect)->dx - (dx0)) \ |
531 | statementvar (int, dy, ny + (rect)->dy - (dy0)) |
531 | statementvar (int, dy, ny + (rect)->dy - (dy0)) |
532 | |
532 | |
533 | // same as above, but the walk will not follow any particular |
533 | // same as ordered_mapwalk, but the walk will not follow any particular |
534 | // order (unorded), but is likely faster. |
534 | // order (unorded), but is likely faster. |
535 | // m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op |
535 | // m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op |
536 | // "continue" will skip to the next space |
536 | // "continue" will skip to the next space |
537 | #define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ |
537 | #define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ |
538 | for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \ |
538 | for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \ |