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.107 by root, Sat Dec 27 08:41:44 2008 UTC vs.
Revision 1.111 by root, Thu Jan 8 19:23:44 2009 UTC

294 MTH void update_buttons (); 294 MTH void update_buttons ();
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 MTH void say_msg (const char *msg, int x, int y) const;
300
301 // connected links
302 oblinkpt *find_link (shstr_tmp id);
303 MTH void trigger (shstr_tmp id, int state = 1, object *activator = 0, object *originator = 0);
299 304
300 // set the given flag on all objects in the map 305 // set the given flag on all objects in the map
301 MTH void set_object_flag (int flag, int value = 1); 306 MTH void set_object_flag (int flag, int value = 1);
302 MTH void post_load_original (); 307 MTH void post_load_original ();
303 308
489// can be used as a single statement, but both iterate macros 494// can be used as a single statement, but both iterate macros
490// invocations must not be followed by a ";" 495// invocations must not be followed by a ";"
491// see common/los.C for usage example 496// see common/los.C for usage example
492// the walk will be ordered, outer loop x, inner loop y 497// 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 498// m will be set to the map (or 0), nx, ny to the map coord, dx, dy to the offset relative to op
499// "continue" will skip to the next space
494#define ordered_mapwalk_begin(op,dx0,dy0,dx1,dy1) \ 500#define ordered_mapwalk_begin(op,dx0,dy0,dx1,dy1) \
495 for (int dx = (dx0); dx <= (dx1); ++dx) \ 501 for (int dx = (dx0); dx <= (dx1); ++dx) \
496 { \ 502 { \
497 sint16 nx, ny; \ 503 sint16 nx, ny; \
498 maptile *m = 0; \ 504 maptile *m = 0; \
514 } 520 }
515 521
516// loop over every space in the given maprect, 522// loop over every space in the given maprect,
517// 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 offste relative to dx0,dy0
518// 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
519#define rect_mapwalk(rect,dx0,dy0) \ 526#define rect_mapwalk(rect,dx0,dy0) \
520 statementvar (maptile *, m, (rect)->m) \ 527 statementvar (maptile *, m, (rect)->m) \
521 for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \ 528 for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \
522 for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \ 529 for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \
523 statementvar (int, dx, nx + (rect)->dx - (dx0)) \ 530 statementvar (int, dx, nx + (rect)->dx - (dx0)) \
524 statementvar (int, dy, ny + (rect)->dy - (dy0)) 531 statementvar (int, dy, ny + (rect)->dy - (dy0))
525 532
526// same as above, but the walk will not follow any particular 533// same as above, but the walk will not follow any particular
527// order (unorded), but is likely faster. 534// order (unorded), but is likely faster.
528// 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
529#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ 537#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \
530 for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \ 538 for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \
531 (op)->x + (dx0) , (op)->y + (dy0) , \ 539 (op)->x + (dx0) , (op)->y + (dy0) , \
532 (op)->x + (dx1) + 1, (op)->y + (dy1) + 1); \ 540 (op)->x + (dx1) + 1, (op)->y + (dy1) + 1); \
533 r_e_c_t->m; \ 541 r_e_c_t->m; \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines