| 3134 | } |
| 3135 | |
| 3136 | staticfn boolean |
| 3137 | create_particular_parse( |
| 3138 | char *str, |
| 3139 | struct _create_particular_data *d) |
| 3140 | { |
| 3141 | int gender_name_var = NEUTRAL; |
| 3142 | char *bufp = str; |
| 3143 | char *tmpp; |
| 3144 | |
| 3145 | d->quan = 1 + ((gm.multi > 0) ? (int) gm.multi : 0); |
| 3146 | d->monclass = MAXMCLASSES; |
| 3147 | d->which = gu.urole.mnum; /* an arbitrary index into mons[] */ |
| 3148 | d->fem = -1; /* gender not specified */ |
| 3149 | d->genderconf = -1; /* no confusion on which gender to assign */ |
| 3150 | d->randmonst = FALSE; |
| 3151 | d->maketame = d->makepeaceful = d->makehostile = FALSE; |
| 3152 | d->sleeping = d->saddled = d->invisible = d->hidden = FALSE; |
| 3153 | |
| 3154 | /* quantity */ |
| 3155 | if (digit(*bufp)) { |
| 3156 | d->quan = atoi(bufp); |
| 3157 | while (digit(*bufp)) |
| 3158 | bufp++; |
| 3159 | while (*bufp == ' ') |
| 3160 | bufp++; |
| 3161 | } |
| 3162 | #define QUAN_LIMIT (ROWNO * (COLNO - 1)) |
| 3163 | /* maximum possible quantity is one per cell: (0..ROWNO-1) x (1..COLNO-1) |
| 3164 | [21*79==1659 for default map size; could subtract 1 for hero's spot] */ |
| 3165 | if (d->quan < 1 || d->quan > QUAN_LIMIT) |
| 3166 | d->quan = QUAN_LIMIT - monster_census(FALSE); |
| 3167 | #undef QUAN_LIMIT |
| 3168 | /* gear -- extremely limited number of possibilities supported */ |
| 3169 | if ((tmpp = strstri(bufp, "saddled ")) != 0) { |
| 3170 | d->saddled = TRUE; |
| 3171 | (void) memset(tmpp, ' ', sizeof "saddled " - 1); |
| 3172 | } |
| 3173 | /* state -- limited number of possibilities supported */ |
| 3174 | if ((tmpp = strstri(bufp, "sleeping ")) != 0) { |
| 3175 | d->sleeping = TRUE; |
| 3176 | (void) memset(tmpp, ' ', sizeof "sleeping " - 1); |
| 3177 | } |
| 3178 | if ((tmpp = strstri(bufp, "invisible ")) != 0) { |
| 3179 | d->invisible = TRUE; |
| 3180 | (void) memset(tmpp, ' ', sizeof "invisible " - 1); |
| 3181 | } |
| 3182 | if ((tmpp = strstri(bufp, "hidden ")) != 0) { |
| 3183 | d->hidden = TRUE; |
| 3184 | (void) memset(tmpp, ' ', sizeof "hidden " - 1); |
| 3185 | } |
| 3186 | /* check "female" before "male" to avoid false hit mid-word */ |
| 3187 | if ((tmpp = strstri(bufp, "female ")) != 0) { |
| 3188 | d->fem = 1; |
| 3189 | (void) memset(tmpp, ' ', sizeof "female " - 1); |
| 3190 | } |
| 3191 | if ((tmpp = strstri(bufp, "male ")) != 0) { |
| 3192 | d->fem = 0; |
| 3193 | (void) memset(tmpp, ' ', sizeof "male " - 1); |
no test coverage detected