| 4724 | } |
| 4725 | |
| 4726 | staticfn int |
| 4727 | readobjnam_postparse3(struct _readobjnam_data *d) |
| 4728 | { |
| 4729 | int i; |
| 4730 | |
| 4731 | /* check real names of gems first */ |
| 4732 | if (!d->oclass && d->actualn) { |
| 4733 | for (i = svb.bases[GEM_CLASS]; i <= LAST_REAL_GEM; i++) { |
| 4734 | const char *zn; |
| 4735 | |
| 4736 | if ((zn = OBJ_NAME(objects[i])) != 0 && !strcmpi(d->actualn, zn)) { |
| 4737 | d->typ = i; |
| 4738 | return 2; /*goto typfnd;*/ |
| 4739 | } |
| 4740 | } |
| 4741 | /* "tin of foo" would be caught above, but plain "tin" has |
| 4742 | a random chance of yielding "tin wand" unless we do this */ |
| 4743 | if (!strcmpi(d->actualn, "tin")) { |
| 4744 | d->typ = TIN; |
| 4745 | return 2; /*goto typfnd;*/ |
| 4746 | } |
| 4747 | } |
| 4748 | |
| 4749 | if (((d->typ = rnd_otyp_by_namedesc(d->actualn, d->oclass, 1)) |
| 4750 | != STRANGE_OBJECT) |
| 4751 | || (d->dn != d->actualn |
| 4752 | && ((d->typ = rnd_otyp_by_namedesc(d->dn, d->oclass, 1)) |
| 4753 | != STRANGE_OBJECT)) |
| 4754 | || ((d->typ = rnd_otyp_by_namedesc(d->un, d->oclass, 1)) |
| 4755 | != STRANGE_OBJECT) |
| 4756 | || (d->origbp != d->actualn |
| 4757 | && ((d->typ = rnd_otyp_by_namedesc(d->origbp, d->oclass, 1)) |
| 4758 | != STRANGE_OBJECT))) |
| 4759 | return 2; /*goto typfnd;*/ |
| 4760 | d->typ = 0; |
| 4761 | |
| 4762 | if (d->actualn) { |
| 4763 | const struct Jitem *j = Japanese_items; |
| 4764 | |
| 4765 | while (j->item) { |
| 4766 | if (!strcmpi(d->actualn, j->name)) { |
| 4767 | d->typ = j->item; |
| 4768 | return 2; /*goto typfnd;*/ |
| 4769 | } |
| 4770 | j++; |
| 4771 | } |
| 4772 | } |
| 4773 | /* if we've stripped off "armor" and failed to match anything |
| 4774 | in objects[], append "mail" and try again to catch misnamed |
| 4775 | requests like "plate armor" and "yellow dragon scale armor" */ |
| 4776 | if (d->oclass == ARMOR_CLASS && !strstri(d->bp, "mail")) { |
| 4777 | /* modifying bp's string is ok; we're about to resort |
| 4778 | to random armor if this also fails to match anything */ |
| 4779 | Strcat(d->bp, " mail"); |
| 4780 | return 6; /*goto retry;*/ |
| 4781 | } |
| 4782 | if (!strcmpi(d->bp, "spinach")) { |
| 4783 | d->contents = TIN_SPINACH; |
no test coverage detected