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

Function mk_tt_object

src/mkobj.c:2226–2248  ·  view source on GitHub ↗

make an object named after someone listed in the scoreboard file; never returns Null */

Source from the content-addressed store, hash-verified

2224/* make an object named after someone listed in the scoreboard file;
2225 never returns Null */
2226struct obj *
2227mk_tt_object(
2228 int objtype, /* CORPSE or STATUE */
2229 coordxy x, coordxy y)
2230{
2231 struct obj *otmp;
2232 boolean initialize_it;
2233
2234 /* player statues never contain books */
2235 initialize_it = (objtype != STATUE);
2236 otmp = mksobj_at(objtype, x, y, initialize_it, FALSE);
2237
2238 /* tt_oname() will return null if the scoreboard is empty, which in
2239 turn leaves the random corpsenm value; force it to match a player */
2240 if (!tt_oname(otmp)) {
2241 int pm = rn1(PM_WIZARD - PM_ARCHEOLOGIST + 1, PM_ARCHEOLOGIST);
2242
2243 /* update weight for either, force timer sanity for corpses */
2244 set_corpsenm(otmp, pm);
2245 }
2246
2247 return otmp;
2248}
2249
2250/* make a new corpse or statue, uninitialized if a statue (i.e. no books);
2251 never returns Null */

Callers 3

fill_zooFunction · 0.85
dig_up_graveFunction · 0.85
fixup_specialFunction · 0.85

Calls 3

mksobj_atFunction · 0.85
tt_onameFunction · 0.85
set_corpsenmFunction · 0.85

Tested by

no test coverage detected