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.202 by root, Sat Jun 27 08:25:36 2009 UTC vs.
Revision 1.206 by root, Wed Sep 16 22:50:50 2009 UTC

262 MoveType ACC (RW, move_off); /* Move types affected moving off this space */ 262 MoveType ACC (RW, move_off); /* Move types affected moving off this space */
263 MoveType ACC (RW, move_slow); /* Movement types this slows down */ 263 MoveType ACC (RW, move_slow); /* Movement types this slows down */
264 264
265 // 8 free bits 265 // 8 free bits
266 266
267 float ACC (RW, expmul); /* needed experience = (calc_exp*expmul) - means some */ 267 //float ACC (RW, expmul) = 1.0; /* needed experience = (calc_exp*expmul) - means some */
268 /* races/classes can need less/more exp to gain levels */ 268 // /* races/classes can need less/more exp to gain levels */
269 static const float expmul = 1.0;//D
269 float ACC (RW, move_slow_penalty); /* How much this slows down the object */ 270 float ACC (RW, move_slow_penalty); /* How much this slows down the object */
270 271
271 /* Following are values used by any object */ 272 /* Following are values used by any object */
272 /* this objects turns into or what this object creates */ 273 /* this objects turns into or what this object creates */
273 treasurelist *ACC (RW, randomitems); /* Items to be generated */ 274 treasurelist *ACC (RW, randomitems); /* Items to be generated */
532 533
533 return op; 534 return op;
534 } 535 }
535 536
536 // returns the outermost environment, never returns 0 537 // returns the outermost environment, never returns 0
537 MTH object *outer_env () const 538 MTH object *outer_env_or_self () const
538 { 539 {
539 const object *op; 540 const object *op;
540 541
541 for (op = this; op->env; op = op->env) 542 for (op = this; op->env; op = op->env)
542 ; 543 ;
543 544
544 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;
545 } 552 }
546 553
547 // 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
548 // we assume the player is always the outer env 555 // we assume the player is always the outer env
549 MTH object *in_player () const 556 MTH object *in_player () const
550 { 557 {
551 object *op = outer_env (); 558 object *op = outer_env_or_self ();
552 559
553 return op->type == PLAYER ? op : 0; 560 return op->type == PLAYER ? op : 0;
554 } 561 }
555 562
556 // "temporary" helper function 563 // "temporary" helper function
590 } 597 }
591 598
592 // returns the player that cna see this object, if any 599 // returns the player that cna see this object, if any
593 MTH object *visible_to () const; 600 MTH object *visible_to () const;
594 601
595 MTH std::string long_desc (object *who = 0); 602 MTH std::string long_desc (object *who = 0); // query_name . " " . describe
596 MTH std::string describe_monster (object *who = 0); 603 MTH std::string describe_monster (object *who = 0);
597 MTH std::string describe_item (object *who = 0); 604 MTH std::string describe_item (object *who = 0);
598 MTH std::string describe (object *who = 0); 605 MTH std::string describe (object *who = 0); // long description, without name
599 606
600 MTH const char *query_weight () { return ::query_weight (this); } 607 MTH const char *query_weight () { return ::query_weight (this); }
601 MTH const char *query_name () { return ::query_name (this); } 608 MTH const char *query_name () { return ::query_name (this); }
602 MTH const char *query_short_name () { return ::query_short_name (this); } 609 MTH const char *query_short_name () { return ::query_short_name (this); }
603 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