ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/server/c_object.C
(Generate patch)

Comparing deliantra/server/server/c_object.C (file contents):
Revision 1.67 by root, Mon Apr 21 23:35:24 2008 UTC vs.
Revision 1.76 by root, Sun Sep 7 21:31:23 2008 UTC

1/* 1/*
2 * This file is part of Deliantra, the Roguelike Realtime MMORPG. 2 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 * 3 *
4 * Copyright (©) 2005,2006,2007 Marc Alexander Lehmann / Robin Redeker / the Deliantra team 4 * Copyright (©) 2005,2006,2007,2008 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team 5 * Copyright (©) 2002,2007 Mark Wedel & Crossfire Development Team
6 * Copyright (©) 1992,2007 Frank Tore Johansen 6 * Copyright (©) 1992,2007 Frank Tore Johansen
7 * 7 *
8 * Deliantra is free software: you can redistribute it and/or modify 8 * Deliantra is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
94} 94}
95 95
96static bool 96static bool
97can_split (object *pl, object *&op, sint32 nrof) 97can_split (object *pl, object *&op, sint32 nrof)
98{ 98{
99 if (object *tmp = op->split (nrof)) 99 if (object *tmp = op->split (nrof ? nrof : op->number_of ()))
100 { 100 {
101 op = tmp; 101 op = tmp;
102 return true; 102 return true;
103 } 103 }
104 else 104 else
284 * (sack, luggage, etc), tmp->env->env then points to the player (nested 284 * (sack, luggage, etc), tmp->env->env then points to the player (nested
285 * containers not allowed as of now) 285 * containers not allowed as of now)
286 */ 286 */
287 if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && tmp->in_player () != pl) 287 if ((pl->move_type & MOVE_FLYING) && !QUERY_FLAG (pl, FLAG_WIZ) && tmp->in_player () != pl)
288 { 288 {
289 new_draw_info (NDI_UNIQUE, 0, pl, "You are levitating, you can't reach the ground!"); 289 pl->failmsg ("You are levitating, you can't reach the ground! "
290 "H<You have to stop levitating first, if you can, either by using your levitation skill, "
291 "or waiting till the levitation effect wears off.>");
290 return; 292 return;
291 } 293 }
292 294
293 if (QUERY_FLAG (tmp, FLAG_NO_DROP)) 295 if (QUERY_FLAG (tmp, FLAG_NO_DROP))
294 return; 296 return;
311 313
312 if (!can_split (pl, tmp, nrof)) 314 if (!can_split (pl, tmp, nrof))
313 return; 315 return;
314 316
315 if (QUERY_FLAG (tmp, FLAG_UNPAID)) 317 if (QUERY_FLAG (tmp, FLAG_UNPAID))
318 {
319 tmp->flag.reset (FLAG_UNPAID);
316 new_draw_info_format (NDI_UNIQUE, 0, pl, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP)); 320 new_draw_info_format (NDI_UNIQUE, 0, pl, "%s will cost you %s.", query_name (tmp), query_cost_string (tmp, pl, F_BUY | F_SHOP));
321 tmp->flag.set (FLAG_UNPAID);
322 }
317 else 323 else
318 new_draw_info_format (NDI_UNIQUE, 0, pl, "You pick up the %s.", query_name (tmp)); 324 new_draw_info_format (NDI_UNIQUE, 0, pl, "You pick up the %s.", query_name (tmp));
319 325
320 tmp = insert_ob_in_ob (tmp, op); 326 op->insert (tmp);
321
322 /* All the stuff below deals with client/server code, and is only
323 * usable by players
324 */
325 if (pl->contr)
326 {
327 esrv_send_item (pl, tmp);
328
329 /* These are needed to update the weight for the container we
330 * are putting the object in.
331 */
332 if (op != pl)
333 {
334 esrv_update_item (UPD_WEIGHT, pl, op);
335 esrv_send_item (pl, pl);
336 }
337
338 /* Update the container the object was in */
339 if (env && env != pl && env != op)
340 esrv_update_item (UPD_WEIGHT, pl, env);
341 }
342} 327}
343 328
344/* modified slightly to allow monsters use this -b.t. 5-31-95 */ 329/* modified slightly to allow monsters use this -b.t. 5-31-95 */
345void 330void
346pick_up (object *op, object *alt) 331pick_up (object *op, object *alt)
499 * but that probably will make it more difficult to read, and 484 * but that probably will make it more difficult to read, and
500 * not make it any more efficient 485 * not make it any more efficient
501 */ 486 */
502 if (params && item_matched_string (op, tmp, params)) 487 if (params && item_matched_string (op, tmp, params))
503 { 488 {
489 if (--cnt < 0) break;
504 pick_up (op, tmp); 490 pick_up (op, tmp);
505 if (--cnt <= 0) break;
506 } 491 }
507 else if (can_pick (op, tmp) && !params) 492 else if (can_pick (op, tmp) && !params)
508 { 493 {
494 if (--cnt < 0) break;
509 pick_up (op, tmp); 495 pick_up (op, tmp);
510 break; 496 break;
511 } 497 }
512 498
513 tmp = next; 499 tmp = next;
514 } 500 }
515 501
516 if (cnt <= 0) 502 if (cnt < 0)
517 { 503 {
518 op->failmsg ("Couldn't pick up so many items at once."); 504 op->failmsg ("Couldn't pick up so many items at once.");
519 return 0; 505 return 0;
520 } 506 }
521 507
569 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp) 555 for (tmp2 = tmp->inv; tmp2; tmp2 = tmp)
570 { 556 {
571 tmp = tmp2->below; 557 tmp = tmp2->below;
572 558
573 if ((sack->type == CONTAINER && sack_can_hold (op, op->container, tmp2, tmp2->nrof))) 559 if ((sack->type == CONTAINER && sack_can_hold (op, op->container, tmp2, tmp2->nrof)))
574 {
575 put_object_in_sack (op, sack, tmp2, 0); 560 put_object_in_sack (op, sack, tmp2, 0);
576 }
577 else 561 else
578 { 562 {
579 sprintf (buf, "Your %s fills up.", query_name (sack)); 563 sprintf (buf, "Your %s fills up.", query_name (sack));
580 new_draw_info (NDI_UNIQUE, 0, op, buf); 564 new_draw_info (NDI_UNIQUE, 0, op, buf);
581 break; 565 break;
582 } 566 }
583 } 567 }
584 568
585 esrv_update_item (UPD_WEIGHT, op, sack2);
586 return; 569 return;
587 } 570 }
588 571
589 /* Don't worry about this for containers - our caller should have 572 /* Don't worry about this for containers - our caller should have
590 * already checked this. 573 * already checked this.
595 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 578 if (QUERY_FLAG (tmp, FLAG_APPLIED))
596 if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE)) 579 if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE))
597 return; 580 return;
598 581
599 /* we want to put some portion of the item into the container */ 582 /* we want to put some portion of the item into the container */
600 if (nrof && tmp->nrof != nrof)
601 {
602 if (!can_split (op, tmp, nrof)) 583 if (!can_split (op, tmp, nrof))
603 return; 584 return;
604 }
605 else
606 tmp->remove ();
607 585
608 new_draw_info_format (NDI_UNIQUE, 0, op, "You put the %s in %s.", query_name (tmp), query_name (sack)); 586 new_draw_info_format (NDI_UNIQUE, 0, op, "You put the %s in %s.", query_name (tmp), query_name (sack));
609 tmp2 = insert_ob_in_ob (tmp, sack); 587 sack->insert (tmp);
610
611 // elmex: 2007-11-26: removed update_stats and replaced
612 // it by update_after_inventory_change () in the caller
613 // of this function
614
615 /* If an object merged (and thus, different object), we need to
616 * delete the original.
617 */
618 if (tmp2 != tmp)
619 esrv_del_item (op->contr, tmp->count);
620
621 esrv_send_item (op, tmp2);
622
623 /* update the sacks weight */
624 esrv_update_item (UPD_WEIGHT, op, sack);
625} 588}
626 589
627/* 590/*
628 * This function was part of drop, now is own function. 591 * This function was part of drop, now is own function.
629 * Player 'op' tries to drop object 'tmp', if tmp is non zero, then 592 * Player 'op' tries to drop object 'tmp', if tmp is non zero, then
631 * This is used when dropping objects onto the floor. 594 * This is used when dropping objects onto the floor.
632 */ 595 */
633void 596void
634drop_object (object *op, object *tmp, uint32 nrof) 597drop_object (object *op, object *tmp, uint32 nrof)
635{ 598{
636 object *floor;
637
638 if (QUERY_FLAG (tmp, FLAG_NO_DROP)) 599 if (QUERY_FLAG (tmp, FLAG_NO_DROP))
639 return; 600 return;
640 601
641 if (QUERY_FLAG (tmp, FLAG_APPLIED)) 602 if (QUERY_FLAG (tmp, FLAG_APPLIED))
642 if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE)) 603 if (apply_special (op, tmp, AP_UNAPPLY | AP_NO_MERGE))
645 //fprintf (stderr, "ui, on space is %ld\n", op->ms ().volume ());//D 606 //fprintf (stderr, "ui, on space is %ld\n", op->ms ().volume ());//D
646 607
647 /* We are only dropping some of the items. We split the current object 608 /* We are only dropping some of the items. We split the current object
648 * off 609 * off
649 */ 610 */
650 if (nrof && tmp->nrof != nrof)
651 {
652 if (!can_split (op, tmp, nrof)) 611 if (!can_split (op, tmp, nrof))
653 return;
654 }
655 else
656 tmp->remove ();
657 612
658 if (INVOKE_OBJECT (DROP, tmp, ARG_OBJECT (op))) 613 if (INVOKE_OBJECT (DROP, tmp, ARG_OBJECT (op)))
659 return; 614 return;
660 615
661 if (QUERY_FLAG (tmp, FLAG_STARTEQUIP)) 616 if (QUERY_FLAG (tmp, FLAG_STARTEQUIP))
662 { 617 {
663 op->statusmsg (format ("You drop the %s.", query_name (tmp))); 618 op->statusmsg (format ("You drop the %s.", query_name (tmp)));
664 op->statusmsg ("The gods who lent it to you retrieves it."); 619 op->statusmsg ("The gods who lent it to you retrieves it.");
665
666 if (op->type == PLAYER)
667 esrv_del_item (op->contr, tmp->count);
668 620
669 tmp->destroy (); 621 tmp->destroy ();
670 op->update_stats (); 622 op->update_stats ();
671 return; 623 return;
672 } 624 }
673
674 if (op->type == PLAYER)
675 esrv_del_item (op->contr, tmp->count);
676 625
677 /* Call this before we update the various windows/players. At least 626 /* Call this before we update the various windows/players. At least
678 * that we, we know the weight is correct. 627 * that we, we know the weight is correct.
679 */ 628 */
680 // 2007-11-26: moved op->update_stats away and calling it later after 629 // 2007-11-26: moved op->update_stats away and calling it later after
681 // all items of a drop command have been processed. 630 // all items of a drop command have been processed.
682 631
683 for (floor = GET_MAP_OB (op->map, op->x, op->y); floor; floor = floor->above) 632 for (object *floor = GET_MAP_OB (op->map, op->x, op->y); floor; floor = floor->above)
684 if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op))) 633 if (INVOKE_OBJECT (DROP_ON, floor, ARG_OBJECT (tmp), ARG_OBJECT (op)))
685 return; 634 return;
686 635
687 if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY) 636 if (is_in_shop (op) && !QUERY_FLAG (tmp, FLAG_UNPAID) && tmp->type != MONEY)
637 {
688 sell_item (tmp, op); 638 if (!sell_item (tmp, op))
639 return; // if we can't sell it we don't drop it
640 }
689 641
690 tmp->x = op->x; 642 tmp->x = op->x;
691 tmp->y = op->y; 643 tmp->y = op->y;
692 644
693 insert_ob_in_map (tmp, op->map, op, INS_BELOW_ORIGINATOR); 645 insert_ob_in_map (tmp, op->map, op, INS_BELOW_ORIGINATOR);
694}
695
696void update_after_inventory_change (object *op)
697{
698 /* Call this before we update the various windows/players. At least
699 * that we, we know the weight is correct.
700 */
701 op->update_stats ();
702
703 // elmex: kept this for now, i have no idea what happens when i remove it:
704 if (op->type == PLAYER)
705 {
706 /* Need to update the weight for the player */
707 esrv_send_item (op, op);
708 op->contr->ns->floorbox_update ();
709 }
710} 646}
711 647
712void 648void
713drop (object *op, object *tmp) 649drop (object *op, object *tmp)
714{ 650{
729 tmp->destroy (); 665 tmp->destroy ();
730 return; 666 return;
731 } 667 }
732 else 668 else
733 { 669 {
734 while (tmp != NULL && tmp->invisible) 670 while (tmp && tmp->invisible)
735 tmp = tmp->below; 671 tmp = tmp->below;
736 } 672 }
737 } 673 }
738 674
739 if (tmp == NULL) 675 if (tmp == NULL)
740 { 676 {
741 new_draw_info (NDI_UNIQUE, 0, op, "You don't have anything to drop."); 677 new_draw_info (NDI_UNIQUE, 0, op, "You don't have anything to drop.");
742 return; 678 return;
743 } 679 }
680
744 if (QUERY_FLAG (tmp, FLAG_INV_LOCKED)) 681 if (QUERY_FLAG (tmp, FLAG_INV_LOCKED))
745 { 682 {
746 new_draw_info (NDI_UNIQUE, 0, op, "This item is locked"); 683 new_draw_info (NDI_UNIQUE, 0, op, "This item is locked");
747 return; 684 return;
748 } 685 }
686
749 if (QUERY_FLAG (tmp, FLAG_NO_DROP)) 687 if (QUERY_FLAG (tmp, FLAG_NO_DROP))
750 { 688 {
751#if 0 689#if 0
752 /* Eneq(@csd.uu.se): Objects with NO_DROP defined can't be dropped. */ 690 /* Eneq(@csd.uu.se): Objects with NO_DROP defined can't be dropped. */
753 new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped."); 691 new_draw_info (NDI_UNIQUE, 0, op, "This item can't be dropped.");
777 715
778 if (op->type == PLAYER) 716 if (op->type == PLAYER)
779 op->contr->count = 0; 717 op->contr->count = 0;
780} 718}
781 719
782
783
784/* Command will drop all items that have not been locked */ 720/* Command will drop all items that have not been locked */
785int 721int
786command_dropall (object *op, char *params) 722command_dropall (object *op, char *params)
787{ 723{
788 724
789 object *curinv, *nextinv;
790
791 if (op->inv == NULL) 725 if (op->inv == NULL)
792 { 726 {
793 new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop!"); 727 new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop!");
794 return 0; 728 return 0;
795 } 729 }
796 730
797 curinv = op->inv; 731 object *curinv = op->inv;
732 object *nextinv;
798 733
799 /* 734 /*
800 This is the default. Drops everything not locked or considered 735 This is the default. Drops everything not locked or considered
801 not something that should be dropped. 736 not something that should be dropped.
802 */ 737 */
806 in a shop. --Tero.Pelander@utu.fi 741 in a shop. --Tero.Pelander@utu.fi
807 */ 742 */
808 743
809 int cnt = MAX_ITEM_PER_DROP; 744 int cnt = MAX_ITEM_PER_DROP;
810 745
811 if (params == NULL) 746 if (!params)
812 { 747 {
813 while (curinv != NULL) 748 while (curinv)
814 { 749 {
815 nextinv = curinv->below; 750 nextinv = curinv->below;
751
816 while (nextinv && nextinv->type == MONEY) 752 while (nextinv && nextinv->type == MONEY)
817 nextinv = nextinv->below; 753 nextinv = nextinv->below;
754
818 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && curinv->type != MONEY && 755 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && curinv->type != MONEY &&
819 curinv->type != FOOD && curinv->type != KEY && 756 curinv->type != FOOD && curinv->type != KEY &&
820 curinv->type != SPECIAL_KEY && curinv->type != GEM && 757 curinv->type != SPECIAL_KEY && curinv->type != GEM &&
821 !curinv->invisible && (curinv->type != CONTAINER || op->container != curinv)) 758 !curinv->invisible && (curinv->type != CONTAINER || op->container != curinv))
822 { 759 {
823 drop (op, curinv); 760 drop (op, curinv);
824 if (--cnt <= 0) break; 761 if (--cnt <= 0) break;
825 } 762 }
763
826 curinv = nextinv; 764 curinv = nextinv;
827 } 765 }
828 } 766 }
829
830 else if (strcmp (params, "weapons") == 0) 767 else if (strcmp (params, "weapons") == 0)
831 { 768 {
832 while (curinv != NULL) 769 while (curinv)
833 { 770 {
834 nextinv = curinv->below; 771 nextinv = curinv->below;
772
835 while (nextinv && nextinv->type == MONEY) 773 while (nextinv && nextinv->type == MONEY)
836 nextinv = nextinv->below; 774 nextinv = nextinv->below;
775
837 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == WEAPON) || (curinv->type == BOW) || (curinv->type == ARROW))) 776 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == WEAPON) || (curinv->type == BOW) || (curinv->type == ARROW)))
838 { 777 {
839 drop (op, curinv); 778 drop (op, curinv);
840 if (--cnt <= 0) break; 779 if (--cnt <= 0) break;
841 } 780 }
781
842 curinv = nextinv; 782 curinv = nextinv;
843 } 783 }
844 } 784 }
845
846 else if (strcmp (params, "armor") == 0 || strcmp (params, "armour") == 0) 785 else if (strcmp (params, "armor") == 0 || strcmp (params, "armour") == 0)
847 { 786 {
848 while (curinv != NULL) 787 while (curinv)
849 { 788 {
850 nextinv = curinv->below; 789 nextinv = curinv->below;
790
851 while (nextinv && nextinv->type == MONEY) 791 while (nextinv && nextinv->type == MONEY)
852 nextinv = nextinv->below; 792 nextinv = nextinv->below;
793
853 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == ARMOUR) || curinv->type == SHIELD || curinv->type == HELMET)) 794 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && ((curinv->type == ARMOUR) || curinv->type == SHIELD || curinv->type == HELMET))
854 { 795 {
855 drop (op, curinv); 796 drop (op, curinv);
856 if (--cnt <= 0) break; 797 if (--cnt <= 0) break;
857 } 798 }
799
858 curinv = nextinv; 800 curinv = nextinv;
859 } 801 }
860 } 802 }
861
862 else if (strcmp (params, "misc") == 0) 803 else if (strcmp (params, "misc") == 0)
863 { 804 {
864 while (curinv != NULL) 805 while (curinv)
865 { 806 {
866 nextinv = curinv->below; 807 nextinv = curinv->below;
808
867 while (nextinv && nextinv->type == MONEY) 809 while (nextinv && nextinv->type == MONEY)
868 nextinv = nextinv->below; 810 nextinv = nextinv->below;
811
869 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && !QUERY_FLAG (curinv, FLAG_APPLIED)) 812 if (!QUERY_FLAG (curinv, FLAG_INV_LOCKED) && !QUERY_FLAG (curinv, FLAG_APPLIED))
870 { 813 {
871 switch (curinv->type) 814 switch (curinv->type)
872 { 815 {
873 case HORN: 816 case HORN:
891 break; 834 break;
892 default: 835 default:
893 curinv = nextinv; 836 curinv = nextinv;
894 break; 837 break;
895 } 838 }
839
896 if (--cnt <= 0) break; 840 if (--cnt <= 0) break;
897 } 841 }
842
898 curinv = nextinv; 843 curinv = nextinv;
899 } 844 }
900 } 845 }
901 846
902 if (cnt <= 0) 847 if (cnt <= 0)
903 op->failmsg ("Only dropped some items, can't drop that many items at once."); 848 op->failmsg ("Only dropped some items, can't drop that many items at once.");
904
905 update_after_inventory_change (op);
906 849
907/* draw_look(op);*/ 850/* draw_look(op);*/
908 return 0; 851 return 0;
909} 852}
910 853
911/* Object op wants to drop object(s) params. params can be a 854/* Object op wants to drop object(s) params. params can be a
912 * comma seperated list. 855 * comma seperated list.
913 */ 856 */
914
915int 857int
916command_drop (object *op, char *params) 858command_drop (object *op, char *params)
917{ 859{
918 object *tmp, *next; 860 object *tmp, *next;
919 int did_one = 0; 861 int did_one = 0;
944 if (!did_one) 886 if (!did_one)
945 new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop."); 887 new_draw_info (NDI_UNIQUE, 0, op, "Nothing to drop.");
946 888
947 if (cnt <= 0) 889 if (cnt <= 0)
948 op->failmsg ("Only dropped some items, can't drop that many items at once."); 890 op->failmsg ("Only dropped some items, can't drop that many items at once.");
949
950 update_after_inventory_change (op);
951 } 891 }
952 892
953 return 0; 893 return 0;
954} 894}
955 895
1030 dynbuf_text buf (512, 512); 970 dynbuf_text buf (512, 512);
1031 971
1032 object *mon = head ? head : this; 972 object *mon = head ? head : this;
1033 973
1034 if (QUERY_FLAG (mon, FLAG_UNDEAD)) 974 if (QUERY_FLAG (mon, FLAG_UNDEAD))
1035 buf << "It is an undead force.\n"; 975 buf << " - It is an undead force.\n";
1036 976
1037 if (mon->level > who->level) 977 if (mon->level > who->level)
1038 buf << "It is likely more powerful than you.\n"; 978 buf << " - It is likely more powerful than you.\n";
1039 else if (mon->level < who->level) 979 else if (mon->level < who->level)
1040 buf << "It is likely less powerful than you.\n"; 980 buf << " - It is likely less powerful than you.\n";
1041 else 981 else
1042 buf << "It is probably as powerful as you.\n"; 982 buf << " - It is probably as powerful as you.\n";
1043 983
1044 if (mon->attacktype & AT_ACID) 984 if (mon->attacktype & AT_ACID)
1045 buf << "You seem to smell an acrid odor.\n"; 985 buf << " - You seem to smell an acrid odor.\n";
1046 986
1047 /* Anyone know why this used to use the clone value instead of the 987 /* Anyone know why this used to use the clone value instead of the
1048 * maxhp field? This seems that it should give more accurate results. 988 * maxhp field? This seems that it should give more accurate results.
1049 */ 989 */
1050 switch ((mon->stats.hp + 1) * 4 / (mon->stats.maxhp + 1)) 990 switch ((mon->stats.hp + 1) * 4 / (mon->stats.maxhp + 1))
1051 { /* From 1-4 */ 991 { /* From 1-4 */
1052 case 1: 992 case 1:
1053 buf << "It is in a bad shape.\n"; 993 buf << " - It is in a bad shape.\n";
1054 break; 994 break;
1055 case 2: 995 case 2:
1056 buf << "It is hurt.\n"; 996 buf << " - It is hurt.\n";
1057 break; 997 break;
1058 case 3: 998 case 3:
1059 buf << "It is somewhat hurt.\n"; 999 buf << " - It is somewhat hurt.\n";
1060 break; 1000 break;
1061 case 4: 1001 case 4:
1062 buf << "It is in excellent shape.\n"; 1002 buf << " - It is in excellent shape.\n";
1063 break; 1003 break;
1064 } 1004 }
1065 1005
1066 if (present_in_ob (POISONING, mon)) 1006 if (present_in_ob (POISONING, mon))
1067 buf << "It looks very ill.\n"; 1007 buf << " - It looks very ill.\n";
1068 1008
1069 return buf; 1009 return buf;
1070} 1010}
1071 1011
1072/* tmp is the object being described, pl is who is examing it. */ 1012/* tmp is the object being described, pl is who is examing it. */
1130std::string 1070std::string
1131object::describe (object *who) 1071object::describe (object *who)
1132{ 1072{
1133 dynbuf_text buf (1024, 1024); 1073 dynbuf_text buf (1024, 1024);
1134 1074
1135 buf.printf ("That is: %s.\n", long_desc (who).c_str ()); 1075 buf.printf ("That is: %s.\n\n", long_desc (who).c_str ());
1136 1076
1137 if (custom_name) 1077 if (custom_name)
1138 buf.printf ("You call it %s\n", &custom_name); 1078 buf.printf ("You call it %s.\n\n", &custom_name);
1139 1079
1140 switch (type) 1080 switch (type)
1141 { 1081 {
1142 case SPELLBOOK: 1082 case SPELLBOOK:
1143 if (flag [FLAG_IDENTIFIED] && inv) 1083 if (flag [FLAG_IDENTIFIED] && inv)
1144 buf.printf ("%s is a %s %s spell\n", &inv->name, get_levelnumber (inv->level), &inv->skill); 1084 buf.printf ("%s is a %s %s spell.\n", &inv->name, get_levelnumber (inv->level), &inv->skill);
1145 break; 1085 break;
1146 1086
1147 case BOOK: 1087 case BOOK:
1148 if (msg) 1088 if (msg)
1149 buf << "Something is written in it.\n"; 1089 buf << "Something is written in it.\n";
1208 buf << "This is a buildable item.\n"; 1148 buf << "This is a buildable item.\n";
1209 1149
1210 /* Does the object have a message? Don't show message for all object 1150 /* Does the object have a message? Don't show message for all object
1211 * types - especially if the first entry is a match 1151 * types - especially if the first entry is a match
1212 */ 1152 */
1213 if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && *msg != '@') 1153 if (msg && type != EXIT && type != BOOK && type != CORPSE && !move_on && !has_dialogue ())
1214 { 1154 {
1215 /* This is just a hack so when identifying the items, we print 1155 /* This is just a hack so when identifying the items, we print
1216 * out the extra message 1156 * out the extra message
1217 */ 1157 */
1218 if (need_identify (this) && flag [FLAG_IDENTIFIED]) 1158 if (need_identify (this) && flag [FLAG_IDENTIFIED])
1219 buf << "The object has a story:\n"; 1159 buf << "The object has a story:\n\n";
1220 1160
1221 buf << msg << '\n'; 1161 buf << msg << '\n';
1222 } 1162 }
1223 1163
1224 buf << '\n'; 1164 buf << '\n';

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines