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.137 by root, Tue May 3 04:40:29 2011 UTC vs.
Revision 1.140 by root, Wed May 4 19:04:44 2011 UTC

61 TILE_UP, 61 TILE_UP,
62 TILE_DOWN, 62 TILE_DOWN,
63 TILE_NUM, 63 TILE_NUM,
64}; 64};
65 65
66/* Values for in_memory below */ 66/* Values for state below */
67enum { 67enum {
68 MAP_ACTIVE, 68 MAP_SWAPPED, // header loaded, nothing else
69 MAP_INACTIVE, // not used atm. 69 MAP_INACTIVE, // in memory, linkable, but not active
70 MAP_SWAPPED, 70 MAP_ACTIVE, // running!
71 MAP_LOADING,
72 MAP_SAVING,
73}; 71};
74 72
75/* GET_MAP_FLAGS really shouldn't be used very often - get_map_flags should 73/* GET_MAP_FLAGS really shouldn't be used very often - get_map_flags should
76 * really be used, as it is multi tile aware. However, there are some cases 74 * really be used, as it is multi tile aware. However, there are some cases
77 * where it is known the map is not tiled or the values are known 75 * where it is known the map is not tiled or the values are known
216 int x0, y0; 214 int x0, y0;
217 int x1, y1; 215 int x1, y1;
218 int dx, dy; // offset to go from local coordinates to original tile */ 216 int dx, dy; // offset to go from local coordinates to original tile */
219}; 217};
220 218
219// (refcounted) list of objects on this map that need physics processing
220struct physics_queue
221: unordered_vector<object *>
222{
223 int i; // already processed
224 physics_queue ();
225 object *pop ();
226};
227
228#define PHYSICS_QUEUES 16 // "activity" at least every 16 ticks
229
221//+GPL 230//+GPL
222 231
223struct shopitems : zero_initialised 232struct shopitems : zero_initialised
224{ 233{
225 const char *name; /* name of the item in question, null if it is the default item */ 234 const char *name; /* name of the item in question, null if it is the default item */
266 bool ACC (RW, dirty); /* if true, something was inserted or removed */ 275 bool ACC (RW, dirty); /* if true, something was inserted or removed */
267 bool ACC (RW, no_reset); // must not reset this map 276 bool ACC (RW, no_reset); // must not reset this map
268 bool ACC (RW, fixed_resettime); /* if true, reset time is not affected by 277 bool ACC (RW, fixed_resettime); /* if true, reset time is not affected by
269 * players entering/exiting map 278 * players entering/exiting map
270 */ 279 */
280 uint8 ACC (RW, state); /* If not true, the map has been freed and must
281 * be loaded before used. The map,omap and map_ob
282 * arrays will be allocated when the map is loaded */
271 sint32 ACC (RW, timeout); /* swapout is set to this */ 283 sint32 ACC (RW, timeout); /* swapout is set to this */
272 sint32 ACC (RW, swap_time); /* When it reaches 0, the map will be swapped out */ 284 sint32 ACC (RW, swap_time); /* When it reaches 0, the map will be swapped out */
273 uint32 ACC (RW, in_memory); /* If not true, the map has been freed and must
274 * be loaded before used. The map,omap and map_ob
275 * arrays will be allocated when the map is loaded */
276 sint16 players; /* How many players are on this map right now */ 285 sint16 players; /* How many players are on this map right now */
277 uint16 ACC (RW, difficulty); /* What level the player should be to play here */ 286 uint16 ACC (RW, difficulty); /* What level the player should be to play here */
278 287
279 bool ACC (RW, per_player); 288 bool ACC (RW, per_player);
280 bool ACC (RW, per_party); 289 bool ACC (RW, per_party);
299 uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace 308 uint64 ACC (RW, max_volume); // maximum volume for all items on a mapspace
300 int ACC (RW, max_items); // maximum number of items on a mapspace 309 int ACC (RW, max_items); // maximum number of items on a mapspace
301 310
302//-GPL 311//-GPL
303 312
313 physics_queue pq[PHYSICS_QUEUES];
314 MTH void queue_physics (object *ob);
315 MTH void queue_physics_at (int x, int y);
316 MTH void post_load_physics ();
317 MTH int run_physics (tick_t tick, int max_objects);
318
304 // the maptile:: is neccessary here for the perl interface to work 319 // the maptile:: is neccessary here for the perl interface to work
305 MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const 320 MTH sint8 darklevel (sint8 outside = maptile::outdoor_darkness) const
306 { 321 {
307 return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS); 322 return clamp (outdoor ? darkness + outside : darkness, 0, MAX_DARKNESS);
308 } 323 }
364 void init (); 379 void init ();
365 ~maptile (); 380 ~maptile ();
366 381
367 void do_destroy (); 382 void do_destroy ();
368 void gather_callbacks (AV *&callbacks, event_type event) const; 383 void gather_callbacks (AV *&callbacks, event_type event) const;
384
385 MTH bool linkable () { return state >= MAP_INACTIVE; }
369 386
370 MTH int size () const { return width * height; } 387 MTH int size () const { return width * height; }
371 388
372 MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0); 389 MTH object *insert (object *op, int x, int y, object *originator = 0, int flags = 0);
373 390

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines