U979 followup - mimic mimicking a boulder on Sokobon hole

The previous change only affected mimics that started mimicing after the
level was created.  This change tries to perform a similar behavior for
randomly placed mimics that are forced to mimic a boulder on special levels.
In this case, since the symbol is fixed and the location is "random", try
several times to find a non-trap location for such a mimic.
This commit is contained in:
cohrs
2004-05-25 18:20:35 +00:00
parent e54760e29d
commit 1616f26ce8

View File

@@ -860,6 +860,23 @@ struct mkroom *croom;
} else {
mtmp->m_ap_type = M_AP_OBJECT;
mtmp->mappearance = i;
/* try to avoid placing mimic boulder on a trap */
if (i == BOULDER && m->x < 0 && t_at(x, y)) {
int k;
for (k = 0; k < 10 && t_at(x, y); ++k) {
x = m->x;
y = m->y;
if (croom)
get_room_loc(&x, &y, croom);
else {
get_location(&x, &y, DRY);
}
if (MON_AT(x,y) && enexto(&cc, x, y, pm))
x = cc.x, y = cc.y;
}
place_monster(mtmp, x, y);
}
}
break;