@@ -1111,32 +1111,36 @@ static void L1RoomGen(int x, int y, int w, int h, bool dir)
11111111 ry = h / 2u + y - height / 2u ;
11121112 rx = x - width;
11131113 if (L1CheckVHall (x, ry - 1 , height + 2 )
1114- && L1CheckRoom (rx - 1 , ry - 1 , width + 1 , height + 2 )) // BUGFIX: swap args 3 and 4 ("height+2" and "width+1") (fixed)
1114+ && L1CheckRoom (rx - 1 , ry - 1 , width + 1 , height + 2 )) { // BUGFIX: swap args 3 and 4 ("height+2" and "width+1") (fixed)
1115+ // - add room to the left
1116+ L1DrawRoom (rx, ry, width, height);
11151117 break ;
1118+ }
11161119 }
1117- // - add room to the left
11181120 if (i != 0 ) {
1119- L1DrawRoom (rx, ry, width, height);
1121+ // room added to the left -> force similar room on the right side
11201122 i = 1 ;
11211123 } else {
1124+ // room was not added to the left -> try to more options on the right
11221125 rx = -1 ;
11231126 i = 20 ;
11241127 }
11251128 // try to place a room to the right
11261129 rxy2 = x + w;
11271130 while (true ) {
11281131 if (L1CheckVHall (rxy2 - 1 , ry - 1 , height + 2 )
1129- && L1CheckRoom (rxy2, ry - 1 , width + 1 , height + 2 ))
1132+ && L1CheckRoom (rxy2, ry - 1 , width + 1 , height + 2 )) {
1133+ // - add room to the right
1134+ L1DrawRoom (rxy2, ry, width, height);
11301135 break ;
1136+ }
11311137 if (--i == 0 )
11321138 break ;
11331139 width = RandRange (2 , 6 ) & ~1 ;
11341140 height = RandRange (2 , 6 ) & ~1 ;
11351141 ry = h / 2u + y - height / 2u ;
11361142 }
1137- // - add room to the right
11381143 if (i != 0 )
1139- L1DrawRoom (rxy2, ry, width, height);
11401144 // proceed with the placed a room on the left
11411145 if (rx >= 0 )
11421146 L1RoomGen (rx, ry, width, height, true );
@@ -1151,32 +1155,35 @@ static void L1RoomGen(int x, int y, int w, int h, bool dir)
11511155 rx = w / 2u + x - width / 2u ;
11521156 ry = y - height;
11531157 if (L1CheckHHall (y, rx - 1 , width + 2 )
1154- && L1CheckRoom (rx - 1 , ry - 1 , width + 2 , height + 1 ))
1158+ && L1CheckRoom (rx - 1 , ry - 1 , width + 2 , height + 1 )) {
1159+ // - add room to the top
1160+ L1DrawRoom (rx, ry, width, height);
11551161 break ;
1162+ }
11561163 }
1157- // - add room to the top
11581164 if (i != 0 ) {
1159- L1DrawRoom (rx, ry, width, height);
1165+ // room added to the top -> force similar room on the bottom side
11601166 i = 1 ;
11611167 } else {
1168+ // room was not added to the top -> try to more options on the bottom
11621169 ry = -1 ;
11631170 i = 20 ;
11641171 }
11651172 // try to place a room to the bottom
11661173 rxy2 = y + h;
11671174 while (true ) {
11681175 if (L1CheckHHall (rxy2 - 1 , rx - 1 , width + 2 )
1169- && L1CheckRoom (rx - 1 , rxy2, width + 2 , height + 1 ))
1176+ && L1CheckRoom (rx - 1 , rxy2, width + 2 , height + 1 )) {
1177+ // - add room to the bottom
1178+ L1DrawRoom (rx, rxy2, width, height);
11701179 break ;
1180+ }
11711181 if (--i == 0 )
11721182 break ;
11731183 width = RandRange (2 , 6 ) & ~1 ;
11741184 height = RandRange (2 , 6 ) & ~1 ;
11751185 rx = w / 2u + x - width / 2u ;
11761186 }
1177- // - add room to the bottom
1178- if (i != 0 )
1179- L1DrawRoom (rx, rxy2, width, height);
11801187 // proceed with the placed a room on the top
11811188 if (ry >= 0 )
11821189 L1RoomGen (rx, ry, width, height, false );
0 commit comments