mirror of
https://github.com/DarkflameUniverse/DarkflameServer
synced 2024-08-30 18:43:58 +00:00
Update dpGrid.cpp
This commit is contained in:
parent
8e29148137
commit
a88ef0c325
@ -77,8 +77,8 @@ void dpGrid::Delete(dpEntity* entity) {
|
|||||||
int oldCellZ = (int)std::round(entity->m_Position.z) / dpGrid::CELL_SIZE + NUM_CELLS / 2;
|
int oldCellZ = (int)std::round(entity->m_Position.z) / dpGrid::CELL_SIZE + NUM_CELLS / 2;
|
||||||
|
|
||||||
// Clamp values to the range [0, NUM_CELLS - 1]
|
// Clamp values to the range [0, NUM_CELLS - 1]
|
||||||
cellX = std::clamp(oldCellX, 0, NUM_CELLS - 1);
|
oldCellX = std::clamp(oldCellX, 0, NUM_CELLS - 1);
|
||||||
cellZ = std::clamp(oldCellZ, 0, NUM_CELLS - 1);
|
oldCellZ = std::clamp(oldCellZ, 0, NUM_CELLS - 1);
|
||||||
|
|
||||||
auto& cell = m_Cells[oldCellX][oldCellZ];
|
auto& cell = m_Cells[oldCellX][oldCellZ];
|
||||||
auto toRemove = std::find(cell.begin(), cell.end(), entity);
|
auto toRemove = std::find(cell.begin(), cell.end(), entity);
|
||||||
|
Loading…
Reference in New Issue
Block a user