diff --git a/Source/drlg_l4.cpp b/Source/drlg_l4.cpp index e564dfa51..37d8c0836 100644 --- a/Source/drlg_l4.cpp +++ b/Source/drlg_l4.cpp @@ -1139,12 +1139,9 @@ static void uShape() } if (dung[i][j] == 1) { // BUGFIX: check that i + 1 < 20 and j + 1 < 20 (fixed) - if (i + 1 < 20 && j + 1 < 20 && - dung[i][j + 1] == 1 && dung[i + 1][j + 1] == 0) { - hallok[j] = TRUE; - } else { - hallok[j] = FALSE; - } + bool hasSouthWestRoom = j + 1 < 20 && dung[i][j + 1] == 1; + bool hasSouthRoom = i + 1 < 20 && j + 1 < 20 && dung[i + 1][j + 1] == 1; + hallok[j] = hasSouthWestRoom && !hasSouthRoom ? TRUE : FALSE; i = 0; } } @@ -1177,12 +1174,9 @@ static void uShape() } if (dung[i][j] == 1) { // BUGFIX: check that i + 1 < 20 and j + 1 < 20 (fixed) - if (i + 1 < 20 && j + 1 < 20 && - dung[i + 1][j] == 1 && dung[i + 1][j + 1] == 0) { - hallok[i] = TRUE; - } else { - hallok[i] = FALSE; - } + bool hasSouthEastRoom = i + 1 < 20 && dung[i + 1][j] == 1; + bool hasSouthRoom = i + 1 < 20 && j + 1 < 20 && dung[i + 1][j + 1] == 1; + hallok[i] = hasSouthEastRoom && !hasSouthRoom ? TRUE : FALSE; j = 0; } }