Exemplo n.º 1
0
/*
 * buy_it:
 *	Buy the item on which the hero stands
 */
int buy_it()
{
  int wh;

  if (purse <= 0) {
    msg("You have no money.");
    return 0;
  }
  if (curprice < 0) { /* if not yet priced */
    wh = price_it();
    if (!wh) /* nothing to price */
      return 0;
    msg("Do you want to buy it? ");
    do {
      wh = readchar();
      if (isupper(wh))
        wh = tolower(wh);
      if (wh == ESCAPE || wh == 'n') {
        msg("");
        return 0;
      }
    }
    until(wh == 'y');
  }
Exemplo n.º 2
0
buy_it()
{
        reg int wh;
        struct linked_list *item = NULL;
        struct object *obj = NULL;
        int wasfood = FALSE;

        if (purse <= 0) {
            msg("You have no money.");
            return;
        }
        if (curprice < 0) {             /* if not yet priced */
            wh = price_it();
            if (!wh)                    /* nothing to price */
                return;
            msg("Do you want to buy it? ");
            do {
                wh = wgetch(cw);
                if (wh == ESC || wh == 'n') {
                    msg("");
                    return;
                }
            } until(wh == 'y');
        }