From c76268820297417f3d33499c37064c7e8b93240a Mon Sep 17 00:00:00 2001 From: Kelsi Date: Fri, 27 Mar 2026 15:31:21 -0700 Subject: [PATCH] refactor: promote static const arrays to constexpr across audio/core/rendering audio: birdPaths, cricketPaths, races core/application: componentDirs (4 instances), compDirs rendering/character_preview: componentDirs rendering/character_renderer: regionCoords256, regionSizes256 --- src/audio/activity_sound_manager.cpp | 2 +- src/audio/ambient_sound_manager.cpp | 4 ++-- src/core/application.cpp | 8 ++++---- src/rendering/character_preview.cpp | 2 +- src/rendering/character_renderer.cpp | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/audio/activity_sound_manager.cpp b/src/audio/activity_sound_manager.cpp index 3a0bfe54..9ba6bf50 100644 --- a/src/audio/activity_sound_manager.cpp +++ b/src/audio/activity_sound_manager.cpp @@ -355,7 +355,7 @@ void ActivitySoundManager::setCharacterVoiceProfile(const std::string& modelName std::string base = "Human"; struct RaceMap { const char* token; const char* folder; const char* base; }; - static const RaceMap races[] = { + static constexpr RaceMap races[] = { {"human", "Human", "Human"}, {"orc", "Orc", "Orc"}, {"dwarf", "Dwarf", "Dwarf"}, diff --git a/src/audio/ambient_sound_manager.cpp b/src/audio/ambient_sound_manager.cpp index 22791fe8..70574f79 100644 --- a/src/audio/ambient_sound_manager.cpp +++ b/src/audio/ambient_sound_manager.cpp @@ -85,7 +85,7 @@ bool AmbientSoundManager::initialize(pipeline::AssetManager* assets) { // Load bird chirp sounds (daytime periodic) — up to 6 variants { - static const char* birdPaths[] = { + static constexpr const char* birdPaths[] = { "Sound\\Ambience\\BirdAmbience\\BirdChirp01.wav", "Sound\\Ambience\\BirdAmbience\\BirdChirp02.wav", "Sound\\Ambience\\BirdAmbience\\BirdChirp03.wav", @@ -101,7 +101,7 @@ bool AmbientSoundManager::initialize(pipeline::AssetManager* assets) { // Load cricket/insect sounds (nighttime periodic) { - static const char* cricketPaths[] = { + static constexpr const char* cricketPaths[] = { "Sound\\Ambience\\Insect\\InsectMorning.wav", "Sound\\Ambience\\Insect\\InsectNight.wav", }; diff --git a/src/core/application.cpp b/src/core/application.cpp index 836a7b23..42122e24 100644 --- a/src/core/application.cpp +++ b/src/core/application.cpp @@ -5997,7 +5997,7 @@ void Application::spawnOnlineCreature(uint64_t guid, uint32_t displayId, float x // --- Equipment region layers (ItemDisplayInfo DBC) --- auto idiDbc = am->loadDBC("ItemDisplayInfo.dbc"); if (idiDbc) { - static const char* componentDirs[] = { + static constexpr const char* componentDirs[] = { "ArmUpperTexture", "ArmLowerTexture", "HandTexture", "TorsoUpperTexture", "TorsoLowerTexture", "LegUpperTexture", "LegLowerTexture", "FootTexture", @@ -7438,7 +7438,7 @@ void Application::setOnlinePlayerEquipment(uint64_t guid, charRenderer->setActiveGeosets(st.instanceId, geosets); // --- Textures (skin atlas compositing) --- - static const char* componentDirs[] = { + static constexpr const char* componentDirs[] = { "ArmUpperTexture", "ArmLowerTexture", "HandTexture", @@ -8221,7 +8221,7 @@ void Application::processCreatureSpawnQueue(bool unlimited) { // Equipment region textures auto idiDbc = am->loadDBC("ItemDisplayInfo.dbc"); if (idiDbc) { - static const char* compDirs[] = { + static constexpr const char* compDirs[] = { "ArmUpperTexture", "ArmLowerTexture", "HandTexture", "TorsoUpperTexture", "TorsoLowerTexture", "LegUpperTexture", "LegLowerTexture", "FootTexture", @@ -8439,7 +8439,7 @@ std::vector Application::resolveEquipmentTexturePaths(uint64_t guid const auto* idiL = pipeline::getActiveDBCLayout() ? pipeline::getActiveDBCLayout()->getLayout("ItemDisplayInfo") : nullptr; - static const char* componentDirs[] = { + static constexpr const char* componentDirs[] = { "ArmUpperTexture", "ArmLowerTexture", "HandTexture", "TorsoUpperTexture", "TorsoLowerTexture", "LegUpperTexture", "LegLowerTexture", "FootTexture", diff --git a/src/rendering/character_preview.cpp b/src/rendering/character_preview.cpp index 041fe8f2..3b7e9d72 100644 --- a/src/rendering/character_preview.cpp +++ b/src/rendering/character_preview.cpp @@ -643,7 +643,7 @@ bool CharacterPreview::applyEquipment(const std::vector& eq // --- Textures (equipment overlays onto body skin) --- if (bodySkinPath_.empty()) return true; // geosets applied, but can't composite - static const char* componentDirs[] = { + static constexpr const char* componentDirs[] = { "ArmUpperTexture", "ArmLowerTexture", "HandTexture", "TorsoUpperTexture", "TorsoLowerTexture", "LegUpperTexture", "LegLowerTexture", "FootTexture", diff --git a/src/rendering/character_renderer.cpp b/src/rendering/character_renderer.cpp index 726a09de..2cc66265 100644 --- a/src/rendering/character_renderer.cpp +++ b/src/rendering/character_renderer.cpp @@ -1122,7 +1122,7 @@ VkTexture* CharacterRenderer::compositeWithRegions(const std::string& basePath, // Region index -> pixel coordinates on the 256x256 base atlas // These are scaled up by (width/256, height/256) for larger textures (512x512, 1024x1024) - static const int regionCoords256[][2] = { + static constexpr int regionCoords256[][2] = { { 0, 0 }, // 0 = ArmUpper { 0, 64 }, // 1 = ArmLower { 0, 128 }, // 2 = Hand @@ -1263,7 +1263,7 @@ VkTexture* CharacterRenderer::compositeWithRegions(const std::string& basePath, } // Expected region sizes on the 256x256 base atlas (scaled like coords) - static const int regionSizes256[][2] = { + static constexpr int regionSizes256[][2] = { { 128, 64 }, // 0 = ArmUpper { 128, 64 }, // 1 = ArmLower { 128, 32 }, // 2 = Hand