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

Function recreate_pile_at

src/mkobj.c:2370–2389  ·  view source on GitHub ↗

tear down the object pile at and create it again, so that any boulders which are present get forced to the top */

Source from the content-addressed store, hash-verified

2368/* tear down the object pile at <x,y> and create it again, so that any
2369 boulders which are present get forced to the top */
2370void
2371recreate_pile_at(coordxy x, coordxy y)
2372{
2373 struct obj *otmp, *next_obj, *reversed = 0;
2374
2375 /* remove all objects at <x,y>, saving a reversed temporary list */
2376 for (otmp = svl.level.objects[x][y]; otmp; otmp = next_obj) {
2377 next_obj = otmp->nexthere;
2378 remove_object(otmp); /* obj_extract_self() for floor */
2379 otmp->nobj = reversed;
2380 reversed = otmp;
2381 }
2382 /* pile at <tx,ty> is now empty; create new one, re-reversing to restore
2383 original order; place_object() handles making boulders be on top */
2384 for (otmp = reversed; otmp; otmp = next_obj) {
2385 next_obj = otmp->nobj;
2386 otmp->nobj = 0; /* obj->where is OBJ_FREE */
2387 place_object(otmp, x, y);
2388 }
2389}
2390
2391#define ROT_ICE_ADJUSTMENT 2 /* rotting on ice takes 2 times as long */
2392

Callers 1

bhitpileFunction · 0.85

Calls 2

remove_objectFunction · 0.85
place_objectFunction · 0.85

Tested by

no test coverage detected