return 1 if d->bp is empty or contains only various qualifiers like "blessed", "rustproof", and so on, or 0 if anything else is present */
| 3963 | /* return 1 if d->bp is empty or contains only various qualifiers like |
| 3964 | "blessed", "rustproof", and so on, or 0 if anything else is present */ |
| 3965 | staticfn int |
| 3966 | readobjnam_preparse(struct _readobjnam_data *d) |
| 3967 | { |
| 3968 | char *save_bp = 0; |
| 3969 | int more_l = 0, res = 1; |
| 3970 | |
| 3971 | for (;;) { |
| 3972 | int l; |
| 3973 | |
| 3974 | if (!d->bp || !*d->bp) |
| 3975 | break; |
| 3976 | res = 0; |
| 3977 | |
| 3978 | if (!strncmpi(d->bp, "an ", l = 3) || !strncmpi(d->bp, "a ", l = 2)) { |
| 3979 | d->cnt = 1; |
| 3980 | } else if (!strncmpi(d->bp, "the ", l = 4)) { |
| 3981 | ; /* just increment `bp' by `l' below */ |
| 3982 | } else if (!d->cnt && digit(*d->bp) && strcmp(d->bp, "0")) { |
| 3983 | d->cnt = atoi(d->bp); |
| 3984 | while (digit(*d->bp)) |
| 3985 | d->bp++; |
| 3986 | while (*d->bp == ' ') |
| 3987 | d->bp++; |
| 3988 | l = 0; |
| 3989 | } else if (*d->bp == '+' || *d->bp == '-') { |
| 3990 | d->spesgn = (*d->bp++ == '+') ? 1 : -1; |
| 3991 | d->spe = atoi(d->bp); |
| 3992 | while (digit(*d->bp)) |
| 3993 | d->bp++; |
| 3994 | while (*d->bp == ' ') |
| 3995 | d->bp++; |
| 3996 | l = 0; |
| 3997 | } else if (!strncmpi(d->bp, "blessed ", l = 8) |
| 3998 | || !strncmpi(d->bp, "holy ", l = 5)) { |
| 3999 | d->blessed = 1, d->uncursed = d->iscursed = 0; |
| 4000 | } else if (!strncmpi(d->bp, "cursed ", l = 7) |
| 4001 | || !strncmpi(d->bp, "unholy ", l = 7)) { |
| 4002 | d->iscursed = 1, d->blessed = d->uncursed = 0; |
| 4003 | } else if (!strncmpi(d->bp, "uncursed ", l = 9)) { |
| 4004 | d->uncursed = 1, d->blessed = d->iscursed = 0; |
| 4005 | } else if (!strncmpi(d->bp, "rustproof ", l = 10) |
| 4006 | || !strncmpi(d->bp, "erodeproof ", l = 11) |
| 4007 | || !strncmpi(d->bp, "corrodeproof ", l = 13) |
| 4008 | || !strncmpi(d->bp, "fixed ", l = 6) |
| 4009 | || !strncmpi(d->bp, "fireproof ", l = 10) |
| 4010 | || !strncmpi(d->bp, "rotproof ", l = 9) |
| 4011 | || !strncmpi(d->bp, "tempered ", l = 9) |
| 4012 | || !strncmpi(d->bp, "crackproof ", l = 11)) { |
| 4013 | d->erodeproof = 1; |
| 4014 | } else if (!strncmpi(d->bp, "lit ", l = 4) |
| 4015 | || !strncmpi(d->bp, "burning ", l = 8)) { |
| 4016 | d->islit = 1; |
| 4017 | } else if (!strncmpi(d->bp, "unlit ", l = 6) |
| 4018 | || !strncmpi(d->bp, "extinguished ", l = 13)) { |
| 4019 | d->islit = 0; |
| 4020 | |
| 4021 | /* "wet" and "moist" are only applicable for towels */ |
| 4022 | } else if (!strncmpi(d->bp, "moist ", l = 6) |