set artifact tracking flags; calling sequence: oname() -> artifact_exists() -> artifact_origin() or mksobj(),others -> mk_artifact() -> artifact_origin(random) possibly followed by mksobj(),others -> artifact_origin(non-random origin) */
| 475 | mksobj(),others -> mk_artifact() -> artifact_origin(random) possibly |
| 476 | followed by mksobj(),others -> artifact_origin(non-random origin) */ |
| 477 | void |
| 478 | artifact_origin( |
| 479 | struct obj *arti, /* new artifact */ |
| 480 | unsigned aflags) /* ONAME_xxx flags, shared by artifact_exists() */ |
| 481 | { |
| 482 | int ct, a = arti->oartifact; |
| 483 | |
| 484 | if (a) { |
| 485 | /* start by clearing all bits; most are mutually exclusive */ |
| 486 | artiexist[a] = zero_artiexist; |
| 487 | /* set 'exists' bit back on; not specified via flag bit in aflags */ |
| 488 | artiexist[a].exists = 1; |
| 489 | /* 'hero knows it exists' is expected for wish, gift, viadip, or |
| 490 | named and could eventually become set for any of the others */ |
| 491 | if ((aflags & ONAME_KNOW_ARTI) != 0) |
| 492 | artiexist[a].found = 1; |
| 493 | /* should be exactly one of wish, gift, via_dip, via_naming, |
| 494 | level_def (quest), bones, and random (floor or monst's minvent) */ |
| 495 | ct = 0; |
| 496 | if ((aflags & ONAME_WISH) != 0) |
| 497 | artiexist[a].wish = 1, ++ct; |
| 498 | if ((aflags & ONAME_GIFT) != 0) |
| 499 | artiexist[a].gift = 1, ++ct; |
| 500 | if ((aflags & ONAME_VIA_DIP) != 0) |
| 501 | artiexist[a].viadip = 1, ++ct; |
| 502 | if ((aflags & ONAME_VIA_NAMING) != 0) |
| 503 | artiexist[a].named = 1, ++ct; |
| 504 | if ((aflags & ONAME_LEVEL_DEF) != 0) |
| 505 | artiexist[a].lvldef = 1, ++ct; |
| 506 | if ((aflags & ONAME_BONES) != 0) |
| 507 | artiexist[a].bones = 1, ++ct; |
| 508 | if ((aflags & ONAME_RANDOM) != 0) |
| 509 | artiexist[a].rndm = 1, ++ct; |
| 510 | if (ct != 1) |
| 511 | impossible("invalid artifact origin: %4o", aflags); |
| 512 | } |
| 513 | } |
| 514 | |
| 515 | boolean |
| 516 | spec_ability(struct obj *otmp, unsigned long abil) |
no test coverage detected