… | |
… | |
509 | if (tmp->invisible) |
509 | if (tmp->invisible) |
510 | { |
510 | { |
511 | tmp = next; |
511 | tmp = next; |
512 | continue; |
512 | continue; |
513 | } |
513 | } |
|
|
514 | |
514 | /* This following two if and else if could be merged into line |
515 | /* This following two if and else if could be merged into line |
515 | * but that probably will make it more difficult to read, and |
516 | * but that probably will make it more difficult to read, and |
516 | * not make it any more efficient |
517 | * not make it any more efficient |
517 | */ |
518 | */ |
518 | if (params && item_matched_string (op, tmp, params)) |
519 | if (params && item_matched_string (op, tmp, params)) |
519 | { |
|
|
520 | pick_up (op, tmp); |
520 | pick_up (op, tmp); |
521 | } |
|
|
522 | else if (can_pick (op, tmp) && !params) |
521 | else if (can_pick (op, tmp) && !params) |
523 | { |
522 | { |
524 | pick_up (op, tmp); |
523 | pick_up (op, tmp); |
525 | break; |
524 | break; |
526 | } |
525 | } |
|
|
526 | |
527 | tmp = next; |
527 | tmp = next; |
528 | /* Might as well just skip over the player immediately - |
|
|
529 | * we know it can't be picked up |
|
|
530 | */ |
|
|
531 | if (tmp == op) |
|
|
532 | tmp = tmp->below; |
|
|
533 | } |
528 | } |
|
|
529 | |
534 | if (!params && !tmp) |
530 | if (!params && !tmp) |
535 | { |
531 | { |
536 | for (tmp = op->below; tmp != NULL; tmp = tmp->next) |
532 | for (tmp = op->below; tmp; tmp = tmp->below) |
537 | if (!tmp->invisible) |
533 | if (!tmp->invisible) |
538 | { |
534 | { |
539 | char buf[MAX_BUF]; |
535 | char buf[MAX_BUF]; |
540 | |
536 | |
541 | sprintf (buf, "You can't pick up a %s.", &tmp->name); |
537 | sprintf (buf, "You can't pick up a %s.", &tmp->name); |
542 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
538 | new_draw_info (NDI_UNIQUE, 0, op, buf); |
543 | break; |
539 | break; |
544 | } |
540 | } |
|
|
541 | |
545 | if (!tmp) |
542 | if (!tmp) |
546 | new_draw_info (NDI_UNIQUE, 0, op, "There is nothing to pick up."); |
543 | new_draw_info (NDI_UNIQUE, 0, op, "There is nothing to pick up."); |
547 | } |
544 | } |
|
|
545 | |
548 | return 0; |
546 | return 0; |
549 | } |
547 | } |
550 | |
548 | |
551 | |
549 | |
552 | /* |
550 | /* |