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.18 by root, Sat Sep 16 22:24:13 2006 UTC vs.
Revision 1.24 by root, Fri Dec 15 19:59:20 2006 UTC

23 23
24#include <global.h> 24#include <global.h>
25#include <spells.h> 25#include <spells.h>
26#include <skills.h> 26#include <skills.h>
27#include <living.h> 27#include <living.h>
28#include <newclient.h>
29#ifndef __CEXTRACT__
30# include <sproto.h> 28#include <sproto.h>
31#endif
32#include <math.h> 29#include <math.h>
33 30
34/* this is a measure of how effective store specialisation is. A general store 31/* this is a measure of how effective store specialisation is. A general store
35 * will offer this proportion of the 'maximum' price, a specialised store will 32 * will offer this proportion of the 'maximum' price, a specialised store will
36 * offer a range of prices around it such that the maximum price is always one 33 * offer a range of prices around it such that the maximum price is always one
590 { 587 {
591 // This should not happen, but if it does, just merge the two. 588 // This should not happen, but if it does, just merge the two.
592 if (coin_objs [i]) 589 if (coin_objs [i])
593 { 590 {
594 LOG (llevError, "%s has two money entries of (%s)\n", &pouch->name, coins[NUM_COINS - 1 - i]); 591 LOG (llevError, "%s has two money entries of (%s)\n", &pouch->name, coins[NUM_COINS - 1 - i]);
595 remove_ob (tmp); 592 tmp->remove ();
596 coin_objs[i]->nrof += tmp->nrof; 593 coin_objs[i]->nrof += tmp->nrof;
597 esrv_del_item (pl->contr, tmp->count); 594 esrv_del_item (pl->contr, tmp->count);
598 free_object (tmp); 595 tmp->destroy ();
599 } 596 }
600 else 597 else
601 { 598 {
602 remove_ob (tmp); 599 tmp->remove ();
603 600
604 if (pouch->type == PLAYER) 601 if (pouch->type == PLAYER)
605 esrv_del_item (pl->contr, tmp->count); 602 esrv_del_item (pl->contr, tmp->count);
606 603
607 coin_objs[i] = tmp; 604 coin_objs[i] = tmp;
666 663
667 if (pl->type != PLAYER) 664 if (pl->type != PLAYER)
668 esrv_send_item (pl, pl); 665 esrv_send_item (pl, pl);
669 } 666 }
670 else 667 else
671 free_object (coin_objs[i]); 668 coin_objs[i]->destroy ();
672 } 669 }
673} 670}
674 671
675/* Checks all unpaid items in op's inventory, adds up all the money they 672/* Checks all unpaid items in op's inventory, adds up all the money they
676 * have, and checks that they can actually afford what they want to buy. 673 * have, and checks that they can actually afford what they want to buy.
681can_pay (object *pl) 678can_pay (object *pl)
682{ 679{
683 int unpaid_count = 0; 680 int unpaid_count = 0;
684 sint64 unpaid_price = 0; 681 sint64 unpaid_price = 0;
685 sint64 player_wealth = query_money (pl); 682 sint64 player_wealth = query_money (pl);
686 object *item;
687 683
688 if (!pl || pl->type != PLAYER) 684 if (!pl || pl->type != PLAYER)
689 { 685 {
690 LOG (llevError, "can_pay(): called against something that isn't a player\n"); 686 LOG (llevError, "can_pay(): called against something that isn't a player\n");
691 return 0; 687 return 0;
839 } 835 }
840 } 836 }
841 } 837 }
842 838
843 if (amount != 0) 839 if (amount != 0)
844#ifndef WIN32
845 LOG (llevError, "Warning - payment in pay_player () not zero: %llu\n", amount); 840 LOG (llevError, "Warning - payment in pay_player () not zero: %llu\n", amount);
846#else
847 LOG (llevError, "Warning - payment in pay_player () not zero: %I64u\n", amount);
848#endif
849} 841}
850 842
851/* elmex: this is for the bank plugin :( */ 843/* elmex: this is for the bank plugin :( */
852sint64 844sint64
853pay_player_arch (object *pl, const char *arch, sint64 amount) 845pay_player_arch (object *pl, const char *arch, sint64 amount)
1183 case RING: 1175 case RING:
1184 case AMULET: 1176 case AMULET:
1185 case BRACERS: 1177 case BRACERS:
1186 case GIRDLE: 1178 case GIRDLE:
1187 sprintf (buf, "%s %s", query_base_name (tmp, 0), describe_item (tmp, NULL)); 1179 sprintf (buf, "%s %s", query_base_name (tmp, 0), describe_item (tmp, NULL));
1188 items[*numitems].item_sort = strdup_local (buf); 1180 items[*numitems].item_sort = strdup (buf);
1189 sprintf (buf, "%s %s", query_name (tmp), describe_item (tmp, NULL)); 1181 sprintf (buf, "%s %s", query_name (tmp), describe_item (tmp, NULL));
1190 items[*numitems].item_real = strdup_local (buf); 1182 items[*numitems].item_real = strdup (buf);
1191 (*numitems)++; 1183 (*numitems)++;
1192 break; 1184 break;
1193#endif 1185#endif
1194 1186
1195 default: 1187 default:
1196 items[*numitems].item_sort = strdup_local (query_base_name (tmp, 0)); 1188 items[*numitems].item_sort = strdup (query_base_name (tmp, 0));
1197 items[*numitems].item_real = strdup_local (query_base_name (tmp, 1)); 1189 items[*numitems].item_real = strdup (query_base_name (tmp, 1));
1198 (*numitems)++; 1190 (*numitems)++;
1199 break; 1191 break;
1200 } 1192 }
1201 SET_FLAG (tmp, FLAG_UNPAID); 1193 SET_FLAG (tmp, FLAG_UNPAID);
1202} 1194}

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines