ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/map.h
(Generate patch)

Comparing deliantra/server/include/map.h (file contents):
Revision 1.127 by root, Sat Jan 16 17:57:32 2010 UTC vs.
Revision 1.128 by root, Sun Feb 7 04:22:33 2010 UTC

399 mapspace &at (uint32 x, uint32 y) const { return spaces [x * height + y]; } 399 mapspace &at (uint32 x, uint32 y) const { return spaces [x * height + y]; }
400 400
401 // return an array of maprects corresponding 401 // return an array of maprects corresponding
402 // to the given rectangular area. the last rect will have 402 // to the given rectangular area. the last rect will have
403 // a 0 map pointer. 403 // a 0 map pointer.
404 // the array will be stored in a static memory area,
405 // so recursion is not atm. supported
406 maprect *split_to_tiles (int x0, int y0, int x1, int y1); 404 maprect *split_to_tiles (dynbuf &buf, int x0, int y0, int x1, int y1);
407}; 405};
408 406
409//+GPL 407//+GPL
410 408
411/* This is used by get_rangevector to determine where the other 409/* This is used by get_rangevector to determine where the other
547 545
548#define ordered_mapwalk_end \ 546#define ordered_mapwalk_end \
549 } \ 547 } \
550 } 548 }
551 549
550extern dynbuf mapwalk_buf; // can be used in simple non-recursive situations
551
552// loop over every space in the given maprect, 552// loop over every space in the given maprect,
553// setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0 553// setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0
554// the iterator code must be a single statement following this macro call, similar to "if" 554// the iterator code must be a single statement following this macro call, similar to "if"
555// "continue" will skip to the next space 555// "continue" will skip to the next space
556#define rect_mapwalk(rect,dx0,dy0) \ 556#define rect_mapwalk(rect,dx0,dy0) \
562 562
563// same as ordered_mapwalk, but the walk will not follow any particular 563// same as ordered_mapwalk, but the walk will not follow any particular
564// order (unorded), but is likely faster. 564// order (unorded), but is likely faster.
565// m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op 565// m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op
566// "continue" will skip to the next space 566// "continue" will skip to the next space
567#define unordered_mapwalk_at(map,ox,oy,dx0,dy0,dx1,dy1) \ 567#define unordered_mapwalk_at(buf,map,ox,oy,dx0,dy0,dx1,dy1) \
568 for (maprect *r_e_c_t = (map)->split_to_tiles ( \ 568 for (maprect *r_e_c_t = (map)->split_to_tiles (buf, \
569 (ox) + (dx0) , (oy) + (dy0) , \ 569 (ox) + (dx0) , (oy) + (dy0) , \
570 (ox) + (dx1) + 1, (oy) + (dy1) + 1); \ 570 (ox) + (dx1) + 1, (oy) + (dy1) + 1); \
571 r_e_c_t->m; \ 571 r_e_c_t->m; \
572 ++r_e_c_t) \ 572 ++r_e_c_t) \
573 rect_mapwalk (r_e_c_t, (ox), (oy)) 573 rect_mapwalk (r_e_c_t, (ox), (oy))
574 574
575#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ 575#define unordered_mapwalk(buf,op,dx0,dy0,dx1,dy1) \
576 unordered_mapwalk_at (op->map, op->x, op->y, dx0, dy0, dx1, dy1) 576 unordered_mapwalk_at (buf,op->map, op->x, op->y, dx0, dy0, dx1, dy1)
577 577
578#endif 578#endif
579 579

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines