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.142 by root, Wed Aug 15 05:01:25 2007 UTC vs.
Revision 1.150 by root, Wed Sep 12 11:10:10 2007 UTC

131 shstr ACC (RW, name_pl); /* The plural name of the object */ 131 shstr ACC (RW, name_pl); /* The plural name of the object */
132 shstr ACC (RW, title); /* Of foo, etc */ 132 shstr ACC (RW, title); /* Of foo, etc */
133 shstr ACC (RW, race); /* human, goblin, dragon, etc */ 133 shstr ACC (RW, race); /* human, goblin, dragon, etc */
134 shstr ACC (RW, slaying); /* Which race to do double damage to */ 134 shstr ACC (RW, slaying); /* Which race to do double damage to */
135 /* If this is an exit, this is the filename */ 135 /* If this is an exit, this is the filename */
136 shstr ACC (RW, tag); // a tag used to tracking this object
136 shstr ACC (RW, skill); /* Name of the skill this object uses/grants */ 137 shstr ACC (RW, skill); /* Name of the skill this object uses/grants */
137 shstr ACC (RW, msg); /* If this is a book/sign/magic mouth/etc */ 138 shstr ACC (RW, msg); /* If this is a book/sign/magic mouth/etc */
138 shstr ACC (RW, lore); /* Obscure information about this object, */ 139 shstr ACC (RW, lore); /* Obscure information about this object, */
139 /* To get put into books and the like. */ 140 /* To get put into books and the like. */
140 shstr ACC (RW, materialname); /* specific material name */ 141 shstr ACC (RW, materialname); /* specific material name */
270 object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different 271 object *head; /* Points to the main object of a large body */ // NO ACC, perl semantics are different
271 client_container *seen_by; // seen by which player/container currently? 272 client_container *seen_by; // seen by which player/container currently?
272 key_value *key_values; /* Fields not explictly known by the loader. */ 273 key_value *key_values; /* Fields not explictly known by the loader. */
273 274
274 bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all 275 bool parse_kv (object_thawer &f); // parse kv pairs, (ab-)used by archetypes, which should not exist at all
275 void post_load_check (); // do some adjustments after parsing 276 MTH void post_load_check (); // do some adjustments after parsing
276 static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go. 277 static object *read (object_thawer &f, maptile *map = 0); // map argument due to toal design bogosity, must go.
277 bool write (object_freezer &f); 278 bool write (object_freezer &f);
278 279
279 MTH int slottype () const; 280 MTH int slottype () const;
280 MTH static object *create (); 281 MTH static object *create ();
282 const mapxy &operator =(const mapxy &pos);
281 object &operator =(const object &src); 283 object &operator =(const object &src);
282 MTH void copy_to (object *dst); 284 MTH void copy_to (object *dst);
283 MTH object *clone (); // create + copy_to 285 MTH object *clone (); // create + copy_to
284 void do_destroy (); 286 void do_destroy ();
285 void gather_callbacks (AV *&callbacks, event_type event) const; 287 void gather_callbacks (AV *&callbacks, event_type event) const;
293 void do_remove (); 295 void do_remove ();
294 MTH void remove () 296 MTH void remove ()
295 { 297 {
296 if (!flag [FLAG_REMOVED]) 298 if (!flag [FLAG_REMOVED])
297 do_remove (); 299 do_remove ();
300 }
301
302 MTH bool blocked (maptile *m, int x, int y) const;
303
304 void move_to (const mapxy &pos)
305 {
306 remove ();
307 *this = pos;
308 insert_at (this, this);
298 } 309 }
299 310
300 static bool can_merge_slow (object *op1, object *op2); 311 static bool can_merge_slow (object *op1, object *op2);
301 312
302 // this is often used in time-critical code, so optimise 313 // this is often used in time-critical code, so optimise
383 394
384 // temporary: wether the object can be saved in a map file 395 // temporary: wether the object can be saved in a map file
385 // contr => is a player 396 // contr => is a player
386 // head => only save head of a multitile object 397 // head => only save head of a multitile object
387 // owner => can not reference owner yet 398 // owner => can not reference owner yet
388 MTH bool can_map_save () const { return !contr && !head && !owner && !flag [FLAG_NO_MAP_SAVE]; } 399 MTH bool can_map_save () const { return !head && (!owner || owner->contr) && !contr && !flag [FLAG_NO_MAP_SAVE]; }
389 400
390 /* This return true if object has still randomitems which 401 /* This return true if object has still randomitems which
391 * could be expanded. 402 * could be expanded.
392 */ 403 */
393 MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } 404 MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; }
492 { 503 {
493 return !invisible && type != PLAYER; 504 return !invisible && type != PLAYER;
494 } 505 }
495 506
496 MTH struct region *region () const; 507 MTH struct region *region () const;
508
509 void statusmsg (const char *msg, int color = NDI_BLACK);
510 void failmsg (const char *msg, int color = NDI_RED);
511
512 MTH const_octet_string ref () const; // creates and returns a consistent persistent object reference
513 static object *deref (const_octet_string ref); // returns the object from the generated refreence, if possible
497 514
498protected: 515protected:
499 void link (); 516 void link ();
500 void unlink (); 517 void unlink ();
501 518
554 archetype (const char *name); 571 archetype (const char *name);
555 ~archetype (); 572 ~archetype ();
556 void gather_callbacks (AV *&callbacks, event_type event) const; 573 void gather_callbacks (AV *&callbacks, event_type event) const;
557 574
558 static archetype *read (object_thawer &f); 575 static archetype *read (object_thawer &f);
576
559 static archetype *get (const char *name); // find or create 577 MTH static archetype *get (const_utf8_string name); // find or create
560 static archetype *find (const char *name); 578 MTH static archetype *find (const_utf8_string name);
561 579
562 void link (); 580 MTH void link ();
563 void unlink (); 581 MTH void unlink ();
564 582
565 object_vector_index ACC (RW, archid); // index in archvector 583 object_vector_index ACC (RW, archid); // index in archvector
566 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */ 584 shstr ACC (RW, archname); /* More definite name, like "generate_kobold" */
567 bool ACC (RW, stub); // if true, this is an invalid archetype 585 bool ACC (RW, stub); // if true, this is an invalid archetype
568 uint32 ACC (RW, editable); /* editable flags (mainly for editor) */
569 586
570 sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */ 587 sint8 ACC (RW, min_x), ACC (RW, min_y); /* extents, compared to the head (min_x, min_y should be zero, but aren't...) */
571 sint8 ACC (RW, max_x), ACC (RW, max_y); 588 sint8 ACC (RW, max_x), ACC (RW, max_y);
572}; 589};
573 590

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines