ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/object.h
(Generate patch)

Comparing deliantra/server/include/object.h (file contents):
Revision 1.74 by elmex, Sat Dec 30 21:07:46 2006 UTC vs.
Revision 1.80 by pippijn, Sat Jan 6 14:42:30 2007 UTC

1/* 1/*
2 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
3 3
4 Copyright (C) 2005, 2006, 2007 Marc Lehmann & Crossfire+ Development Team
4 Copyright (C) 2001 Mark Wedel & Crossfire Development Team 5 Copyright (C) 2001 Mark Wedel & Crossfire Development Team
5 Copyright (C) 1992 Frank Tore Johansen 6 Copyright (C) 1992 Frank Tore Johansen
6 7
7 This program is free software; you can redistribute it and/or modify 8 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by 9 it under the terms of the GNU General Public License as published by
240 */ 241 */
241 object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ 242 object *ACC (RW, more); /* Pointer to the rest of a large body of objects */
242 object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different 243 object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different
243 client_container *seen_by; // seen by which player/container currently? 244 client_container *seen_by; // seen by which player/container currently?
244 245
245 static vector active; // active objects, not yet used 246 //static vector active_list; // active objects, not yet used
246 static vector objects; // not used yet, use first->next->... 247 //static vector object_list; // not used yet, use first->next->...
247 static object *first; // will be replaced by "objects" 248 static object *first; // will be replaced by "objects"
248 249
249 MTH static object *create (); 250 MTH static object *create ();
250 MTH void copy_to (object *dst); 251 MTH void copy_to (object *dst);
251 MTH object *clone (); // create + copy_to 252 MTH object *clone (); // create + copy_to
290 MTH void change_luck (int value); 291 MTH void change_luck (int value);
291 292
292 // info must hold 256 * 3 bytes currently 293 // info must hold 256 * 3 bytes currently
293 const char *debug_desc (char *info) const; 294 const char *debug_desc (char *info) const;
294 MTH const char *debug_desc () const; 295 MTH const char *debug_desc () const;
295 const char *object::flag_desc (char *desc, int len) const; 296 const char *flag_desc (char *desc, int len) const;
296 297
297 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } 298 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; }
298 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET 299 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET
299 || type == CLOAK || type == BOOTS || type == GLOVES 300 || type == CLOAK || type == BOOTS || type == GLOVES
300 || type == BRACERS || type == GIRDLE; } 301 || type == BRACERS || type == GIRDLE; }
306 || (type == SPELL_EFFECT 307 || (type == SPELL_EFFECT
307 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } 308 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); }
308 309
309 MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; } 310 MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; }
310 311
311 // temporary: wether the objetc can be saved in a map file 312 // temporary: wether the object can be saved in a map file
312 // contr => is a player 313 // contr => is a player
313 // head => only save head of a multitile object 314 // head => only save head of a multitile object
314 // owner => can not reference owner yet 315 // owner => can not reference owner yet
315 MTH bool can_map_save () const { return !contr && !head && !owner; } 316 MTH bool can_map_save () const { return !contr && !head && !owner; }
316 317
337 338
338 // insert object at same map position as 'where' 339 // insert object at same map position as 'where'
339 // handles both inventory and map "positions" 340 // handles both inventory and map "positions"
340 MTH object *insert_at (object *where, object *originator = 0, int flags = 0); 341 MTH object *insert_at (object *where, object *originator = 0, int flags = 0);
341 342
343 MTH bool active () const;
344 MTH void activate ();
345 MTH void deactivate ();
342 MTH void activate (bool recursive = true); 346 MTH void activate_recursive ();
343 MTH void deactivate (bool recursive = true); 347 MTH void deactivate_recursive ();
348
349 // set the givne flag on all objects in the inventory recursively
350 MTH void set_flag_inv (int flag, int value = 1);
344 351
345 void enter_exit (object *exit);//PERL 352 void enter_exit (object *exit);//PERL
346 MTH void enter_map (maptile *newmap, int x, int y); 353 MTH void enter_map (maptile *newmap, int x, int y);
347 354
348 // returns the mapspace this object is in 355 // returns the mapspace this object is in
361 operator object *() const { return item; } 368 operator object *() const { return item; }
362 369
363 object *operator ->() const { return item; } 370 object *operator ->() const { return item; }
364 object &operator * () const { return *item; } 371 object &operator * () const { return *item; }
365 }; 372 };
373
374 MTH unsigned int random_seed () const
375 {
376 return (unsigned int)uuid.seq;
377 }
366 378
367 // depth-first recursive iterator 379 // depth-first recursive iterator
368 struct depth_iterator : iterator_base 380 struct depth_iterator : iterator_base
369 { 381 {
370 depth_iterator (object *container); 382 depth_iterator (object *container);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines