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.207 by root, Wed Sep 16 23:22: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 */
490 return (uint64)total_weight () 491 return (uint64)total_weight ()
491 * 1000 492 * 1000
492 * (type == CONTAINER ? 1000 : 1) 493 * (type == CONTAINER ? 1000 : 1)
493 / dominant_material ()->density; 494 / dominant_material ()->density;
494 } 495 }
496
497 MTH bool is_arch () const { return this == (const object *)(const archetype *)arch; }
495 498
496 MTH bool is_wiz () const { return flag [FLAG_WIZ]; } 499 MTH bool is_wiz () const { return flag [FLAG_WIZ]; }
497 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; } 500 MTH bool is_weapon () const { return type == ARROW || type == BOW || type == WEAPON; }
498 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET 501 MTH bool is_armor () const { return type == ARMOUR || type == SHIELD || type == HELMET
499 || type == CLOAK || type == BOOTS || type == GLOVES 502 || type == CLOAK || type == BOOTS || type == GLOVES
532 535
533 return op; 536 return op;
534 } 537 }
535 538
536 // returns the outermost environment, never returns 0 539 // returns the outermost environment, never returns 0
537 MTH object *outer_env () const 540 MTH object *outer_env_or_self () const
538 { 541 {
539 const object *op; 542 const object *op;
540 543
541 for (op = this; op->env; op = op->env) 544 for (op = this; op->env; op = op->env)
542 ; 545 ;
543 546
544 return const_cast<object *>(op); 547 return const_cast<object *>(op);
548 }
549
550 // returns the outermost environment, may return 0
551 MTH object *outer_env () const
552 {
553 return env ? outer_env_or_self () : 0;
545 } 554 }
546 555
547 // returns the player that has this object in his inventory, or 0 556 // returns the player that has this object in his inventory, or 0
548 // we assume the player is always the outer env 557 // we assume the player is always the outer env
549 MTH object *in_player () const 558 MTH object *in_player () const
550 { 559 {
551 object *op = outer_env (); 560 object *op = outer_env_or_self ();
552 561
553 return op->type == PLAYER ? op : 0; 562 return op->type == PLAYER ? op : 0;
554 } 563 }
555 564
556 // "temporary" helper function 565 // "temporary" helper function
590 } 599 }
591 600
592 // returns the player that cna see this object, if any 601 // returns the player that cna see this object, if any
593 MTH object *visible_to () const; 602 MTH object *visible_to () const;
594 603
595 MTH std::string long_desc (object *who = 0); 604 MTH std::string long_desc (object *who = 0); // query_name . " " . describe
596 MTH std::string describe_monster (object *who = 0); 605 MTH std::string describe_monster (object *who = 0);
597 MTH std::string describe_item (object *who = 0); 606 MTH std::string describe_item (object *who = 0);
598 MTH std::string describe (object *who = 0); 607 MTH std::string describe (object *who = 0); // long description, without name
599 608
600 MTH const char *query_weight () { return ::query_weight (this); } 609 MTH const char *query_weight () { return ::query_weight (this); }
601 MTH const char *query_name () { return ::query_name (this); } 610 MTH const char *query_name () { return ::query_name (this); }
602 MTH const char *query_short_name () { return ::query_short_name (this); } 611 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); } 612 MTH const char *query_base_name (bool plural) { return ::query_base_name (this, plural); }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines