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.98 by root, Sun Aug 17 22:46:26 2008 UTC vs.
Revision 1.103 by root, Tue Dec 23 22:03:06 2008 UTC

63 * where it is known the map is not tiled or the values are known 63 * where it is known the map is not tiled or the values are known
64 * consistent (eg, op->map, op->x, op->y) 64 * consistent (eg, op->map, op->x, op->y)
65 */ 65 */
66// all those macros are herewith declared legacy 66// all those macros are herewith declared legacy
67#define GET_MAP_FLAGS(M,X,Y) (M)->at((X),(Y)).flags () 67#define GET_MAP_FLAGS(M,X,Y) (M)->at((X),(Y)).flags ()
68#define GET_MAP_LIGHT(M,X,Y) (M)->at((X),(Y)).light
69#define GET_MAP_OB(M,X,Y) (M)->at((X),(Y)).bot 68#define GET_MAP_OB(M,X,Y) (M)->at((X),(Y)).bot
70#define GET_MAP_TOP(M,X,Y) (M)->at((X),(Y)).top 69#define GET_MAP_TOP(M,X,Y) (M)->at((X),(Y)).top
71#define GET_MAP_FACE_OBJ(M,X,Y,L) (M)->at((X),(Y)).faces_obj[L] 70#define GET_MAP_FACE_OBJ(M,X,Y,L) (M)->at((X),(Y)).faces_obj[L]
72#define GET_MAP_MOVE_BLOCK(M,X,Y) (M)->at((X),(Y)).move_block 71#define GET_MAP_MOVE_BLOCK(M,X,Y) (M)->at((X),(Y)).move_block
73#define GET_MAP_MOVE_SLOW(M,X,Y) (M)->at((X),(Y)).move_slow 72#define GET_MAP_MOVE_SLOW(M,X,Y) (M)->at((X),(Y)).move_slow
134 133
135 MTH uint8 flags () 134 MTH uint8 flags ()
136 { 135 {
137 update (); 136 update ();
138 return flags_; 137 return flags_;
138 }
139
140 MTH void invalidate ()
141 {
142 flags_ = 0;
139 } 143 }
140 144
141 MTH object *player () 145 MTH object *player ()
142 { 146 {
143 object *op; 147 object *op;
223 227
224 bool ACC (RW, per_player); 228 bool ACC (RW, per_player);
225 bool ACC (RW, per_party); 229 bool ACC (RW, per_party);
226 bool ACC (RW, outdoor); /* True if an outdoor map */ 230 bool ACC (RW, outdoor); /* True if an outdoor map */
227 bool ACC (RW, no_drop); /* avoid auto-dropping (on death) anything on this map */ 231 bool ACC (RW, no_drop); /* avoid auto-dropping (on death) anything on this map */
228 uint8 ACC (RW, darkness); /* indicates level of darkness of map */ 232 sint8 ACC (RW, darkness); /* indicates level of darkness of map */
233 static sint8 outdoor_darkness; /* the global darkness level outside */
229 234
230 uint16 ACC (RW, enter_x); /* enter_x and enter_y are default entrance location */ 235 uint16 ACC (RW, enter_x); /* enter_x and enter_y are default entrance location */
231 uint16 ACC (RW, enter_y); /* on the map if none are set in the exit */ 236 uint16 ACC (RW, enter_y); /* on the map if none are set in the exit */
232 oblinkpt *buttons; /* Linked list of linked lists of buttons */ 237 oblinkpt *buttons; /* Linked list of linked lists of buttons */
233 sint16 ACC (RW, temp); /* base temperature of this tile (F) */ 238 sint16 ACC (RW, temp); /* base temperature of this tile (F) */
248 maptile *ACC (RW, tile_map[4]); /* Next map, linked list */ 253 maptile *ACC (RW, tile_map[4]); /* Next map, linked list */
249 shstr ACC (RW, path); /* Filename of the map */ 254 shstr ACC (RW, path); /* Filename of the map */
250 int ACC (RW, max_nrof); // maximum nrof of any single item on a mapspace 255 int ACC (RW, max_nrof); // maximum nrof of any single item on a mapspace
251 uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace 256 uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace
252 257
258 // the maptile:: is neccessary here for the perl interface to work
259 MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const
260 {
261 return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS);
262 }
263
264 static void adjust_daylight ();
265
253 MTH void activate (); 266 MTH void activate ();
254 MTH void deactivate (); 267 MTH void deactivate ();
255 268
256 // allocates all (empty) mapspace 269 // allocates all (empty) mapspace
257 MTH void alloc (); 270 MTH void alloc ();
260 273
261 MTH void fix_auto_apply (); 274 MTH void fix_auto_apply ();
262 MTH void do_decay_objects (); 275 MTH void do_decay_objects ();
263 MTH void update_buttons (); 276 MTH void update_buttons ();
264 MTH int change_map_light (int change); 277 MTH int change_map_light (int change);
265 static void change_all_map_light (int change); //PERL
266 MTH void set_darkness_map ();
267 MTH int estimate_difficulty () const; 278 MTH int estimate_difficulty () const;
268 279
269 MTH void play_sound (faceidx sound, int x, int y) const; 280 MTH void play_sound (faceidx sound, int x, int y) const;
270 281
271 // set the given flag on all objects in the map 282 // set the given flag on all objects in the map
334 static maptile *find_async (const char *path, maptile *original = 0, bool load = true);//PERL 345 static maptile *find_async (const char *path, maptile *original = 0, bool load = true);//PERL
335 static maptile *find_sync (const char *path, maptile *original = 0);//PERL 346 static maptile *find_sync (const char *path, maptile *original = 0);//PERL
336 static maptile *find_style_sync (const char *dir, const char *file = 0);//PERL 347 static maptile *find_style_sync (const char *dir, const char *file = 0);//PERL
337 object *pick_random_object (rand_gen &gen = rndm) const; 348 object *pick_random_object (rand_gen &gen = rndm) const;
338 349
339 mapspace const &at (uint32 x, uint32 y) const { return spaces [x * height + y]; } 350 mapspace &at (uint32 x, uint32 y) const { return spaces [x * height + y]; }
340 mapspace &at (uint32 x, uint32 y) { return spaces [x * height + y]; }
341}; 351};
342 352
343/* This is used by get_rangevector to determine where the other 353/* This is used by get_rangevector to determine where the other
344 * creature is. get_rangevector takes into account map tiling, 354 * creature is. get_rangevector takes into account map tiling,
345 * so you just can not look the the map coordinates and get the 355 * so you just can not look the the map coordinates and get the
448 y = pos.y; 458 y = pos.y;
449 459
450 return pos; 460 return pos;
451} 461}
452 462
463// iterate over a rectangular area relative to op
464// can be used as a single statement, but both iterate macros
465// invocations must not be followed by a ";"
466// see common/los.C for usage example
467#define rectangular_mapspace_iterate_begin(op,dx0,dx1,dy0,dy1) \
468 for (int dx = (dx0); dx <= (dx1); dx++) \
469 { \
470 sint16 nx, ny; \
471 maptile *m = 0; \
472 \
473 for (int dy = (dy0); dy <= (dy1); dy++) \
474 { \
475 /* check to see if we can simply go one down quickly, */ \
476 /* if not, due it the slow way */ \
477 if (!m || ++ny >= m->height) \
478 { \
479 nx = (op)->x + dx; ny = (op)->y + dy; m = (op)->map; \
480 \
481 if (xy_normalise (m, nx, ny)) \
482 m->touch (); \
483 else \
484 m = 0; \
485 }
486
487#define rectangular_mapspace_iterate_end \
488 } \
489 }
490
453#endif 491#endif
454 492

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines