Fix random attended shrines in irregular rooms

This commit is contained in:
Pasi Kallinen
2026-05-16 14:57:12 +03:00
parent a8f97a3926
commit 0f0e7c99bf
2 changed files with 11 additions and 0 deletions
+1
View File
@@ -24,6 +24,7 @@ obey statue type gender (gnome king statue in minetn-5)
fix statue and figurine genders in special levels in general fix statue and figurine genders in special levels in general
fix buffer overflow in update_topl when handling multiple items in a fix buffer overflow in update_topl when handling multiple items in a
container container
fix random attended shrines in irregular rooms
Platform- and/or Interface-Specific Fixes Platform- and/or Interface-Specific Fixes
+10
View File
@@ -573,6 +573,8 @@ mkswamp(void) /* Michiel Huisjes & Fred de Wilde */
} }
} }
/* return center of room, or a random free location
if center is blocked */
staticfn coord * staticfn coord *
shrine_pos(int roomno) shrine_pos(int roomno)
{ {
@@ -591,6 +593,14 @@ shrine_pos(int roomno)
buf.y = troom->ly + delta / 2; buf.y = troom->ly + delta / 2;
if ((delta % 2) && rn2(2)) if ((delta % 2) && rn2(2))
buf.y++; buf.y++;
/* irregular room or the location is blocked */
if (roomno != levl[buf.x][buf.y].roomno
|| (levl[buf.x][buf.y].typ != ROOM
&& levl[buf.x][buf.y].typ != ICE
&& levl[buf.x][buf.y].typ != CLOUD))
(void) somexyspace(troom, &buf);
return &buf; return &buf;
} }