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:
@@ -2835,7 +2835,7 @@ E void FDECL(see_wsegs, (struct monst *));
|
||||
E void FDECL(detect_wsegs, (struct monst *, BOOLEAN_P));
|
||||
E void FDECL(save_worm, (int, int));
|
||||
E void FDECL(rest_worm, (int));
|
||||
E void FDECL(place_wsegs, (struct monst *));
|
||||
E void FDECL(place_wsegs, (struct monst *, struct monst *));
|
||||
E void FDECL(sanity_check_worm, (struct monst *));
|
||||
E void FDECL(remove_worm, (struct monst *));
|
||||
E void FDECL(place_worm_tail_randomly, (struct monst *, XCHAR_P, XCHAR_P));
|
||||
|
||||
@@ -1587,7 +1587,7 @@ struct monst *mtmp, *mtmp2;
|
||||
if (mtmp != u.usteed) /* don't place steed onto the map */
|
||||
place_monster(mtmp2, mtmp2->mx, mtmp2->my);
|
||||
if (mtmp2->wormno) /* update level.monsters[wseg->wx][wseg->wy] */
|
||||
place_wsegs(mtmp2); /* locations to mtmp2 not mtmp. */
|
||||
place_wsegs(mtmp2, NULL); /* locations to mtmp2 not mtmp. */
|
||||
if (emits_light(mtmp2->data)) {
|
||||
/* since this is so rare, we don't have any `mon_move_light_source' */
|
||||
new_light_source(mtmp2->mx, mtmp2->my, emits_light(mtmp2->data),
|
||||
|
||||
@@ -1080,7 +1080,7 @@ boolean ghostly;
|
||||
set_residency(mtmp, FALSE);
|
||||
place_monster(mtmp, mtmp->mx, mtmp->my);
|
||||
if (mtmp->wormno)
|
||||
place_wsegs(mtmp);
|
||||
place_wsegs(mtmp, NULL);
|
||||
|
||||
/* regenerate monsters while on another level */
|
||||
if (!u.uz.dlevel)
|
||||
|
||||
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