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.56 by root, Mon Sep 29 10:20:49 2008 UTC vs.
Revision 1.60 by root, Thu Jan 1 11:41:17 2009 UTC

465 } 465 }
466 466
467 for (tmp = op->inv; tmp; tmp = tmp->below) 467 for (tmp = op->inv; tmp; tmp = tmp->below)
468 if (tmp->type == MONEY) 468 if (tmp->type == MONEY)
469 total += tmp->nrof * (sint64)tmp->value; 469 total += tmp->nrof * (sint64)tmp->value;
470 else if (tmp->type == CONTAINER && QUERY_FLAG (tmp, FLAG_APPLIED) && (tmp->race == NULL || strstr (tmp->race, "gold"))) 470 else if (tmp->type == CONTAINER && QUERY_FLAG (tmp, FLAG_APPLIED) && (!tmp->race || tmp->race.contains ("gold")))
471 total += query_money (tmp); 471 total += query_money (tmp);
472 472
473 return total; 473 return total;
474} 474}
475 475
490 return 0; 490 return 0;
491 491
492 pay_from_container (pl, pl, to_pay); 492 pay_from_container (pl, pl, to_pay);
493 493
494 for (pouch = pl->inv; pouch && to_pay; pouch = pouch->below) 494 for (pouch = pl->inv; pouch && to_pay; pouch = pouch->below)
495 if (pouch->type == CONTAINER && QUERY_FLAG (pouch, FLAG_APPLIED) && (pouch->race == NULL || strstr (pouch->race, "gold"))) 495 if (pouch->type == CONTAINER && QUERY_FLAG (pouch, FLAG_APPLIED) && (!pouch->race || pouch->race.contains ("gold")))
496 pay_from_container (pl, pouch, to_pay); 496 pay_from_container (pl, pouch, to_pay);
497 497
498 pl->update_stats (); 498 pl->update_stats ();
499 return 1; 499 return 1;
500} 500}
527 change_exp (pl, saved_money, "bargaining", SK_EXP_NONE); 527 change_exp (pl, saved_money, "bargaining", SK_EXP_NONE);
528 528
529 pay_from_container (pl, pl, to_pay); 529 pay_from_container (pl, pl, to_pay);
530 530
531 for (pouch = pl->inv; pouch && to_pay; pouch = pouch->below) 531 for (pouch = pl->inv; pouch && to_pay; pouch = pouch->below)
532 if (pouch->type == CONTAINER && QUERY_FLAG (pouch, FLAG_APPLIED) && (pouch->race == NULL || strstr (pouch->race, "gold"))) 532 if (pouch->type == CONTAINER && QUERY_FLAG (pouch, FLAG_APPLIED) && (!pouch->race || pouch->race.contains ("gold")))
533 pay_from_container (pl, pouch, to_pay); 533 pay_from_container (pl, pouch, to_pay);
534 534
535 pl->update_stats (); 535 pl->update_stats ();
536 536
537 return 1; 537 return 1;
577 // This should not happen, but if it does, just merge the two. 577 // This should not happen, but if it does, just merge the two.
578 if (coin_objs [i]) 578 if (coin_objs [i])
579 { 579 {
580 LOG (llevError, "%s has two money entries of (%s)\n", &pouch->name, coins[NUM_COINS - 1 - i]); 580 LOG (llevError, "%s has two money entries of (%s)\n", &pouch->name, coins[NUM_COINS - 1 - i]);
581 coin_objs[i]->nrof += tmp->nrof; 581 coin_objs[i]->nrof += tmp->nrof;
582 tmp->destroy (true); 582 tmp->destroy ();
583 } 583 }
584 else 584 else
585 { 585 {
586 tmp->remove (); 586 tmp->remove ();
587 coin_objs[i] = tmp; 587 coin_objs[i] = tmp;
634 634
635 for (i = 0; i < NUM_COINS; i++) 635 for (i = 0; i < NUM_COINS; i++)
636 if (coin_objs[i]->nrof) 636 if (coin_objs[i]->nrof)
637 insert_ob_in_ob (coin_objs [i], pouch); 637 insert_ob_in_ob (coin_objs [i], pouch);
638 else 638 else
639 coin_objs[i]->destroy (true); 639 coin_objs[i]->destroy ();
640} 640}
641 641
642/* Checks all unpaid items in op's inventory, adds up all the money they 642/* Checks all unpaid items in op's inventory, adds up all the money they
643 * have, and checks that they can actually afford what they want to buy. 643 * have, and checks that they can actually afford what they want to buy.
644 * Returns 1 if they can, and 0 if they can't. also prints an appropriate message 644 * Returns 1 if they can, and 0 if they can't. also prints an appropriate message
669 dynbuf_text buf; 669 dynbuf_text buf;
670 670
671 buf << "You have " << unpaid_count 671 buf << "You have " << unpaid_count
672 << " unpaid item(s) that would cost you " << cost_string_from_value (unpaid_price, 0) 672 << " unpaid item(s) that would cost you " << cost_string_from_value (unpaid_price, 0)
673 << ". You need another " << cost_string_from_value (unpaid_price - player_wealth, 0) 673 << ". You need another " << cost_string_from_value (unpaid_price - player_wealth, 0)
674 << " to be able to afford that."; 674 << " to be able to afford that. "
675 "H<You cannot leave a shop without paying - drop unpaid items first to be able to leave.>";
675 676
676 pl->failmsg (buf); 677 pl->failmsg (buf);
677 678
678 return 0; 679 return 0;
679 } 680 }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines