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

Function hitfloor

src/dothrow.c:605–647  ·  view source on GitHub ↗

Object hits floor at hero's feet. Called from drop(), throwit(), hold_another_object(), litter(). */

Source from the content-addressed store, hash-verified

603/* Object hits floor at hero's feet.
604 Called from drop(), throwit(), hold_another_object(), litter(). */
605void
606hitfloor(
607 struct obj *obj,
608 boolean verbosely) /* usually True; False if caller has given drop mesg */
609{
610 if (IS_SOFT(levl[u.ux][u.uy].typ) || u.uinwater || u.uswallow) {
611 dropy(obj);
612 return;
613 }
614 if (IS_ALTAR(levl[u.ux][u.uy].typ)) {
615 doaltarobj(obj);
616 } else if (verbosely) {
617 const char *verb = (obj->otyp == WAN_STRIKING) ? "strike" : "hit";
618 const char *surf = surface(u.ux, u.uy);
619 struct trap *t = t_at(u.ux, u.uy);
620
621 /* describe something that might keep the object where it is
622 or precede next message stating that it falls */
623 if (t && t->tseen) {
624 switch (t->ttyp) {
625 case TRAPDOOR:
626 surf = "trap door";
627 break;
628 case HOLE:
629 surf = "edge of the hole";
630 break;
631 case PIT:
632 case SPIKED_PIT:
633 surf = "edge of the pit";
634 break;
635 default:
636 break;
637 }
638 }
639 pline("%s %s the %s.", Doname2(obj), otense(obj, verb), surf);
640 }
641
642 if (hero_breaks(obj, u.ux, u.uy, BRK_FROM_INV))
643 return;
644 if (ship_object(obj, u.ux, u.uy, FALSE))
645 return;
646 dropz(obj, TRUE);
647}
648
649/*
650 * Walk a path from src_cc to dest_cc, calling a proc for each location

Callers 8

litterFunction · 0.85
dropFunction · 0.85
retouch_objectFunction · 0.85
toss_upFunction · 0.85
throwitFunction · 0.85
hold_another_objectFunction · 0.85
tipcontainerFunction · 0.85
hornoplentyFunction · 0.85

Calls 10

dropyFunction · 0.85
doaltarobjFunction · 0.85
surfaceFunction · 0.85
t_atFunction · 0.85
Doname2Function · 0.85
otenseFunction · 0.85
hero_breaksFunction · 0.85
ship_objectFunction · 0.85
dropzFunction · 0.85
plineFunction · 0.70

Tested by

no test coverage detected