Browse Source

Backport: Correct OOB check in PrepareInnerBorders() (#6064)

Correct OOB check in PrepareInnerBorders()

Co-authored-by: Stephen C. Wills <staphen@gmail.com>
v1.0
Anders Jenbo 3 years ago committed by GitHub
parent
commit
e97a4f8776
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 18
      Source/drlg_l4.cpp

18
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;
}
}

Loading…
Cancel
Save