mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2026-06-22 14:44:22 +00:00
fix: address PR review feedback for raw terrain parsing
- Fix integer division bug in scene map lookups (was truncating to 0) - Fix indentation throughout Raw.cpp, DEVGMCommands.cpp - Add missing <algorithm> and <set> includes in dZoneManager.cpp - Add missing width/height/scaleFactor guards in SpawnAllScenePoints - Fix %llu -> %zu for size_t format specifiers - Simplify no-op worldY calculation (y / scale * scale -> y) - Remove redundant ternary guards in GetSceneIDFromPosition - Fix misleading "Spawned LOT" feedback message - Update info.settings to use LwoNameValue::Insert API (post-merge fix) - Refactor SceneColor to static constexpr std::array (no heap alloc) - Make NiColor constructors constexpr - Remove duplicate CDZoneTableTable.h include Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -10,10 +10,11 @@
|
||||
#include "VanityUtilities.h"
|
||||
#include "WorldConfig.h"
|
||||
#include "CDZoneTableTable.h"
|
||||
#include <algorithm>
|
||||
#include <chrono>
|
||||
#include <cmath>
|
||||
#include <set>
|
||||
#include "eObjectBits.h"
|
||||
#include "CDZoneTableTable.h"
|
||||
#include "AssetManager.h"
|
||||
#include <ranges>
|
||||
|
||||
@@ -331,20 +332,11 @@ LWOSCENEID dZoneManager::GetSceneIDFromPosition(const NiPoint3& position) const
|
||||
if (heightI >= 0.0f && heightI < static_cast<float>(chunk.width) &&
|
||||
heightJ >= 0.0f && heightJ < static_cast<float>(chunk.height)) {
|
||||
|
||||
// Map heightmap position to scene map position (same as GenerateTerrainMesh)
|
||||
const float sceneMapI = (chunk.width > 1)
|
||||
? (heightI / static_cast<float>(chunk.width - 1)) * static_cast<float>(chunk.colorMapResolution - 1)
|
||||
: 0.0f;
|
||||
const float sceneMapJ = (chunk.height > 1)
|
||||
? (heightJ / static_cast<float>(chunk.height - 1)) * static_cast<float>(chunk.colorMapResolution - 1)
|
||||
: 0.0f;
|
||||
const float sceneMapI = (heightI / static_cast<float>(chunk.width - 1)) * static_cast<float>(chunk.colorMapResolution - 1);
|
||||
const float sceneMapJ = (heightJ / static_cast<float>(chunk.height - 1)) * static_cast<float>(chunk.colorMapResolution - 1);
|
||||
|
||||
const uint32_t sceneI = (chunk.colorMapResolution > 0)
|
||||
? std::min(static_cast<uint32_t>(sceneMapI), chunk.colorMapResolution - 1)
|
||||
: 0;
|
||||
const uint32_t sceneJ = (chunk.colorMapResolution > 0)
|
||||
? std::min(static_cast<uint32_t>(sceneMapJ), chunk.colorMapResolution - 1)
|
||||
: 0;
|
||||
const uint32_t sceneI = std::min(static_cast<uint32_t>(sceneMapI), chunk.colorMapResolution - 1);
|
||||
const uint32_t sceneJ = std::min(static_cast<uint32_t>(sceneMapJ), chunk.colorMapResolution - 1);
|
||||
|
||||
// Scene map uses the same indexing pattern as heightmap: row * width + col
|
||||
const uint32_t sceneIndex = sceneI * chunk.colorMapResolution + sceneJ;
|
||||
|
||||
Reference in New Issue
Block a user