… | |
… | |
590 | { |
590 | { |
591 | // This should not happen, but if it does, just merge the two. |
591 | // This should not happen, but if it does, just merge the two. |
592 | if (coin_objs [i]) |
592 | if (coin_objs [i]) |
593 | { |
593 | { |
594 | LOG (llevError, "%s has two money entries of (%s)\n", &pouch->name, coins[NUM_COINS - 1 - i]); |
594 | LOG (llevError, "%s has two money entries of (%s)\n", &pouch->name, coins[NUM_COINS - 1 - i]); |
595 | remove_ob (tmp); |
595 | tmp->remove (); |
596 | coin_objs[i]->nrof += tmp->nrof; |
596 | coin_objs[i]->nrof += tmp->nrof; |
597 | esrv_del_item (pl->contr, tmp->count); |
597 | esrv_del_item (pl->contr, tmp->count); |
598 | free_object (tmp); |
598 | tmp->destroy (); |
599 | } |
599 | } |
600 | else |
600 | else |
601 | { |
601 | { |
602 | remove_ob (tmp); |
602 | tmp->remove (); |
603 | |
603 | |
604 | if (pouch->type == PLAYER) |
604 | if (pouch->type == PLAYER) |
605 | esrv_del_item (pl->contr, tmp->count); |
605 | esrv_del_item (pl->contr, tmp->count); |
606 | |
606 | |
607 | coin_objs[i] = tmp; |
607 | coin_objs[i] = tmp; |
… | |
… | |
666 | |
666 | |
667 | if (pl->type != PLAYER) |
667 | if (pl->type != PLAYER) |
668 | esrv_send_item (pl, pl); |
668 | esrv_send_item (pl, pl); |
669 | } |
669 | } |
670 | else |
670 | else |
671 | free_object (coin_objs[i]); |
671 | coin_objs[i]->destroy (); |
672 | } |
672 | } |
673 | } |
673 | } |
674 | |
674 | |
675 | /* Checks all unpaid items in op's inventory, adds up all the money they |
675 | /* 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. |
676 | * have, and checks that they can actually afford what they want to buy. |
… | |
… | |
681 | can_pay (object *pl) |
681 | can_pay (object *pl) |
682 | { |
682 | { |
683 | int unpaid_count = 0; |
683 | int unpaid_count = 0; |
684 | sint64 unpaid_price = 0; |
684 | sint64 unpaid_price = 0; |
685 | sint64 player_wealth = query_money (pl); |
685 | sint64 player_wealth = query_money (pl); |
686 | object *item; |
|
|
687 | |
686 | |
688 | if (!pl || pl->type != PLAYER) |
687 | if (!pl || pl->type != PLAYER) |
689 | { |
688 | { |
690 | LOG (llevError, "can_pay(): called against something that isn't a player\n"); |
689 | LOG (llevError, "can_pay(): called against something that isn't a player\n"); |
691 | return 0; |
690 | return 0; |
… | |
… | |
839 | } |
838 | } |
840 | } |
839 | } |
841 | } |
840 | } |
842 | |
841 | |
843 | if (amount != 0) |
842 | if (amount != 0) |
844 | #ifndef WIN32 |
|
|
845 | LOG (llevError, "Warning - payment in pay_player () not zero: %llu\n", amount); |
843 | 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 | } |
844 | } |
850 | |
845 | |
851 | /* elmex: this is for the bank plugin :( */ |
846 | /* elmex: this is for the bank plugin :( */ |
852 | sint64 |
847 | sint64 |
853 | pay_player_arch (object *pl, const char *arch, sint64 amount) |
848 | pay_player_arch (object *pl, const char *arch, sint64 amount) |
… | |
… | |
1183 | case RING: |
1178 | case RING: |
1184 | case AMULET: |
1179 | case AMULET: |
1185 | case BRACERS: |
1180 | case BRACERS: |
1186 | case GIRDLE: |
1181 | case GIRDLE: |
1187 | sprintf (buf, "%s %s", query_base_name (tmp, 0), describe_item (tmp, NULL)); |
1182 | sprintf (buf, "%s %s", query_base_name (tmp, 0), describe_item (tmp, NULL)); |
1188 | items[*numitems].item_sort = strdup_local (buf); |
1183 | items[*numitems].item_sort = strdup (buf); |
1189 | sprintf (buf, "%s %s", query_name (tmp), describe_item (tmp, NULL)); |
1184 | sprintf (buf, "%s %s", query_name (tmp), describe_item (tmp, NULL)); |
1190 | items[*numitems].item_real = strdup_local (buf); |
1185 | items[*numitems].item_real = strdup (buf); |
1191 | (*numitems)++; |
1186 | (*numitems)++; |
1192 | break; |
1187 | break; |
1193 | #endif |
1188 | #endif |
1194 | |
1189 | |
1195 | default: |
1190 | default: |
1196 | items[*numitems].item_sort = strdup_local (query_base_name (tmp, 0)); |
1191 | items[*numitems].item_sort = strdup (query_base_name (tmp, 0)); |
1197 | items[*numitems].item_real = strdup_local (query_base_name (tmp, 1)); |
1192 | items[*numitems].item_real = strdup (query_base_name (tmp, 1)); |
1198 | (*numitems)++; |
1193 | (*numitems)++; |
1199 | break; |
1194 | break; |
1200 | } |
1195 | } |
1201 | SET_FLAG (tmp, FLAG_UNPAID); |
1196 | SET_FLAG (tmp, FLAG_UNPAID); |
1202 | } |
1197 | } |