From 1616f26ce81da2856b75a241906c412331d18aaa Mon Sep 17 00:00:00 2001 From: cohrs Date: Tue, 25 May 2004 18:20:35 +0000 Subject: [PATCH] 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. --- src/sp_lev.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/sp_lev.c b/src/sp_lev.c index f0fe4c94c..ba545952a 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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;