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

Function placebc_core

src/ball.c:119–144  ·  view source on GitHub ↗

* Place the ball & chain under the hero. Make sure that the ball & chain * variables are set (actually only needed when blind, but what the heck). * It is assumed that when this is called, the ball and chain are NOT * attached to the object list. * * Should not be called while swallowed except on waterlevel. */

Source from the content-addressed store, hash-verified

117 * Should not be called while swallowed except on waterlevel.
118 */
119staticfn void
120placebc_core(void)
121{
122 if (!uchain || !uball) {
123 impossible("Where are your ball and chain?");
124 return;
125 }
126
127 (void) flooreffects(uchain, u.ux, u.uy, ""); /* chain might rust */
128
129 if (carried(uball)) { /* the ball is carried */
130 u.bc_order = BCPOS_DIFFER;
131 } else {
132 /* ball might rust -- already checked when carried */
133 (void) flooreffects(uball, u.ux, u.uy, "");
134 place_object(uball, u.ux, u.uy);
135 u.bc_order = BCPOS_CHAIN;
136 }
137
138 place_object(uchain, u.ux, u.uy);
139
140 u.bglyph = u.cglyph = levl[u.ux][u.uy].glyph; /* pick up glyph */
141
142 newsym(u.ux, u.uy);
143 bcrestriction = 0;
144}
145
146staticfn void
147unplacebc_core(void)

Callers 4

placebcFunction · 0.85
lift_covet_and_placebcFunction · 0.85
PlacebcFunction · 0.85
Lift_covet_and_placebcFunction · 0.85

Calls 4

flooreffectsFunction · 0.85
place_objectFunction · 0.85
newsymFunction · 0.85
impossibleFunction · 0.70

Tested by

no test coverage detected