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.108 by root, Sun Dec 28 08:08:24 2008 UTC vs.
Revision 1.114 by root, Mon Oct 12 14:00:58 2009 UTC

3 * 3 *
4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002-2005,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002-2005,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify it under
9 * it under the terms of the GNU General Public License as published by 9 * the terms of the Affero GNU General Public License as published by the
10 * the Free Software Foundation, either version 3 of the License, or 10 * Free Software Foundation, either version 3 of the License, or (at your
11 * (at your option) any later version. 11 * option) any later version.
12 * 12 *
13 * This program is distributed in the hope that it will be useful, 13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details. 16 * GNU General Public License for more details.
17 * 17 *
18 * You should have received a copy of the GNU General Public License 18 * You should have received a copy of the Affero GNU General Public License
19 * along with this program. If not, see <http://www.gnu.org/licenses/>. 19 * and the GNU General Public License along with this program. If not, see
20 * <http://www.gnu.org/licenses/>.
20 * 21 *
21 * The authors can be reached via e-mail to <support@deliantra.net> 22 * The authors can be reached via e-mail to <support@deliantra.net>
22 */ 23 */
23 24
24/* 25/*
134 MoveType ACC (RW, move_off); /* What movement types are activated */ 135 MoveType ACC (RW, move_off); /* What movement types are activated */
135 136
136 void update_ (); 137 void update_ ();
137 MTH void update () 138 MTH void update ()
138 { 139 {
139 if (!(flags_ & P_UPTODATE)) 140 if (expect_false (!(flags_ & P_UPTODATE)))
140 update_ (); 141 update_ ();
141 } 142 }
142 143
143 MTH uint8 flags () 144 MTH uint8 flags ()
144 { 145 {
294 MTH void update_buttons (); 295 MTH void update_buttons ();
295 MTH int change_map_light (int change); 296 MTH int change_map_light (int change);
296 MTH int estimate_difficulty () const; 297 MTH int estimate_difficulty () const;
297 298
298 MTH void play_sound (faceidx sound, int x, int y) const; 299 MTH void play_sound (faceidx sound, int x, int y) const;
300 MTH void say_msg (const char *msg, int x, int y) const;
301
302 // connected links
303 oblinkpt *find_link (shstr_tmp id);
304 MTH void trigger (shstr_tmp id, int state = 1, object *activator = 0, object *originator = 0);
299 305
300 // set the given flag on all objects in the map 306 // set the given flag on all objects in the map
301 MTH void set_object_flag (int flag, int value = 1); 307 MTH void set_object_flag (int flag, int value = 1);
302 MTH void post_load_original (); 308 MTH void post_load_original ();
303 309
398// and so on. 404// and so on.
399int get_map_flags (maptile *oldmap, maptile **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny); 405int get_map_flags (maptile *oldmap, maptile **newmap, sint16 x, sint16 y, sint16 *nx, sint16 *ny);
400int out_of_map (maptile *m, int x, int y); 406int out_of_map (maptile *m, int x, int y);
401maptile *get_map_from_coord (maptile *m, sint16 *x, sint16 *y); 407maptile *get_map_from_coord (maptile *m, sint16 *x, sint16 *y);
402void get_rangevector (object *op1, object *op2, rv_vector *retval, int flags); 408void get_rangevector (object *op1, object *op2, rv_vector *retval, int flags);
403void get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector *retval, int flags); 409void get_rangevector_from_mapcoord (const maptile *m, int x, int y, const object *op2, rv_vector *retval, int flags = 0 /*unused*/);
404int on_same_map (const object *op1, const object *op2); 410int on_same_map (const object *op1, const object *op2);
405int adjacent_map (const maptile *map1, const maptile *map2, int *dx, int *dy); 411int adjacent_map (const maptile *map1, const maptile *map2, int *dx, int *dy);
406 412
407// adjust map, x and y for tiled maps and return true if the position is valid at all 413// adjust map, x and y for tiled maps and return true if the position is valid at all
408static inline bool 414static inline bool
513#define ordered_mapwalk_end \ 519#define ordered_mapwalk_end \
514 } \ 520 } \
515 } 521 }
516 522
517// loop over every space in the given maprect, 523// loop over every space in the given maprect,
518// setting m, nx, ny to the map and -coordinate and dx, dy to the offste relative to dx0,dy0 524// setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0
519// the iterator code must be a single statement following this macro call, similar to "if" 525// the iterator code must be a single statement following this macro call, similar to "if"
520// "continue" will skip to the next space 526// "continue" will skip to the next space
521#define rect_mapwalk(rect,dx0,dy0) \ 527#define rect_mapwalk(rect,dx0,dy0) \
522 statementvar (maptile *, m, (rect)->m) \ 528 statementvar (maptile *, m, (rect)->m) \
523 for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \ 529 for (int nx = (rect)->x0; nx < (rect)->x1; ++nx) \
524 for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \ 530 for (int ny = (rect)->y0; ny < (rect)->y1; ++ny) \
525 statementvar (int, dx, nx + (rect)->dx - (dx0)) \ 531 statementvar (int, dx, nx + (rect)->dx - (dx0)) \
526 statementvar (int, dy, ny + (rect)->dy - (dy0)) 532 statementvar (int, dy, ny + (rect)->dy - (dy0))
527 533
528// same as above, but the walk will not follow any particular 534// same as ordered_mapwalk, but the walk will not follow any particular
529// order (unorded), but is likely faster. 535// 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 536// m will be set to the map (never 0!), nx, ny to the map coord, dx, dy to the offset relative to op
531// "continue" will skip to the next space 537// "continue" will skip to the next space
532#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \ 538#define unordered_mapwalk(op,dx0,dy0,dx1,dy1) \
533 for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \ 539 for (maprect *r_e_c_t = (op)->map->split_to_tiles ( \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines