mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-04-09 17:26:58 +00:00
fix: guard against division by zero in GetSceneIDFromPosition
Agent-Logs-Url: https://github.com/DarkflameUniverse/DarkflameServer/sessions/8e30d854-e439-4b25-bb15-891ba389f0fd Co-authored-by: aronwk-aaron <26027722+aronwk-aaron@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
a8269497b1
commit
64c3319487
@@ -320,7 +320,7 @@ LWOSCENEID dZoneManager::GetSceneIDFromPosition(const NiPoint3& position) const
|
|||||||
// Find the chunk containing this position
|
// Find the chunk containing this position
|
||||||
// Reverse the world position calculation from GenerateTerrainMesh
|
// Reverse the world position calculation from GenerateTerrainMesh
|
||||||
for (const auto& chunk : raw.chunks) {
|
for (const auto& chunk : raw.chunks) {
|
||||||
if (chunk.sceneMap.empty()) continue;
|
if (chunk.sceneMap.empty() || chunk.scaleFactor <= 0.0f || chunk.width <= 1 || chunk.height <= 1 || chunk.colorMapResolution == 0) continue;
|
||||||
|
|
||||||
// Reverse: worldX = (i + offsetX/scaleFactor) * scaleFactor
|
// Reverse: worldX = (i + offsetX/scaleFactor) * scaleFactor
|
||||||
// Therefore: i = worldX/scaleFactor - offsetX/scaleFactor
|
// Therefore: i = worldX/scaleFactor - offsetX/scaleFactor
|
||||||
|
|||||||
Reference in New Issue
Block a user