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

Function keep_saddle_with_steedcorpse

src/trap.c:938–967  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936}
937
938staticfn boolean
939keep_saddle_with_steedcorpse(
940 unsigned steed_mid,
941 struct obj *objchn,
942 struct obj *saddle)
943{
944 if (!saddle)
945 return FALSE;
946 while (objchn) {
947 if (objchn->otyp == CORPSE && has_omonst(objchn)) {
948 struct monst *mtmp = OMONST(objchn);
949
950 if (mtmp->m_id == steed_mid) {
951 /* move saddle */
952 coordxy x, y;
953 if (get_obj_location(objchn, &x, &y, 0)) {
954 obj_extract_self(saddle);
955 place_object(saddle, x, y);
956 stackobj(saddle);
957 }
958 return TRUE;
959 }
960 }
961 if (Has_contents(objchn)
962 && keep_saddle_with_steedcorpse(steed_mid, objchn->cobj, saddle))
963 return TRUE;
964 objchn = objchn->nobj;
965 }
966 return FALSE;
967}
968
969/* monster or you go through and possibly destroy a web.
970 return TRUE if could go through. */

Callers 1

trapeffect_landmineFunction · 0.85

Calls 4

get_obj_locationFunction · 0.85
obj_extract_selfFunction · 0.85
place_objectFunction · 0.85
stackobjFunction · 0.85

Tested by

no test coverage detected