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

Function check_glob

src/mkobj.c:3419–3443  ·  view source on GitHub ↗

called when 'obj->globby' is set so we don't recheck it here */

Source from the content-addressed store, hash-verified

3417
3418/* called when 'obj->globby' is set so we don't recheck it here */
3419staticfn void
3420check_glob(struct obj *obj, const char *mesg)
3421{
3422#define LOWEST_GLOB GLOB_OF_GRAY_OOZE
3423#define HIGHEST_GLOB GLOB_OF_BLACK_PUDDING
3424 if (obj->quan != 1L || obj->owt == 0
3425 || obj->otyp < LOWEST_GLOB || obj->otyp > HIGHEST_GLOB
3426#if 0 /*
3427 * This was relevant before the shrink_glob timer was adopted but
3428 * now any glob could have a weight that isn't a multiple of 20.
3429 */
3430 /* a partially eaten glob could have any non-zero weight but an
3431 intact one should weigh an exact multiple of base weight (20) */
3432 || ((obj->owt % objects[obj->otyp].oc_weight) != 0 && !obj->oeaten)
3433#endif
3434 ) {
3435 char mesgbuf[BUFSZ], globbuf[QBUFSZ];
3436
3437 Sprintf(globbuf, " glob %d,quan=%ld,owt=%u ",
3438 obj->otyp, obj->quan, obj->owt);
3439 mesg = strsubst(strcpy(mesgbuf, mesg), " obj ", globbuf);
3440 insane_object(obj, ofmt0, mesg,
3441 (obj->where == OBJ_MINVENT) ? obj->ocarry : 0);
3442 }
3443}
3444
3445/* check an object in hero's or monster's inventory which has worn mask set */
3446staticfn void

Callers 4

shrink_globFunction · 0.85
objlist_sanityFunction · 0.85
mon_obj_sanityFunction · 0.85
check_containedFunction · 0.85

Calls 2

strsubstFunction · 0.85
insane_objectFunction · 0.85

Tested by

no test coverage detected