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.206 by root, Wed Sep 16 22:50:50 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_or_self () : 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
591 } 597 }
592 598
593 // returns the player that cna see this object, if any 599 // returns the player that cna see this object, if any
594 MTH object *visible_to () const; 600 MTH object *visible_to () const;
595 601
596 MTH std::string long_desc (object *who = 0); 602 MTH std::string long_desc (object *who = 0); // query_name . " " . describe
597 MTH std::string describe_monster (object *who = 0); 603 MTH std::string describe_monster (object *who = 0);
598 MTH std::string describe_item (object *who = 0); 604 MTH std::string describe_item (object *who = 0);
599 MTH std::string describe (object *who = 0); 605 MTH std::string describe (object *who = 0); // long description, without name
600 606
601 MTH const char *query_weight () { return ::query_weight (this); } 607 MTH const char *query_weight () { return ::query_weight (this); }
602 MTH const char *query_name () { return ::query_name (this); } 608 MTH const char *query_name () { return ::query_name (this); }
603 MTH const char *query_short_name () { return ::query_short_name (this); } 609 MTH const char *query_short_name () { return ::query_short_name (this); }
604 MTH const char *query_base_name (bool plural) { return ::query_base_name (this, plural); } 610 MTH const char *query_base_name (bool plural) { return ::query_base_name (this, plural); }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines