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

Comparing deliantra/server/server/shop.C (file contents):
Revision 1.48 by root, Tue Apr 22 02:46:18 2008 UTC vs.
Revision 1.49 by root, Tue Apr 22 07:01:47 2008 UTC

640 } 640 }
641 641
642 for (i = 0; i < NUM_COINS; i++) 642 for (i = 0; i < NUM_COINS; i++)
643 { 643 {
644 if (coin_objs[i]->nrof) 644 if (coin_objs[i]->nrof)
645 {
646 object *tmp = insert_ob_in_ob (coin_objs[i], pouch); 645 insert_ob_in_ob (coin_objs [i], pouch);
647
648 esrv_send_item (pl, tmp);
649 esrv_send_item (pl, pouch);
650
651 if (pl != pouch)
652 esrv_update_item (UPD_WEIGHT, pl, pouch);
653
654 if (pl->type != PLAYER)
655 esrv_send_item (pl, pl);
656 }
657 else 646 else
658 coin_objs[i]->destroy (); 647 coin_objs[i]->destroy ();
659 } 648 }
660} 649}
661 650
732 SET_FLAG (op, FLAG_UNPAID); 721 SET_FLAG (op, FLAG_UNPAID);
733 return 0; 722 return 0;
734 } 723 }
735 else 724 else
736 { 725 {
737 object *tmp;
738
739 CLEAR_FLAG (op, FLAG_UNPAID); 726 CLEAR_FLAG (op, FLAG_UNPAID);
740 CLEAR_FLAG (op, FLAG_PLAYER_SOLD); 727 CLEAR_FLAG (op, FLAG_PLAYER_SOLD);
741 new_draw_info_format (NDI_UNIQUE, 0, op, "You paid %s for %s.", buf, query_name (op)); 728 new_draw_info_format (NDI_UNIQUE, 0, op, "You paid %s for %s.", buf, query_name (op));
742 tmp = merge_ob (op, NULL);
743 729
744 if (pl->type == PLAYER) 730 if (!merge_ob (op, op->env->inv))
745 {
746 if (tmp)
747 { /* it was merged */
748 esrv_del_item (pl->contr, op->count);
749 op = tmp;
750 }
751
752 esrv_send_item (pl, op); 731 esrv_update_item (UPD_FLAGS, pl, op);
753 }
754 732
755 goto next_item; 733 goto next_item;
756 } 734 }
757 } 735 }
758 } 736 }
800 if (n > 0 && (!pouch->weight_limit || pouch->carrying + w <= pouch->weight_limit)) 778 if (n > 0 && (!pouch->weight_limit || pouch->carrying + w <= pouch->weight_limit))
801 { 779 {
802 if (pouch->weight_limit && (pouch->weight_limit - pouch->carrying) / w < n) 780 if (pouch->weight_limit && (pouch->weight_limit - pouch->carrying) / w < n)
803 n = (pouch->weight_limit - pouch->carrying) / w; 781 n = (pouch->weight_limit - pouch->carrying) / w;
804 782
805 tmp = arch_to_object (at); 783 object *tmp = arch_to_object (at);
806 tmp->nrof = n; 784 tmp->nrof = n;
807 amount -= tmp->nrof * tmp->value; 785 amount -= tmp->nrof * tmp->value;
808 tmp = insert_ob_in_ob (tmp, pouch); 786 pouch->insert (tmp);
809 esrv_send_item (pl, tmp);
810 esrv_send_item (pl, pouch);
811 esrv_update_item (UPD_WEIGHT, pl, pouch);
812 esrv_send_item (pl, pl);
813 } 787 }
814 } 788 }
815 } 789 }
816 790
817 if (amount / at->value > 0) 791 if (amount / at->value > 0)
818 { 792 {
819 tmp = arch_to_object (at); 793 object *tmp = arch_to_object (at);
820 tmp->nrof = amount / tmp->value; 794 tmp->nrof = amount / tmp->value;
821 amount -= tmp->nrof * tmp->value; 795 amount -= tmp->nrof * tmp->value;
822 tmp = insert_ob_in_ob (tmp, pl); 796 pl->insert (tmp);
823 esrv_send_item (pl, tmp);
824 esrv_send_item (pl, pl);
825 } 797 }
826 } 798 }
827 } 799 }
828 800
829 if (amount != 0) 801 if (amount != 0)
841 813
842 if (amount > 0) 814 if (amount > 0)
843 { 815 {
844 object *tmp = arch_to_object (at); 816 object *tmp = arch_to_object (at);
845 tmp->nrof = amount; 817 tmp->nrof = amount;
846 tmp = insert_ob_in_ob (tmp, pl); 818 insert_ob_in_ob (tmp, pl);
847 esrv_send_item (pl, tmp);
848 esrv_send_item (pl, pl);
849 } 819 }
850 820
851 return 1; 821 return 1;
852} 822}
853 823

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines