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.196 by root, Thu Jan 8 03:03:24 2009 UTC vs.
Revision 1.197 by root, Thu Jan 8 19:23:44 2009 UTC

378 } 378 }
379 379
380 // recursively destroy all objects in inventory, optionally dropping them to the ground instead 380 // recursively destroy all objects in inventory, optionally dropping them to the ground instead
381 MTH void destroy_inv (bool drop_to_ground = false); 381 MTH void destroy_inv (bool drop_to_ground = false);
382 MTH object *insert (object *item); // insert into inventory 382 MTH object *insert (object *item); // insert into inventory
383 MTH void play_sound (faceidx sound); 383 MTH void play_sound (faceidx sound) const;
384 MTH void say_msg (const char *msg) const;
384 385
385 void do_remove (); 386 void do_remove ();
386 MTH void remove () 387 MTH void remove ()
387 { 388 {
388 if (!flag [FLAG_REMOVED]) 389 if (!flag [FLAG_REMOVED])
523 524
524 return op; 525 return op;
525 } 526 }
526 527
527 // returns the outermost environment, never returns 0 528 // returns the outermost environment, never returns 0
528 MTH object *outer_env () 529 MTH object *outer_env () const
529 { 530 {
530 object *op; 531 const object *op;
531 532
532 for (op = this; op->env; op = op->env) 533 for (op = this; op->env; op = op->env)
533 ; 534 ;
534 535
535 return op; 536 return const_cast<object *>(op);
536 } 537 }
537 538
538 // returns the player that has this object in his inventory, or 0 539 // returns the player that has this object in his inventory, or 0
539 // we assume the player is always the outer env 540 // we assume the player is always the outer env
540 MTH object *in_player () 541 MTH object *in_player () const
541 { 542 {
542 object *op = outer_env (); 543 object *op = outer_env ();
543 544
544 return op->type == PLAYER ? op : 0; 545 return op->type == PLAYER ? op : 0;
545 } 546 }
546 547
547 // "temporary" helper function 548 // "temporary" helper function
548 MTH object *head_ () 549 MTH object *head_ () const
549 { 550 {
550 return head ? head : this; 551 return head ? head : const_cast<object *>(this);
551 } 552 }
552 553
553 MTH bool is_head () 554 MTH bool is_head () const
554 { 555 {
555 return head_ () == this; 556 return head_ () == this;
556 } 557 }
557 558
558 MTH bool is_on_map () const 559 MTH bool is_on_map () const

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines