Fix bounds check (#1070)

This commit is contained in:
David Markowitz 2023-05-06 11:32:46 -07:00 committed by GitHub
parent cffb1449d8
commit 7949907517
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -63,13 +63,13 @@ void dpGrid::Move(dpEntity* entity, float x, float z) {
if (cellX < 0) cellX = 0;
if (cellZ < 0) cellZ = 0;
if (cellX > NUM_CELLS) cellX = NUM_CELLS;
if (cellZ > NUM_CELLS) cellZ = NUM_CELLS;
if (cellX >= NUM_CELLS) cellX = NUM_CELLS - 1;
if (cellZ >= NUM_CELLS) cellZ = NUM_CELLS - 1;
if (oldCellX < 0) oldCellX = 0;
if (oldCellZ < 0) oldCellZ = 0;
if (oldCellX > NUM_CELLS) oldCellX = NUM_CELLS;
if (oldCellZ > NUM_CELLS) oldCellZ = NUM_CELLS;
if (oldCellX >= NUM_CELLS) oldCellX = NUM_CELLS - 1;
if (oldCellZ >= NUM_CELLS) oldCellZ = NUM_CELLS - 1;
if (oldCellX == cellX && oldCellZ == cellZ) return;