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.105 by root, Mon Apr 16 06:23:41 2007 UTC vs.
Revision 1.116 by root, Mon May 7 03:05:58 2007 UTC

29 29
30#include "cfperl.h" 30#include "cfperl.h"
31#include "shstr.h" 31#include "shstr.h"
32 32
33typedef int tag_t; 33typedef int tag_t;
34
34#define NUM_BODY_LOCATIONS 12 35#define NUM_BODY_LOCATIONS 14
35#define BODY_ARMS 1 36#define BODY_ARMS 1
36 37
37/* See common/item.c */ 38/* See common/item.c */
38 39
39typedef struct Body_Locations 40typedef struct Body_Locations
88 89
89/* However, if you're keeping a pointer of some sort, you probably 90/* However, if you're keeping a pointer of some sort, you probably
90 * don't just want it copied, so you'll need to add to common/object.C, 91 * don't just want it copied, so you'll need to add to common/object.C,
91 * e.g. ->copy_to () 92 * e.g. ->copy_to ()
92 */ 93 */
94
95struct body_slot
96{
97 sint8 info:4; /* body info as loaded from the file */
98 sint8 used:4; /* Calculated value based on items equipped */
99};
93 100
94INTERFACE_CLASS (object) 101INTERFACE_CLASS (object)
95// these are being copied 102// these are being copied
96struct object_copy : attachable 103struct object_copy : attachable
97{ 104{
157 sint32 ACC (RW, weight_limit);/* Weight-limit of object */ 164 sint32 ACC (RW, weight_limit);/* Weight-limit of object */
158 sint32 ACC (RW, carrying); /* How much weight this object contains */ 165 sint32 ACC (RW, carrying); /* How much weight this object contains */
159 sint64 ACC (RW, perm_exp); /* Permanent exp */ 166 sint64 ACC (RW, perm_exp); /* Permanent exp */
160 uint32 ACC (RW, weapontype); /* type of weapon */ 167 uint32 ACC (RW, weapontype); /* type of weapon */
161 uint32 ACC (RW, tooltype); /* type of tool or build facility */ 168 uint32 ACC (RW, tooltype); /* type of tool or build facility */
162 sint8 ACC (RW, body_info[NUM_BODY_LOCATIONS]); /* body info as loaded from the file */ 169 body_slot slot [NUM_BODY_LOCATIONS];
163 sint8 ACC (RW, body_used[NUM_BODY_LOCATIONS]); /* Calculated value based on items equipped */
164 faceidx ACC (RW, face); /* Face with colors */ 170 faceidx ACC (RW, face); /* Face with colors */
165 living ACC (RO, stats); /* Str, Con, Dex, etc */ 171 living ACC (RO, stats); /* Str, Con, Dex, etc */
166 /* See the pod/objects.pod for more info about body locations */ 172 /* See the pod/objects.pod for more info about body locations */
167 173
168 /* Following mostly refers to fields only used for monsters */ 174 /* Following mostly refers to fields only used for monsters */
273 && can_merge_slow (op1, op2); 279 && can_merge_slow (op1, op2);
274 } 280 }
275 281
276 MTH void set_owner (object *owner); 282 MTH void set_owner (object *owner);
277 MTH void set_speed (float speed); 283 MTH void set_speed (float speed);
284 MTH void set_weapon (object *ob);
278 285
279 MTH void open_container (object *new_container); 286 MTH void open_container (object *new_container);
280 MTH void close_container () 287 MTH void close_container ()
281 { 288 {
282 open_container (0); 289 open_container (0);
294 MTH void drain_specific_stat (int deplete_stats); 301 MTH void drain_specific_stat (int deplete_stats);
295 MTH void change_luck (int value); 302 MTH void change_luck (int value);
296 303
297 // info must hold 256 * 3 bytes currently 304 // info must hold 256 * 3 bytes currently
298 const char *debug_desc (char *info) const; 305 const char *debug_desc (char *info) const;
299 MTH const char *debug_desc () const; 306 MTH const char *debug_desc () const; // uses at least 3 round-robin buffers
300 const char *debug_desc2 () const; // another debug_desc, pure convinience function
301 const char *flag_desc (char *desc, int len) const; 307 const char *flag_desc (char *desc, int len) const;
302 308
303 int number_of () const 309 int number_of () const
304 { 310 {
305 return nrof ? nrof : 1; 311 return nrof ? nrof : 1;
331 || (flag [FLAG_ALIVE] && !flag [FLAG_GENERATOR] && type != DOOR)) 337 || (flag [FLAG_ALIVE] && !flag [FLAG_GENERATOR] && type != DOOR))
332 && !flag [FLAG_IS_A_TEMPLATE]; } 338 && !flag [FLAG_IS_A_TEMPLATE]; }
333 MTH bool is_arrow () const { return type == ARROW 339 MTH bool is_arrow () const { return type == ARROW
334 || (type == SPELL_EFFECT 340 || (type == SPELL_EFFECT
335 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); } 341 && (subtype == SP_BULLET || subtype == SP_MAGIC_MISSILE)); }
342 MTH bool is_range () const { return type == BOW || type == ROD || type == WAND || type == HORN; }
336 343
337 MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; } 344 MTH bool has_active_speed () const { return FABS(speed) >= MIN_ACTIVE_SPEED; }
338 345
339 // temporary: wether the object can be saved in a map file 346 // temporary: wether the object can be saved in a map file
340 // contr => is a player 347 // contr => is a player
361 MTH object *head_ () 368 MTH object *head_ ()
362 { 369 {
363 return head ? head : this; 370 return head ? head : this;
364 } 371 }
365 372
373 MTH std::string long_desc (object *who = 0);
374 MTH std::string describe_monster (object *who = 0);
375 MTH std::string describe_item (object *who = 0);
376 MTH std::string describe (object *who = 0);
377
378 // If this object has no extra parts but should have them,
379 // add them, effectively expanding heads into multipart
380 // objects. This method only works on objects not inserted
381 // anywhere.
382 MTH void expand_tail ();
383
384 MTH void create_treasure (treasurelist *tl, int flags = 0);
385
366 // insert object at same map position as 'where' 386 // insert object at same map position as 'where'
367 // handles both inventory and map "positions" 387 // handles both inventory and map "positions"
368 MTH object *insert_at (object *where, object *originator = 0, int flags = 0); 388 MTH object *insert_at (object *where, object *originator = 0, int flags = 0);
369 389
370 MTH void activate (); 390 MTH void activate ();
373 MTH void deactivate_recursive (); 393 MTH void deactivate_recursive ();
374 394
375 // set the givne flag on all objects in the inventory recursively 395 // set the givne flag on all objects in the inventory recursively
376 MTH void set_flag_inv (int flag, int value = 1); 396 MTH void set_flag_inv (int flag, int value = 1);
377 397
378 void enter_exit (object *exit);//PERL 398 void enter_exit (object *exit);//Perl
379 MTH void enter_map (maptile *newmap, int x, int y); 399 MTH void enter_map (maptile *newmap, int x, int y);
380 400
381 // returns the mapspace this object is in 401 // returns the mapspace this object is in
382 mapspace &ms () const; 402 mapspace &ms () const;
383 403
482{ 502{
483 archetype (); 503 archetype ();
484 ~archetype (); 504 ~archetype ();
485 void gather_callbacks (AV *&callbacks, event_type event) const; 505 void gather_callbacks (AV *&callbacks, event_type event) const;
486 506
487 static archetype *get (const char *name); // find or create
488 static archetype *read (object_thawer &f); 507 static archetype *read (object_thawer &f);
508 static archetype *get (const char *name); // find or create
489 static archetype *find (const char *name); 509 static archetype *find (const char *name);
490 510
491 void hash_add (); // add to hashtable 511 void hash_add (); // add to hashtable
492 void hash_del (); // remove from hashtable 512 void hash_del (); // remove from hashtable
493 513
495 struct archetype *ACC (RW, next); /* Next archetype in a linked list */ 515 struct archetype *ACC (RW, next); /* Next archetype in a linked list */
496 struct archetype *ACC (RW, head); /* The main part of a linked object */ 516 struct archetype *ACC (RW, head); /* The main part of a linked object */
497 struct archetype *ACC (RW, more); /* Next part of a linked object */ 517 struct archetype *ACC (RW, more); /* Next part of a linked object */
498 object ACC (RO, clone); /* An object from which to do ->copy_to () */ 518 object ACC (RO, clone); /* An object from which to do ->copy_to () */
499 uint32 ACC (RW, editable); /* editable flags (mainly for editor) */ 519 uint32 ACC (RW, editable); /* editable flags (mainly for editor) */
520 bool ACC (RW, linked); // linked into list of heads
500 sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is 521 sint8 ACC (RW, tail_x), ACC (RW, tail_y); /* Where the lower right most portion of the object is
501 * in comparison to the head. 522 * in comparison to the head.
502 */ 523 */
503}; 524};
504 525
543#define INS_ON_TOP 0x0008 564#define INS_ON_TOP 0x0008
544#define INS_BELOW_ORIGINATOR 0x0010 565#define INS_BELOW_ORIGINATOR 0x0010
545#define INS_MAP_LOAD 0x0020 566#define INS_MAP_LOAD 0x0020
546 567
547#define ARCH_SINGULARITY "singularity" 568#define ARCH_SINGULARITY "singularity"
548#define ARCH_SINGULARITY_LEN 11
549#define ARCH_DETECT_MAGIC "detect_magic" 569#define ARCH_DETECT_MAGIC "detect_magic"
550#define ARCH_DEPLETION "depletion" 570#define ARCH_DEPLETION "depletion"
551#define ARCH_SYMPTOM "symptom" 571#define ARCH_SYMPTOM "symptom"
552 572
553#endif 573#endif

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines