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.52 by root, Fri May 2 16:16:02 2008 UTC vs.
Revision 1.54 by root, Sat Aug 30 02:26:46 2008 UTC

666 unpaid_price += query_cost (item, pl, F_BUY | F_SHOP); 666 unpaid_price += query_cost (item, pl, F_BUY | F_SHOP);
667 } 667 }
668 668
669 if (unpaid_price > player_wealth) 669 if (unpaid_price > player_wealth)
670 { 670 {
671 char buf[MAX_BUF]; 671 dynbuf_text buf;
672 char cost[MAX_BUF];
673 char missing[MAX_BUF];
674 672
675 snprintf (cost, MAX_BUF, "%s", cost_string_from_value (unpaid_price, 0)); 673 buf << "You have " << unpaid_count
676 snprintf (missing, MAX_BUF, "%s", cost_string_from_value (unpaid_price - player_wealth, 0)); 674 << " unpaid item(s) that would cost you " << cost_string_from_value (unpaid_price, 0)
675 << ". You need another " << cost_string_from_value (unpaid_price - player_wealth, 0)
676 << " to be able to afford that.";
677 677
678 snprintf (buf, MAX_BUF, "You have %d unpaid items that would cost you %s. You need another %s to be able to afford that.", 678 pl->failmsg (buf);
679 unpaid_count, cost, missing);
680 new_draw_info (NDI_UNIQUE, 0, pl, buf);
681 679
682 return 0; 680 return 0;
683 } 681 }
684 else 682 else
685 return 1; 683 return 1;
797 795
798/* elmex: this is for the bank plugin :( */ 796/* elmex: this is for the bank plugin :( */
799sint64 797sint64
800pay_player_arch (object *pl, const char *arch, sint64 amount) 798pay_player_arch (object *pl, const char *arch, sint64 amount)
801{ 799{
802 archetype *at = archetype::find (arch);
803
804 if (!at)
805 return 0;
806
807 if (amount > 0) 800 if (amount)
808 { 801 {
809 object *tmp = arch_to_object (at); 802 object *ob = archetype::get (arch);
803
804 if (!ob)
805 return 0;
806
810 tmp->nrof = amount; 807 ob->nrof = amount;
811 insert_ob_in_ob (tmp, pl); 808 pl->insert (ob);
812 } 809 }
813 810
814 return 1; 811 return 1;
815} 812}
816 813
1128 1125
1129void 1126void
1130shop_listing (object *sign, object *op) 1127shop_listing (object *sign, object *op)
1131{ 1128{
1132 int i, j, numitems = 0, numallocated = 0, x1, x2, y1, y2; 1129 int i, j, numitems = 0, numallocated = 0, x1, x2, y1, y2;
1133 const char *shop_coords = get_ob_key_value (sign, "shop_coords"); 1130 const char *shop_coords = sign->kv (shstr_shop_coords);
1134 object *stack; 1131 object *stack;
1135 shopinv *items; 1132 shopinv *items;
1136 1133
1137 /* Should never happen, but just in case a monster does apply a sign */ 1134 /* Should never happen, but just in case a monster does apply a sign */
1138 if (op->type != PLAYER) 1135 if (op->type != PLAYER)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines