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.145 by root, Sat May 7 20:03:28 2011 UTC vs.
Revision 1.149 by elmex, Fri Jun 3 08:36:45 2011 UTC

55// tile map index - toggling the lowest bit reverses direction 55// tile map index - toggling the lowest bit reverses direction
56enum 56enum
57{ 57{
58 TILE_NORTH, 58 TILE_NORTH,
59 TILE_SOUTH, 59 TILE_SOUTH,
60 TILE_EAST ,
61 TILE_WEST, 60 TILE_WEST,
61 TILE_EAST,
62 TILE_UP, 62 TILE_UP,
63 TILE_DOWN, 63 TILE_DOWN,
64 TILE_NUM 64 TILE_NUM
65}; 65};
66 66
328//-GPL 328//-GPL
329 329
330 physics_queue pq[PHYSICS_QUEUES]; 330 physics_queue pq[PHYSICS_QUEUES];
331 MTH void queue_physics (object *ob, int after = 0); 331 MTH void queue_physics (object *ob, int after = 0);
332 MTH void queue_physics_at (int x, int y); 332 MTH void queue_physics_at (int x, int y);
333 MTH void post_load_physics ();
334 MTH int run_physics (tick_t tick, int max_objects); 333 MTH int run_physics (tick_t tick, int max_objects);
334 MTH void activate_physics ();
335 335
336 // the maptile:: is neccessary here for the perl interface to work 336 // the maptile:: is neccessary here for the perl interface to work
337 MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const 337 MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const
338 { 338 {
339 return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS); 339 return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS);
340 } 340 }
341 341
342 static void adjust_daylight (); 342 static void adjust_daylight ();
343 343
344 MTH void activate (); 344 MTH void activate ();
345 MTH void activate_physics ();
346 MTH void deactivate (); 345 MTH void deactivate ();
347 346
348 // allocates all (empty) mapspace 347 // allocates all (empty) mapspace
349 MTH void alloc (); 348 MTH void alloc ();
350 // deallocates the mapspaces (and destroys all objects) 349 // deallocates the mapspaces (and destroys all objects)
406 405
407 MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0); 406 MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0);
408 407
409 MTH void touch () { last_access = runtime; } 408 MTH void touch () { last_access = runtime; }
410 409
410 // returns the map at given direction. if the map isn't linked yet,
411 // it will either return false (if load is false), or otherwise try to link
412 // it - if linking fails because the map is not loaded yet, it will
413 // start loading the map and return 0.
414 // thus, if you get 0, the map exists and load is true, then some later
415 // call (some tick or so later...) will eventually succeed.
411 MTH maptile *tile_available (int dir, bool load = true); 416 MTH maptile *tile_available (int dir, bool load = true);
412 417
413 // find the map that is at coordinate x|y relative to this map 418 // find the map that is at coordinate x|y relative to this map
414 // TODO: need a better way than passing by reference 419 // TODO: need a better way than passing by reference
415 // TODO: make perl interface 420 // TODO: make perl interface
595 } \ 600 } \
596 } 601 }
597 602
598extern dynbuf mapwalk_buf; // can be used in simple non-recursive situations 603extern dynbuf mapwalk_buf; // can be used in simple non-recursive situations
599 604
605// special "grave" map used to store all removed objects
606// till they can be destroyed - saves a lot of checks in the rest
607// of the code
608struct freed_map
609: maptile
610{
611 freed_map ()
612 : maptile (3, 3)
613 {
614 path = "<freed objects map>";
615 name = "/internal/freed_objects_map";
616 no_drop = 1;
617 no_reset = 1;
618
619 state = MAP_ACTIVE;
620 }
621
622 ~freed_map ()
623 {
624 destroy ();
625 }
626};
627
628// initialised in common/shstr.C, due to shstr usage we need defined
629// initialisation order!
630extern struct freed_map freed_map; // freed objects are moved here to avoid crashes
631
600// loop over every space in the given maprect, 632// loop over every space in the given maprect,
601// setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0 633// setting m, nx, ny to the map and -coordinate and dx, dy to the offset relative to dx0,dy0
602// the iterator code must be a single statement following this macro call, similar to "if" 634// the iterator code must be a single statement following this macro call, similar to "if"
603// "continue" will skip to the next space 635// "continue" will skip to the next space
604#define rect_mapwalk(rect,dx0,dy0) \ 636#define rect_mapwalk(rect,dx0,dy0) \

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines