MCPcopy Index your code
hub / github.com/NetHack/NetHack / undiscover_object

Function undiscover_object

src/o_init.c:497–523  ·  view source on GitHub ↗

if a class name has been cleared, we may need to purge it from disco[] */

Source from the content-addressed store, hash-verified

495
496/* if a class name has been cleared, we may need to purge it from disco[] */
497void
498undiscover_object(int oindx)
499{
500 if (!objects[oindx].oc_name_known && !objects[oindx].oc_encountered) {
501 int dindx, acls = objects[oindx].oc_class;
502 boolean found = FALSE;
503
504 /* find the object; shift those behind it forward one slot */
505 for (dindx = svb.bases[acls];
506 dindx < NUM_OBJECTS && svd.disco[dindx] != 0
507 && objects[dindx].oc_class == acls;
508 dindx++)
509 if (found)
510 svd.disco[dindx - 1] = svd.disco[dindx];
511 else if (svd.disco[dindx] == oindx)
512 found = TRUE;
513
514 /* clear last slot */
515 if (found)
516 svd.disco[dindx - 1] = 0;
517 else
518 impossible("named object not in disco");
519
520 if (objects[oindx].oc_class == GEM_CLASS)
521 gem_learned(oindx); /* ok, it's actually been unlearned */
522 }
523}
524
525boolean
526interesting_to_discover(int i)

Callers 1

docallFunction · 0.85

Calls 2

gem_learnedFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected