if an artifact hasn't already been designated 'found', do that now and generate a livelog event about finding it */
| 419 | /* if an artifact hasn't already been designated 'found', do that now |
| 420 | and generate a livelog event about finding it */ |
| 421 | void |
| 422 | find_artifact(struct obj *otmp) |
| 423 | { |
| 424 | int a = otmp->oartifact; |
| 425 | |
| 426 | if (a && !artiexist[a].found) { |
| 427 | const char *where; |
| 428 | |
| 429 | found_artifact(a); /* artiexist[a].found = 1 */ |
| 430 | /* |
| 431 | * Unlike costly_spot(), inside_shop() includes the "free spot" |
| 432 | * in front of the door. And it doesn't care whether or not |
| 433 | * there is a shopkeeper present. |
| 434 | * |
| 435 | * If hero sees a monster pick up a not-yet-found artifact, it |
| 436 | * will have its dknown flag set even if far away and will be |
| 437 | * described as 'found on the floor'. Similarly for dropping |
| 438 | * (possibly upon monster's death), dknown will be set and the |
| 439 | * artifact will be described as 'carried by a monster'. |
| 440 | * That's handled by caller: dog_invent(), mpickstuff(), or |
| 441 | * mdrop_obj() so that we get called before obj->where changes. |
| 442 | */ |
| 443 | where = ((otmp->where == OBJ_FLOOR) |
| 444 | ? ((inside_shop(otmp->ox, otmp->oy) != NO_ROOM) |
| 445 | ? " in a shop" |
| 446 | : " on the floor") |
| 447 | /* artifacts aren't created in containers but could be |
| 448 | inside one if it comes from a bones level */ |
| 449 | : (otmp->where == OBJ_CONTAINED) ? " in a container" |
| 450 | /* perhaps probing, or seeing monster wield artifact */ |
| 451 | : (otmp->where == OBJ_MINVENT) ? " carried by a monster" |
| 452 | /* catchall: probably in inventory, picked up while |
| 453 | blind but now seen; there's no previous_where to |
| 454 | figure out how it got here */ |
| 455 | : ""); |
| 456 | livelog_printf(LL_ARTIFACT, "found %s%s", |
| 457 | bare_artifactname(otmp), where); |
| 458 | } |
| 459 | } |
| 460 | |
| 461 | int |
| 462 | nartifact_exist(void) |
no test coverage detected