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.110 by root, Mon Apr 23 18:09:57 2007 UTC vs.
Revision 1.116 by root, Mon May 7 03:05:58 2007 UTC

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
35#define NUM_BODY_LOCATIONS 12 35#define NUM_BODY_LOCATIONS 14
36#define BODY_ARMS 1 36#define BODY_ARMS 1
37 37
38/* See common/item.c */ 38/* See common/item.c */
39 39
40typedef struct Body_Locations 40typedef struct Body_Locations
89 89
90/* 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
91 * 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,
92 * e.g. ->copy_to () 92 * e.g. ->copy_to ()
93 */ 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};
94 100
95INTERFACE_CLASS (object) 101INTERFACE_CLASS (object)
96// these are being copied 102// these are being copied
97struct object_copy : attachable 103struct object_copy : attachable
98{ 104{
158 sint32 ACC (RW, weight_limit);/* Weight-limit of object */ 164 sint32 ACC (RW, weight_limit);/* Weight-limit of object */
159 sint32 ACC (RW, carrying); /* How much weight this object contains */ 165 sint32 ACC (RW, carrying); /* How much weight this object contains */
160 sint64 ACC (RW, perm_exp); /* Permanent exp */ 166 sint64 ACC (RW, perm_exp); /* Permanent exp */
161 uint32 ACC (RW, weapontype); /* type of weapon */ 167 uint32 ACC (RW, weapontype); /* type of weapon */
162 uint32 ACC (RW, tooltype); /* type of tool or build facility */ 168 uint32 ACC (RW, tooltype); /* type of tool or build facility */
163 sint8 ACC (RW, body_info[NUM_BODY_LOCATIONS]); /* body info as loaded from the file */ 169 body_slot slot [NUM_BODY_LOCATIONS];
164 sint8 ACC (RW, body_used[NUM_BODY_LOCATIONS]); /* Calculated value based on items equipped */
165 faceidx ACC (RW, face); /* Face with colors */ 170 faceidx ACC (RW, face); /* Face with colors */
166 living ACC (RO, stats); /* Str, Con, Dex, etc */ 171 living ACC (RO, stats); /* Str, Con, Dex, etc */
167 /* See the pod/objects.pod for more info about body locations */ 172 /* See the pod/objects.pod for more info about body locations */
168 173
169 /* Following mostly refers to fields only used for monsters */ 174 /* Following mostly refers to fields only used for monsters */
274 && can_merge_slow (op1, op2); 279 && can_merge_slow (op1, op2);
275 } 280 }
276 281
277 MTH void set_owner (object *owner); 282 MTH void set_owner (object *owner);
278 MTH void set_speed (float speed); 283 MTH void set_speed (float speed);
284 MTH void set_weapon (object *ob);
279 285
280 MTH void open_container (object *new_container); 286 MTH void open_container (object *new_container);
281 MTH void close_container () 287 MTH void close_container ()
282 { 288 {
283 open_container (0); 289 open_container (0);
295 MTH void drain_specific_stat (int deplete_stats); 301 MTH void drain_specific_stat (int deplete_stats);
296 MTH void change_luck (int value); 302 MTH void change_luck (int value);
297 303
298 // info must hold 256 * 3 bytes currently 304 // info must hold 256 * 3 bytes currently
299 const char *debug_desc (char *info) const; 305 const char *debug_desc (char *info) const;
300 MTH const char *debug_desc () const; 306 MTH const char *debug_desc () const; // uses at least 3 round-robin buffers
301 const char *debug_desc2 () const; // another debug_desc, pure convinience function
302 const char *flag_desc (char *desc, int len) const; 307 const char *flag_desc (char *desc, int len) const;
303 308
304 int number_of () const 309 int number_of () const
305 { 310 {
306 return nrof ? nrof : 1; 311 return nrof ? nrof : 1;
332 || (flag [FLAG_ALIVE] && !flag [FLAG_GENERATOR] && type != DOOR)) 337 || (flag [FLAG_ALIVE] && !flag [FLAG_GENERATOR] && type != DOOR))
333 && !flag [FLAG_IS_A_TEMPLATE]; } 338 && !flag [FLAG_IS_A_TEMPLATE]; }
334 MTH bool is_arrow () const { return type == ARROW 339 MTH bool is_arrow () const { return type == ARROW
335 || (type == SPELL_EFFECT 340 || (type == SPELL_EFFECT
336 && (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; }
337 343
338 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; }
339 345
340 // temporary: wether the object can be saved in a map file 346 // temporary: wether the object can be saved in a map file
341 // contr => is a player 347 // contr => is a player
371 377
372 // If this object has no extra parts but should have them, 378 // If this object has no extra parts but should have them,
373 // add them, effectively expanding heads into multipart 379 // add them, effectively expanding heads into multipart
374 // objects. This method only works on objects not inserted 380 // objects. This method only works on objects not inserted
375 // anywhere. 381 // anywhere.
376 void expand_tail (); 382 MTH void expand_tail ();
383
384 MTH void create_treasure (treasurelist *tl, int flags = 0);
377 385
378 // insert object at same map position as 'where' 386 // insert object at same map position as 'where'
379 // handles both inventory and map "positions" 387 // handles both inventory and map "positions"
380 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);
381 389
385 MTH void deactivate_recursive (); 393 MTH void deactivate_recursive ();
386 394
387 // set the givne flag on all objects in the inventory recursively 395 // set the givne flag on all objects in the inventory recursively
388 MTH void set_flag_inv (int flag, int value = 1); 396 MTH void set_flag_inv (int flag, int value = 1);
389 397
390 void enter_exit (object *exit);//PERL 398 void enter_exit (object *exit);//Perl
391 MTH void enter_map (maptile *newmap, int x, int y); 399 MTH void enter_map (maptile *newmap, int x, int y);
392 400
393 // returns the mapspace this object is in 401 // returns the mapspace this object is in
394 mapspace &ms () const; 402 mapspace &ms () const;
395 403

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines