… | |
… | |
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 |
… | |
… | |
518 | /* This return true if object has still randomitems which |
521 | /* This return true if object has still randomitems which |
519 | * could be expanded. |
522 | * could be expanded. |
520 | */ |
523 | */ |
521 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
524 | MTH bool has_random_items () const { return randomitems && !flag [FLAG_IS_A_TEMPLATE]; } |
522 | |
525 | |
523 | MTH bool has_dialogue () const { return *&msg == '@'; } |
526 | static bool msg_has_dialogue (const char *msg) { return *msg == '@'; } |
|
|
527 | |
|
|
528 | MTH bool has_dialogue () const { return msg_has_dialogue (&msg); } |
524 | |
529 | |
525 | // returns the outermost owner, never returns 0 |
530 | // returns the outermost owner, never returns 0 |
526 | MTH object *outer_owner () |
531 | MTH object *outer_owner () |
527 | { |
532 | { |
528 | object *op; |
533 | object *op; |
… | |
… | |
532 | |
537 | |
533 | return op; |
538 | return op; |
534 | } |
539 | } |
535 | |
540 | |
536 | // returns the outermost environment, never returns 0 |
541 | // returns the outermost environment, never returns 0 |
537 | MTH object *outer_env () const |
542 | MTH object *outer_env_or_self () const |
538 | { |
543 | { |
539 | const object *op; |
544 | const object *op; |
540 | |
545 | |
541 | for (op = this; op->env; op = op->env) |
546 | for (op = this; op->env; op = op->env) |
542 | ; |
547 | ; |
543 | |
548 | |
544 | return const_cast<object *>(op); |
549 | return const_cast<object *>(op); |
|
|
550 | } |
|
|
551 | |
|
|
552 | // returns the outermost environment, may return 0 |
|
|
553 | MTH object *outer_env () const |
|
|
554 | { |
|
|
555 | return env ? outer_env_or_self () : 0; |
545 | } |
556 | } |
546 | |
557 | |
547 | // returns the player that has this object in his inventory, or 0 |
558 | // returns the player that has this object in his inventory, or 0 |
548 | // we assume the player is always the outer env |
559 | // we assume the player is always the outer env |
549 | MTH object *in_player () const |
560 | MTH object *in_player () const |
550 | { |
561 | { |
551 | object *op = outer_env (); |
562 | object *op = outer_env_or_self (); |
552 | |
563 | |
553 | return op->type == PLAYER ? op : 0; |
564 | return op->type == PLAYER ? op : 0; |
554 | } |
565 | } |
555 | |
566 | |
556 | // "temporary" helper function |
567 | // "temporary" helper function |
… | |
… | |
590 | } |
601 | } |
591 | |
602 | |
592 | // returns the player that cna see this object, if any |
603 | // returns the player that cna see this object, if any |
593 | MTH object *visible_to () const; |
604 | MTH object *visible_to () const; |
594 | |
605 | |
595 | MTH std::string long_desc (object *who = 0); |
606 | MTH std::string long_desc (object *who = 0); // query_name . " " . describe |
596 | MTH std::string describe_monster (object *who = 0); |
607 | MTH std::string describe_monster (object *who = 0); |
597 | MTH std::string describe_item (object *who = 0); |
608 | MTH std::string describe_item (object *who = 0); |
598 | MTH std::string describe (object *who = 0); |
609 | MTH std::string describe (object *who = 0); // long description, without name |
599 | |
610 | |
600 | MTH const char *query_weight () { return ::query_weight (this); } |
611 | MTH const char *query_weight () { return ::query_weight (this); } |
601 | MTH const char *query_name () { return ::query_name (this); } |
612 | MTH const char *query_name () { return ::query_name (this); } |
602 | MTH const char *query_short_name () { return ::query_short_name (this); } |
613 | 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); } |
614 | MTH const char *query_base_name (bool plural) { return ::query_base_name (this, plural); } |
… | |
… | |
727 | // move this object to the top of its env's inventory to speed up |
738 | // move this object to the top of its env's inventory to speed up |
728 | // searches for it. |
739 | // searches for it. |
729 | static object * |
740 | static object * |
730 | splay (object *ob) |
741 | splay (object *ob) |
731 | { |
742 | { |
732 | if (ob->env && ob->env->inv != ob) |
743 | if (ob->above && ob->env) |
733 | { |
744 | { |
734 | if (ob->above) ob->above->below = ob->below; |
745 | if (ob->above) ob->above->below = ob->below; |
735 | if (ob->below) ob->below->above = ob->above; |
746 | if (ob->below) ob->below->above = ob->above; |
736 | |
747 | |
737 | ob->above = 0; |
748 | ob->above = 0; |