MCPcopy Create free account
hub / github.com/NetHack/NetHack / racial_exception

Function racial_exception

src/worn.c:1359–1373  ·  view source on GitHub ↗

* Exceptions to things based on race. * Correctly checks polymorphed player race. * Returns: * 0 No exception, normal rules apply. * 1 If the race/object combination is acceptable. * -1 If the race/object combination is unacceptable. */

Source from the content-addressed store, hash-verified

1357 * -1 If the race/object combination is unacceptable.
1358 */
1359int
1360racial_exception(struct monst *mon, struct obj *obj)
1361{
1362 const struct permonst *ptr = raceptr(mon);
1363
1364 /* Acceptable Exceptions: */
1365 /* Allow hobbits to wear elven armor - LoTR */
1366 if (ptr == &mons[PM_HOBBIT] && is_elven_armor(obj))
1367 return 1;
1368 /* Unacceptable Exceptions: */
1369 /* Checks for object that certain races should never use go here */
1370 /* return -1; */
1371
1372 return 0;
1373}
1374
1375/* Remove an object from a monster's inventory. */
1376void

Callers 3

canwearobjFunction · 0.85
m_dowear_typeFunction · 0.85
break_armorFunction · 0.85

Calls 1

raceptrFunction · 0.85

Tested by

no test coverage detected