| 451 | } |
| 452 | |
| 453 | void |
| 454 | discover_object( |
| 455 | int oindx, /* type of object */ |
| 456 | boolean mark_as_known, /* discover the type */ |
| 457 | boolean mark_as_encountered, /* mark the type as having been seen/felt */ |
| 458 | boolean credit_hero) /* exercise wisdom */ |
| 459 | { |
| 460 | if (oindx < FIRST_OBJECT) /* don't discover generic objects */ |
| 461 | return; |
| 462 | |
| 463 | if ((!objects[oindx].oc_name_known && mark_as_known) |
| 464 | || (!objects[oindx].oc_encountered && mark_as_encountered) |
| 465 | || (Role_if(PM_SAMURAI) |
| 466 | && Japanese_item_name(oindx, (const char *) 0))) { |
| 467 | int dindx, acls = objects[oindx].oc_class; |
| 468 | |
| 469 | /* Loop thru disco[] 'til we find the target (which may have been |
| 470 | uname'd) or the next open slot; one or the other will be found |
| 471 | before we reach the next class... */ |
| 472 | for (dindx = svb.bases[acls]; svd.disco[dindx] != 0; dindx++) |
| 473 | if (svd.disco[dindx] == oindx) |
| 474 | break; |
| 475 | svd.disco[dindx] = oindx; |
| 476 | |
| 477 | if (mark_as_encountered) |
| 478 | objects[oindx].oc_encountered = 1; |
| 479 | |
| 480 | if (!objects[oindx].oc_name_known && mark_as_known) { |
| 481 | objects[oindx].oc_name_known = 1; |
| 482 | if (credit_hero) |
| 483 | exercise(A_WIS, TRUE); |
| 484 | |
| 485 | /* !in_moveloop => initial inventory, |
| 486 | gameover => final disclosure */ |
| 487 | if (program_state.in_moveloop && !program_state.gameover) { |
| 488 | if (objects[oindx].oc_class == GEM_CLASS) |
| 489 | gem_learned(oindx); /* could affect price of unpaid gems */ |
| 490 | update_inventory(); |
| 491 | } |
| 492 | } |
| 493 | } |
| 494 | } |
| 495 | |
| 496 | /* if a class name has been cleared, we may need to purge it from disco[] */ |
| 497 | void |
no test coverage detected