Explicitly remove long worm segments from the map

When a long worm was removed from the map, the segments for that worm
retained their map location info. This caused problems later on if
wormgone (or toss_wsegs) was called, because it would try to remove the
segments of that worm from the map.
This commit is contained in:
Pasi Kallinen
2018-11-19 21:54:32 +02:00
parent 2a439af336
commit b0428321b8

View File

@@ -596,10 +596,12 @@ struct monst *worm;
curr = wtails[worm->wormno];
while (curr != wheads[worm->wormno]) {
if (!isok(curr->wx, curr->wy))
panic("worm seg not isok");
if (level.monsters[curr->wx][curr->wy] != worm)
panic("worm not at seg location");
if (curr->wx) {
if (!isok(curr->wx, curr->wy))
panic("worm seg not isok");
if (level.monsters[curr->wx][curr->wy] != worm)
panic("worm not at seg location");
}
curr = curr->nseg;
}
}
@@ -621,8 +623,11 @@ register struct monst *worm;
/* if (!mtmp->wormno) return; bullet proofing */
while (curr) {
remove_monster(curr->wx, curr->wy);
newsym(curr->wx, curr->wy);
if (curr->wx) {
remove_monster(curr->wx, curr->wy);
newsym(curr->wx, curr->wy);
curr->wx = 0;
}
curr = curr->nseg;
}
}