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.203 by root, Sat Jun 27 08:35:03 2009 UTC vs.
Revision 1.204 by root, Tue Sep 1 20:56:05 2009 UTC

533 533
534 return op; 534 return op;
535 } 535 }
536 536
537 // returns the outermost environment, never returns 0 537 // returns the outermost environment, never returns 0
538 MTH object *outer_env () const 538 MTH object *outer_env_or_self () const
539 { 539 {
540 const object *op; 540 const object *op;
541 541
542 for (op = this; op->env; op = op->env) 542 for (op = this; op->env; op = op->env)
543 ; 543 ;
544 544
545 return const_cast<object *>(op); 545 return const_cast<object *>(op);
546 }
547
548 // returns the outermost environment, may return 0
549 MTH object *outer_env () const
550 {
551 return env ? outer_env () : 0;
546 } 552 }
547 553
548 // returns the player that has this object in his inventory, or 0 554 // returns the player that has this object in his inventory, or 0
549 // we assume the player is always the outer env 555 // we assume the player is always the outer env
550 MTH object *in_player () const 556 MTH object *in_player () const
551 { 557 {
552 object *op = outer_env (); 558 object *op = outer_env_or_self ();
553 559
554 return op->type == PLAYER ? op : 0; 560 return op->type == PLAYER ? op : 0;
555 } 561 }
556 562
557 // "temporary" helper function 563 // "temporary" helper function

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines