More long worm checks when splitting
When a long worm is split into two, perform more checks placing the segments on the map.
This commit is contained in:
19
src/worm.c
19
src/worm.c
@@ -415,7 +415,7 @@ struct obj *weap;
|
||||
wgrowtime[new_wnum] = 0L; /* trying to call initworm(). */
|
||||
|
||||
/* Place the new monster at all the segment locations. */
|
||||
place_wsegs(new_worm);
|
||||
place_wsegs(new_worm, worm);
|
||||
|
||||
if (context.mon_moving)
|
||||
pline("%s is cut in half.", Monnam(worm));
|
||||
@@ -556,17 +556,28 @@ int fd;
|
||||
* place_wsegs()
|
||||
*
|
||||
* Place the segments of the given worm. Called from restore.c
|
||||
* If oldworm is not NULL, assumes the oldworm segments are on map
|
||||
* in the same location as worm segments
|
||||
*/
|
||||
void
|
||||
place_wsegs(worm)
|
||||
struct monst *worm;
|
||||
place_wsegs(worm, oldworm)
|
||||
struct monst *worm, *oldworm;
|
||||
{
|
||||
struct wseg *curr = wtails[worm->wormno];
|
||||
|
||||
/* if (!mtmp->wormno) return; bullet proofing */
|
||||
|
||||
while (curr != wheads[worm->wormno]) {
|
||||
place_worm_seg(worm, curr->wx, curr->wy);
|
||||
xchar x = curr->wx;
|
||||
xchar y = curr->wy;
|
||||
|
||||
if (oldworm) {
|
||||
if (m_at(x,y) == oldworm)
|
||||
remove_monster(x, y);
|
||||
else
|
||||
impossible("placing worm seg <%i,%i> over another mon", x, y);
|
||||
}
|
||||
place_worm_seg(worm, x, y);
|
||||
curr = curr->nseg;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user