UnNetHack SVN版rev.675を適用した。
Fix create_door() routine (from SporkHack rev. 655, 656)
create_door()ルーチンを修正(SporkHack rev. 655, 656から)
@@ -1282,43 +1282,43 @@ | ||
1282 | 1282 | dwall = 1 << rn2(4); |
1283 | 1283 | |
1284 | 1284 | dpos = dd->pos; |
1285 | - if (dpos == -1) /* The position is RANDOM */ | |
1286 | - dpos = rn2(((dwall & (W_WEST|W_EAST)) ? 2 : 1) ? | |
1287 | - (broom->hy - broom->ly + 1) : (broom->hx - broom->lx + 1)); | |
1288 | 1285 | |
1289 | 1286 | /* Convert wall and pos into an absolute coordinate! */ |
1290 | 1287 | wtry = rn2(4); |
1291 | - for (walltry = 0; walltry < 4; walltry++) { | |
1292 | - switch ((wtry+walltry) % 4) { | |
1288 | + switch (wtry) { | |
1293 | 1289 | case 0: |
1294 | - if (!(dwall & W_NORTH)) break; | |
1290 | + if (!(dwall & W_NORTH)) goto redoloop; | |
1295 | 1291 | y = broom->ly - 1; |
1296 | - x = broom->lx + dpos; | |
1292 | + x = broom->lx + ((dpos == -1) ? rn2(1+(broom->hx - broom->lx)) : dpos); | |
1293 | + if (IS_ROCK(levl[x][y-1].typ)) goto redoloop; | |
1297 | 1294 | goto outdirloop; |
1298 | 1295 | case 1: |
1299 | - if (!(dwall & W_SOUTH)) break; | |
1296 | + if (!(dwall & W_SOUTH)) goto redoloop; | |
1300 | 1297 | y = broom->hy + 1; |
1301 | - x = broom->lx + dpos; | |
1298 | + x = broom->lx + ((dpos == -1) ? rn2(1+(broom->hx - broom->lx)) : dpos); | |
1299 | + if (IS_ROCK(levl[x][y+1].typ)) goto redoloop; | |
1302 | 1300 | goto outdirloop; |
1303 | 1301 | case 2: |
1304 | - if (!(dwall & W_WEST)) break; | |
1302 | + if (!(dwall & W_WEST)) goto redoloop; | |
1305 | 1303 | x = broom->lx - 1; |
1306 | - y = broom->ly + dpos; | |
1304 | + y = broom->ly + ((dpos == -1) ? rn2(1+(broom->hy - broom->ly)) : dpos); | |
1305 | + if (IS_ROCK(levl[x-1][y].typ)) goto redoloop; | |
1307 | 1306 | goto outdirloop; |
1308 | 1307 | case 3: |
1309 | - if (!(dwall & W_EAST)) break; | |
1308 | + if (!(dwall & W_EAST)) goto redoloop; | |
1310 | 1309 | x = broom->hx + 1; |
1311 | - y = broom->ly + dpos; | |
1310 | + y = broom->ly + ((dpos == -1) ? rn2(1+(broom->hy - broom->ly)) : dpos); | |
1311 | + if (IS_ROCK(levl[x+1][y].typ)) goto redoloop; | |
1312 | 1312 | goto outdirloop; |
1313 | 1313 | default: |
1314 | 1314 | x = y = 0; |
1315 | 1315 | panic("create_door: No wall for door!"); |
1316 | 1316 | goto outdirloop; |
1317 | - } | |
1318 | 1317 | } |
1319 | 1318 | outdirloop: |
1320 | 1319 | if (okdoor(x,y)) |
1321 | 1320 | break; |
1321 | +redoloop: ; | |
1322 | 1322 | } while (++trycnt <= 100); |
1323 | 1323 | if (trycnt > 100) { |
1324 | 1324 | impossible("create_door: Can't find a proper place!"); |