* Returns the full name (with articles and correct capitalization) of an * artifact named "name" if one exists, or NULL, it not. * The given name must be rather close to the real name for it to match. * The object type of the artifact is returned in otyp if the return value * is non-NULL. */
| 326 | * is non-NULL. |
| 327 | */ |
| 328 | const char * |
| 329 | artifact_name( |
| 330 | const char *name, /* string from player that might be an artifact name */ |
| 331 | short *otyp_p, /* secondary output */ |
| 332 | boolean fuzzy) /* whether to allow extra or omitted spaces or dashes */ |
| 333 | { |
| 334 | const struct artifact *a; |
| 335 | const char *aname; |
| 336 | |
| 337 | if (!strncmpi(name, "the ", 4)) |
| 338 | name += 4; |
| 339 | |
| 340 | for (a = artilist + 1; a->otyp; a++) { |
| 341 | aname = a->name; |
| 342 | if (!strncmpi(aname, "the ", 4)) |
| 343 | aname += 4; |
| 344 | if (!fuzzy ? !strcmpi(name, aname) |
| 345 | : fuzzymatch(name, aname, " -", TRUE)) { |
| 346 | if (otyp_p) |
| 347 | *otyp_p = a->otyp; |
| 348 | return a->name; |
| 349 | } |
| 350 | } |
| 351 | |
| 352 | return (char *) 0; |
| 353 | } |
| 354 | |
| 355 | boolean |
| 356 | exist_artifact(int otyp, const char *name) |
no test coverage detected