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.97 by root, Wed Feb 7 02:13:06 2007 UTC vs.
Revision 1.100 by root, Fri Feb 16 19:43:41 2007 UTC

229 object *ACC (RW, above); /* Pointer to the object stacked above this one */ 229 object *ACC (RW, above); /* Pointer to the object stacked above this one */
230 /* Note: stacked in the *same* environment */ 230 /* Note: stacked in the *same* environment */
231 object *inv; /* Pointer to the first object in the inventory */ 231 object *inv; /* Pointer to the first object in the inventory */
232 232
233 //TODO: container must move into client 233 //TODO: container must move into client
234 object *ACC (RW, container); /* Current container being used. I think this 234 object_ptr ACC (RW, container); /* Current container being used. I think this
235 * is only used by the player right now. 235 * is only used by the player right now.
236 */ 236 */
237 object *ACC (RW, env); /* Pointer to the object which is the environment. 237 object *ACC (RW, env); /* Pointer to the object which is the environment.
238 * This is typically the container that the object is in. 238 * This is typically the container that the object is in.
239 */ 239 */
240 object *ACC (RW, more); /* Pointer to the rest of a large body of objects */ 240 object *ACC (RW, more); /* Pointer to the rest of a large body of objects */
241 object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different 241 object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different
242 client_container *seen_by; // seen by which player/container currently? 242 client_container *seen_by; // seen by which player/container currently?
243 243
244 bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all
245 static object *read (object_thawer &f);
246 bool write (object_freezer &f);
247
244 MTH static object *create (); 248 MTH static object *create ();
245 MTH void copy_to (object *dst); 249 MTH void copy_to (object *dst);
246 MTH object *clone (); // create + copy_to 250 MTH object *clone (); // create + copy_to
247 void do_destroy (); 251 void do_destroy ();
248 void gather_callbacks (AV *&callbacks, event_type event) const; 252 void gather_callbacks (AV *&callbacks, event_type event) const;
269 } 273 }
270 274
271 MTH void set_owner (object *owner); 275 MTH void set_owner (object *owner);
272 MTH void set_speed (float speed); 276 MTH void set_speed (float speed);
273 277
278 MTH void open_container (object *new_container);
279 MTH void close_container ()
280 {
281 open_container (0);
282 }
283
274 MTH void instantiate () 284 MTH void instantiate ();
275 {
276 if (!uuid.seq) // HACK
277 uuid = gen_uuid ();
278
279 attachable::instantiate ();
280 }
281 285
282 // recalculate all stats 286 // recalculate all stats
283 MTH void update_stats (); 287 MTH void update_stats ();
284 MTH void roll_stats (); 288 MTH void roll_stats ();
285 MTH void swap_stats (int a, int b); 289 MTH void swap_stats (int a, int b);
306 } 310 }
307 311
308 // return the dominant material of this item, always return something 312 // return the dominant material of this item, always return something
309 const materialtype_t *dominant_material () const; 313 const materialtype_t *dominant_material () const;
310 314
315 // return the volume of this object in cm³
311 uint64 volume () const 316 uint64 volume () const
312 { 317 {
313 return total_weight () / dominant_material ()->density; 318 return total_weight ()
319 * 1000
320 * (type == CONTAINER ? 1000 : 1)
321 / dominant_material ()->density;
314 } 322 }
315 323
316 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } 324 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; }
317 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET 325 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET
318 || type == CLOAK || type == BOOTS || type == GLOVES 326 || type == CLOAK || type == BOOTS || type == GLOVES
473{ 481{
474 archetype (); 482 archetype ();
475 ~archetype (); 483 ~archetype ();
476 void gather_callbacks (AV *&callbacks, event_type event) const; 484 void gather_callbacks (AV *&callbacks, event_type event) const;
477 485
486 static archetype *read (object_thawer &f);
478 static archetype *find (const char *name); 487 static archetype *find (const char *name);
479 488
480 void hash_add (); // add to hashtable 489 void hash_add (); // add to hashtable
481 void hash_del (); // remove from hashtable 490 void hash_del (); // remove from hashtable
482 491

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines