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.106 by root, Sat Dec 27 04:07:44 2008 UTC vs.
Revision 1.110 by root, Thu Jan 8 04:35:04 2009 UTC

295 MTH int change_map_light (int change); 295 MTH int change_map_light (int change);
296 MTH int estimate_difficulty () const; 296 MTH int estimate_difficulty () const;
297 297
298 MTH void play_sound (faceidx sound, int x, int y) const; 298 MTH void play_sound (faceidx sound, int x, int y) const;
299 299
300 // connected links
301 oblinkpt *find_link (shstr_tmp id);
302 MTH void trigger (shstr_tmp id, bool state = true, object *activator = 0, object *originator = 0);
303
300 // set the given flag on all objects in the map 304 // set the given flag on all objects in the map
301 MTH void set_object_flag (int flag, int value = 1); 305 MTH void set_object_flag (int flag, int value = 1);
302 MTH void post_load_original (); 306 MTH void post_load_original ();
303 307
304 MTH void link_multipart_objects (); 308 MTH void link_multipart_objects ();
489// can be used as a single statement, but both iterate macros 493// can be used as a single statement, but both iterate macros
490// invocations must not be followed by a ";" 494// invocations must not be followed by a ";"
491// see common/los.C for usage example 495// see common/los.C for usage example
492// the walk will be ordered, outer loop x, inner loop y 496// the walk will be ordered, outer loop x, inner loop y
493// m will be set to the map (or 0), nx, ny to the map coord, dx, dy to the offset relative to op 497// m will be set to the map (or 0), nx, ny to the map coord, dx, dy to the offset relative to op
498// "continue" will skip to the next space
494#define ordered_mapwalk_begin(op,dx0,dy0,dx1,dy1) \ 499#define ordered_mapwalk_begin(op,dx0,dy0,dx1,dy1) \
495 for (int dx = (dx0); dx <= (dx1); ++dx) \ 500 for (int dx = (dx0); dx <= (dx1); ++dx) \
496 { \ 501 { \
497 sint16 nx, ny; \ 502 sint16 nx, ny; \
498 maptile *m = 0; \ 503 maptile *m = 0; \
503 /* if not, do it the slow way */ \ 508 /* if not, do it the slow way */ \
504 if (!m || ++ny >= m->height) \ 509 if (!m || ++ny >= m->height) \
505 { \ 510 { \
506 nx = (op)->x + dx; ny = (op)->y + dy; m = (op)->map; \ 511 nx = (op)->x + dx; ny = (op)->y + dy; m = (op)->map; \
507 \ 512 \
508 if (xy_normalise (m, nx, ny)) \ 513 if (!xy_normalise (m, nx, ny)) \
509 m->touch (); \
510 else \
511 m = 0; \ 514 m = 0; \
512 } 515 }
513 516
514#define ordered_mapwalk_end \ 517#define ordered_mapwalk_end \
515 } \ 518 } \
516 } 519 }
517 520
518// loop over every space in the given maprect, 521// loop over every space in the given maprect,
519// setting m, nx, ny to the map and -coordinate and dx, dy to the offste relative to dx0,dy0 522// setting m, nx, ny to the map and -coordinate and dx, dy to the offste relative to dx0,dy0
520// the iterator code must be a single statement following this macro call, similar to "if" 523// the iterator code must be a single statement following this macro call, similar to "if"
524// "continue" will skip to the next space
521#define rect_mapwalk(rect,dx0,dy0) \ 525#define rect_mapwalk(rect,dx0,dy0) \
522 statementvar (maptile *, m, (rect)->m) \ 526 statementvar (maptile *, m, (rect)->m) \
523 for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \ 527 for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \
524 for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \ 528 for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \
525 statementvar (int, dx, nx + (rect)->dx - (dx0)) \ 529 statementvar (int, dx, nx + (rect)->dx - (dx0)) \
526 statementvar (int, dy, ny + (rect)->dy - (dy0)) 530 statementvar (int, dy, ny + (rect)->dy - (dy0))
527 531
528// same as above, but the walk will not follow any particular 532// same as above, but the walk will not follow any particular
529// order (unorded), but is likely faster. 533// order (unorded), but is likely faster.
530// m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op 534// m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op
535// "continue" will skip to the next space
531#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ 536#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \
532 for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \ 537 for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \
533 (op)->x + (dx0) , (op)->y + (dy0) , \ 538 (op)->x + (dx0) , (op)->y + (dy0) , \
534 (op)->x + (dx1) + 1, (op)->y + (dy1) + 1); \ 539 (op)->x + (dx1) + 1, (op)->y + (dy1) + 1); \
535 r_e_c_t->m; \ 540 r_e_c_t->m; \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines