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.3 by elmex, Mon Aug 14 07:10:47 2006 UTC vs.
Revision 1.4 by root, Sat Aug 26 23:36:34 2006 UTC

1/* 1/*
2 * static char *rcsid_shop_c = 2 * static char *rcsid_shop_c =
3 * "$Id: shop.C,v 1.3 2006/08/14 07:10:47 elmex Exp $"; 3 * "$Id: shop.C,v 1.4 2006/08/26 23:36:34 root Exp $";
4 */ 4 */
5 5
6/* 6/*
7 CrossFire, A Multiplayer game for X-windows 7 CrossFire, A Multiplayer game for X-windows
8 8
576 /* Note that the coin_objs array goes from least value to greatest value */ 576 /* Note that the coin_objs array goes from least value to greatest value */
577 for (i=0; i<NUM_COINS; i++) 577 for (i=0; i<NUM_COINS; i++)
578 if (coin_objs[i]==NULL) { 578 if (coin_objs[i]==NULL) {
579 at = find_archetype(coins[NUM_COINS-1-i]); 579 at = find_archetype(coins[NUM_COINS-1-i]);
580 if (at==NULL) LOG(llevError, "Could not find %s archetype\n", coins[NUM_COINS-1-i]); 580 if (at==NULL) LOG(llevError, "Could not find %s archetype\n", coins[NUM_COINS-1-i]);
581 coin_objs[i] = get_object(); 581 coin_objs[i] = arch_to_object (at);
582 copy_object(&at->clone, coin_objs[i]);
583 coin_objs[i]->nrof = 0; 582 coin_objs[i]->nrof = 0;
584 } 583 }
585 584
586 for (i=0; i<NUM_COINS; i++) { 585 for (i=0; i<NUM_COINS; i++) {
587 int num_coins; 586 int num_coins;
772 if (n > 0 && (!pouch->weight_limit || pouch->carrying + w <= pouch->weight_limit)) 771 if (n > 0 && (!pouch->weight_limit || pouch->carrying + w <= pouch->weight_limit))
773 { 772 {
774 if (pouch->weight_limit && (pouch->weight_limit - pouch->carrying) / w < n) 773 if (pouch->weight_limit && (pouch->weight_limit - pouch->carrying) / w < n)
775 n = (pouch->weight_limit - pouch->carrying) / w; 774 n = (pouch->weight_limit - pouch->carrying) / w;
776 775
777 tmp = get_object (); 776 tmp = arch_to_object (at);
778 copy_object (&at->clone, tmp);
779 tmp->nrof = n; 777 tmp->nrof = n;
780 amount -= (uint64)tmp->nrof * (uint64)tmp->value; 778 amount -= (uint64)tmp->nrof * (uint64)tmp->value;
781 tmp = insert_ob_in_ob (tmp, pouch); 779 tmp = insert_ob_in_ob (tmp, pouch);
782 esrv_send_item (pl, tmp); 780 esrv_send_item (pl, tmp);
783 esrv_send_item (pl, pouch); 781 esrv_send_item (pl, pouch);
787 } 785 }
788 } 786 }
789 787
790 if (amount / at->clone.value > 0) 788 if (amount / at->clone.value > 0)
791 { 789 {
792 tmp = get_object (); 790 tmp = arch_to_object (at);
793 copy_object (&at->clone, tmp);
794 tmp->nrof = amount / tmp->value; 791 tmp->nrof = amount / tmp->value;
795 amount -= (uint64)tmp->nrof * (uint64)tmp->value; 792 amount -= (uint64)tmp->nrof * (uint64)tmp->value;
796 tmp = insert_ob_in_ob (tmp, pl); 793 tmp = insert_ob_in_ob (tmp, pl);
797 esrv_send_item (pl, tmp); 794 esrv_send_item (pl, tmp);
798 esrv_send_item (pl, pl); 795 esrv_send_item (pl, pl);
816 if (at == NULL) 813 if (at == NULL)
817 return 0; 814 return 0;
818 815
819 if (amount > 0) 816 if (amount > 0)
820 { 817 {
821 tmp = get_object (); 818 tmp = arch_to_object (at);
822 copy_object (&at->clone, tmp);
823 tmp->nrof = amount; 819 tmp->nrof = amount;
824 tmp = insert_ob_in_ob (tmp, pl); 820 tmp = insert_ob_in_ob (tmp, pl);
825 esrv_send_item (pl, tmp); 821 esrv_send_item (pl, tmp);
826 esrv_send_item (pl, pl); 822 esrv_send_item (pl, pl);
827 } 823 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines