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

Function pickup_prinv

src/pickup.c:1947–1972  ·  view source on GitHub ↗

pickup_object()/out_container() helper; print an added-to-invent message for current object, limiting feedback about encumbrance to the first item which causes that to change */

Source from the content-addressed store, hash-verified

1945 print an added-to-invent message for current object, limiting feedback
1946 about encumbrance to the first item which causes that to change */
1947staticfn void
1948pickup_prinv(
1949 struct obj *obj,
1950 long count,
1951 const char *verb)
1952{
1953 char pbuf[QBUFSZ];
1954 const char *prefix;
1955 int nearload = near_capacity();
1956
1957 pbuf[0] = '\0';
1958 if (nearload == gp.pickup_encumbrance) {
1959 prefix = (char *) 0;
1960 } else {
1961 prefix = (nearload >= EXT_ENCUMBER) ? overloadpfx
1962 : (nearload >= HVY_ENCUMBER) ? nearloadpfx
1963 : (nearload >= MOD_ENCUMBER) ? moderateloadpfx
1964 : (nearload >= SLT_ENCUMBER) ? slightloadpfx
1965 : (char *) 0;
1966 gp.pickup_encumbrance = nearload;
1967 }
1968 if (prefix)
1969 Sprintf(pbuf, "%s %s", prefix, verb);
1970
1971 prinv(pbuf, obj, count);
1972}
1973
1974/*
1975 * prints a message if encumbrance changed since the last check

Callers 2

pickup_objectFunction · 0.85
out_containerFunction · 0.85

Calls 2

near_capacityFunction · 0.85
prinvFunction · 0.85

Tested by

no test coverage detected