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.216 by root, Sun Nov 8 20:55:39 2009 UTC vs.
Revision 1.219 by root, Tue Nov 10 04:38:45 2009 UTC

93 93
94struct UUID 94struct UUID
95{ 95{
96 uint64 seq; 96 uint64 seq;
97 97
98 enum { MAX_LEN = 3 + 16 + 1 + 1 }; // <1. + hex + > + \0
99
98 static UUID cur; // last uuid generated 100 static UUID cur; // last uuid generated
99 static void init (); 101 static void init ();
100 static UUID gen (); 102 static UUID gen ();
101 103
102 UUID () { } 104 UUID () { }
103 UUID (uint64 seq) : seq(seq) { } 105 UUID (uint64 seq) : seq(seq) { }
104 operator uint64() { return seq; } 106 operator uint64() { return seq; }
105 void operator =(uint64 seq) { this->seq = seq; } 107 void operator =(uint64 seq) { this->seq = seq; }
106 108
107 typedef char BUF [32];
108
109 bool parse (const char *s) 109 bool parse (const char *s);
110 { 110 char *append (char *buf) const;
111 return sscanf (s, "<1.%" SCNx64 ">", &seq) == 1;
112 }
113
114 const char *c_str (char *buf, int len) const
115 {
116 snprintf (buf, len, "<1.%" PRIx64 ">", seq);
117
118 return buf;
119 }
120
121 const char *c_str () const 111 char *c_str () const;
122 {
123 static BUF buf;
124
125 return c_str (buf, sizeof (buf));
126 }
127}; 112};
128 113
129//+GPL 114//+GPL
130 115
131/* Definition for WILL_APPLY values. Replaces having harcoded values 116/* Definition for WILL_APPLY values. Replaces having harcoded values
139#define WILL_APPLY_DOOR 0x08 124#define WILL_APPLY_DOOR 0x08
140#define WILL_APPLY_FOOD 0x10 125#define WILL_APPLY_FOOD 0x10
141 126
142struct body_slot 127struct body_slot
143{ 128{
129 signed char used:4; /* Calculated value based on items equipped */
144 signed char info:4; /* body info as loaded from the file */ 130 signed char info:4; /* body info as loaded from the file */
145 signed char used:4; /* Calculated value based on items equipped */
146}; 131};
147 132
148typedef struct oblnk 133typedef struct oblnk
149{ /* Used to link together several objects */ 134{ /* Used to link together several objects */
150 object_ptr ob; 135 object_ptr ob;
180 flags_t flag; /* various flags */ 165 flags_t flag; /* various flags */
181#if FOR_PERL 166#if FOR_PERL
182 bool ACC (RW, flag[NUM_FLAGS]); 167 bool ACC (RW, flag[NUM_FLAGS]);
183#endif 168#endif
184 169
185 shstr ACC (RW, materialname); /* specific material name */ 170 materialtype_t *material; // What material this object consists of //TODO, make perl-accessible
186 shstr ACC (RW, skill); /* Name of the skill this object uses/grants */ 171 shstr ACC (RW, skill); /* Name of the skill this object uses/grants */
187// materialtype_t *ACC (RW, material); /* What material this object consists of */
188 object_ptr ACC (RW, owner); /* Pointer to the object which controls this one */ 172 object_ptr ACC (RW, owner); /* Pointer to the object which controls this one */
189 object_ptr ACC (RW, enemy); /* Monster/player to follow even if not closest */ 173 object_ptr ACC (RW, enemy); /* Monster/player to follow even if not closest */
190 object_ptr ACC (RW, attacked_by); /* This object start to attack us! only player & monster */ 174 object_ptr ACC (RW, attacked_by); /* This object start to attack us! only player & monster */
191 object_ptr ACC (RW, chosen_skill); /* the skill chosen to use */ 175 object_ptr ACC (RW, chosen_skill); /* the skill chosen to use */
192 object_ptr ACC (RW, spellitem); /* Spell ability monster is choosing to use */ 176 object_ptr ACC (RW, spellitem); /* Spell ability monster is choosing to use */
227 uint8 ACC (RW, pick_up); /* See crossfire.doc */ 211 uint8 ACC (RW, pick_up); /* See crossfire.doc */
228 sint8 ACC (RW, gen_sp_armour);/* sp regen penalty this object has (was last_heal) */ 212 sint8 ACC (RW, gen_sp_armour);/* sp regen penalty this object has (was last_heal) */
229 sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */ 213 sint8 ACC (RW, glow_radius); /* indicates the glow radius of the object */
230 uint8 ACC (RW, weapontype); /* type of weapon */ 214 uint8 ACC (RW, weapontype); /* type of weapon */
231 215
216 body_slot slot [NUM_BODY_LOCATIONS];
217
232 faceidx ACC (RW, face); /* the graphical face */ 218 faceidx ACC (RW, face); /* the graphical face */
233 219
234 faceidx ACC (RW, sound); /* the sound face */ 220 faceidx ACC (RW, sound); /* the sound face */
235 faceidx ACC (RW, sound_destroy); /* played on destroy */ 221 faceidx ACC (RW, sound_destroy); /* played on destroy */
236
237 body_slot slot [NUM_BODY_LOCATIONS];
238 222
239 sint32 ACC (RW, weight); /* Attributes of the object */ 223 sint32 ACC (RW, weight); /* Attributes of the object */
240 sint32 ACC (RW, weight_limit);/* Weight-limit of object */ 224 sint32 ACC (RW, weight_limit);/* Weight-limit of object */
241 225
242 sint32 ACC (RW, carrying); /* How much weight this object contains, must be 0 if nrof == 0 */ 226 sint32 ACC (RW, carrying); /* How much weight this object contains, must be 0 if nrof == 0 */
504 } 488 }
505 489
506 MTH void update_weight (); 490 MTH void update_weight ();
507 491
508 // return the dominant material of this item, always return something 492 // return the dominant material of this item, always return something
509 const materialtype_t *dominant_material () const; 493 const materialtype_t *dominant_material () const
494 {
495 return material;
496 }
510 497
511 // return the volume of this object in cm³ 498 // return the volume of this object in cm³
512 MTH uint64 volume () const 499 MTH uint64 volume () const
513 { 500 {
514 return (uint64)total_weight () 501 return (uint64)total_weight ()
813 MTH void link (); 800 MTH void link ();
814 MTH void unlink (); 801 MTH void unlink ();
815 802
816 MTH static object *get (const char *name); // (find() || singularity)->instance() 803 MTH static object *get (const char *name); // (find() || singularity)->instance()
817 MTH object *instance (); 804 MTH object *instance ();
805
806 MTH void post_load_check (); // do some adjustments after parsing
818 807
819 object_vector_index ACC (RW, archid); // index in archvector 808 object_vector_index ACC (RW, archid); // index in archvector
820 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 809 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
821 810
822 sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ 811 sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines