diff --git a/CMakeLists.txt b/CMakeLists.txt index c578c3da..d748fb34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1915,7 +1915,14 @@ if(WIN32) endif() endif() if(NOT MSVC) - target_compile_options(wowee_editor PRIVATE -Wall -Wextra -Wpedantic -Wno-missing-field-initializers) + # The editor's CLI handlers share a `(int& i, int argc, char** argv)` + # signature so they can be plugged into a function-pointer dispatch + # table; many handlers don't reference argc directly. Suppress that + # warning here rather than littering 30+ handlers with [[maybe_unused]]. + target_compile_options(wowee_editor PRIVATE + -Wall -Wextra -Wpedantic + -Wno-missing-field-initializers + -Wno-unused-parameter) endif() if(GLSLC) add_dependencies(wowee_editor wowee_shaders) diff --git a/src/pipeline/wowee_crafting_recipes.cpp b/src/pipeline/wowee_crafting_recipes.cpp index 1067558a..bd011ec5 100644 --- a/src/pipeline/wowee_crafting_recipes.cpp +++ b/src/pipeline/wowee_crafting_recipes.cpp @@ -205,7 +205,6 @@ WoweeCraftingRecipes::Entry makeRecipe( WoweeCraftingRecipes WoweeCraftingRecipesLoader::makeAlchemyPotions( const std::string& catalogName) { - using R = WoweeCraftingRecipes; WoweeCraftingRecipes c; c.name = catalogName; // Vanilla Alchemy potions. Reagent itemIds are @@ -240,7 +239,6 @@ WoweeCraftingRecipes WoweeCraftingRecipesLoader::makeAlchemyPotions( WoweeCraftingRecipes WoweeCraftingRecipesLoader::makeEngineering( const std::string& catalogName) { - using R = WoweeCraftingRecipes; WoweeCraftingRecipes c; c.name = catalogName; // Rough Blasting Powder: 1 Rough Stone (2835) @@ -267,7 +265,6 @@ WoweeCraftingRecipes WoweeCraftingRecipesLoader::makeEngineering( WoweeCraftingRecipes WoweeCraftingRecipesLoader::makeBlacksmithing( const std::string& catalogName) { - using R = WoweeCraftingRecipes; WoweeCraftingRecipes c; c.name = catalogName; // Rough Sharpening Stone: 1 Rough Stone -> 1 diff --git a/src/pipeline/wowee_player_spawn_profiles.cpp b/src/pipeline/wowee_player_spawn_profiles.cpp index 32a5efe1..8846a03b 100644 --- a/src/pipeline/wowee_player_spawn_profiles.cpp +++ b/src/pipeline/wowee_player_spawn_profiles.cpp @@ -70,9 +70,11 @@ constexpr uint32_t RACE_TROLL = 1u << 7; constexpr uint32_t RACE_BLOODELF = 1u << 9; constexpr uint32_t RACE_DRAENEI = 1u << 10; -// Class bits, mirroring WCHC layout. Used by presets. +// Class bits, mirroring WCHC layout. Used by presets. Kept complete (with +// [[maybe_unused]] on the unreferenced ones) so the bit layout is +// documented in code rather than only on the wiki. constexpr uint32_t CLS_WARRIOR = 1u << 0; -constexpr uint32_t CLS_PALADIN = 1u << 1; +[[maybe_unused]] constexpr uint32_t CLS_PALADIN = 1u << 1; constexpr uint32_t CLS_HUNTER = 1u << 2; constexpr uint32_t CLS_PRIEST = 1u << 4; constexpr uint32_t CLS_DK = 1u << 5; diff --git a/src/rendering/world_map/input_handler.cpp b/src/rendering/world_map/input_handler.cpp index 483d83fe..e7c7e0f4 100644 --- a/src/rendering/world_map/input_handler.cpp +++ b/src/rendering/world_map/input_handler.cpp @@ -11,7 +11,7 @@ namespace world_map { InputResult InputHandler::process(ViewLevel currentLevel, int hoveredZoneIdx, - bool cosmicEnabled) { + [[maybe_unused]] bool cosmicEnabled) { InputResult result; auto& input = core::Input::getInstance(); diff --git a/tools/editor/cli_data_tree.cpp b/tools/editor/cli_data_tree.cpp index 9fbf3752..b579bbd1 100644 --- a/tools/editor/cli_data_tree.cpp +++ b/tools/editor/cli_data_tree.cpp @@ -606,7 +606,7 @@ int handleStripDataTree(int& i, int argc, char** argv) { return failed == 0 ? 0 : 1; } -int handleAuditDataTree(int& i, int argc, char** argv) { +int handleAuditDataTree(int& i, [[maybe_unused]] int argc, char** argv) { // Non-destructive CI gate. Walks and exits 1 if // any proprietary file (.m2/.wmo/.blp/.dbc) lacks a // matching open sidecar at the same (parent, stem). The diff --git a/tools/editor/cli_for_each.cpp b/tools/editor/cli_for_each.cpp index 09bdf65a..69641bfc 100644 --- a/tools/editor/cli_for_each.cpp +++ b/tools/editor/cli_for_each.cpp @@ -23,7 +23,7 @@ int handleForEachZone(int& i, int argc, char** argv) { // command after '--' for each one. '{}' in the command is // substituted with the zone path (find -exec convention). // - // wowee_editor --for-each-zone custom_zones -- \\ + // wowee_editor --for-each-zone custom_zones -- (continued) // wowee_editor --validate-all {} // // Returns the count of failed runs as the exit code (capped @@ -111,9 +111,9 @@ int handleForEachTile(int& i, int argc, char** argv) { // (zoneDir/mapName_TX_TY) — the form most tile-level // editor commands take. // - // wowee_editor --for-each-tile MyZone -- \\ + // wowee_editor --for-each-tile MyZone -- (continued) // wowee_editor --build-woc {} - // wowee_editor --for-each-tile MyZone -- \\ + // wowee_editor --for-each-tile MyZone -- (continued) // wowee_editor --validate-whm {} std::string zoneDir = argv[++i]; if (i + 1 < argc && std::strcmp(argv[i + 1], "--") == 0) ++i; diff --git a/tools/editor/cli_format_validate.cpp b/tools/editor/cli_format_validate.cpp index deddb998..b3f6f527 100644 --- a/tools/editor/cli_format_validate.cpp +++ b/tools/editor/cli_format_validate.cpp @@ -947,7 +947,7 @@ int handleAuditProject(int& i, int argc, char** argv) { return 1; } -int handleBenchAuditProject(int& i, int argc, char** argv) { +int handleBenchAuditProject(int& i, [[maybe_unused]] int argc, char** argv) { // Time each --audit-project sub-step end-to-end so users // can see where the slow checks are. Useful for tuning a // CI pipeline: drop the slowest check from a fast-feedback diff --git a/tools/editor/cli_mesh_io.cpp b/tools/editor/cli_mesh_io.cpp index 2827066c..f6d1b2d8 100644 --- a/tools/editor/cli_mesh_io.cpp +++ b/tools/editor/cli_mesh_io.cpp @@ -190,8 +190,8 @@ int handleGenMeshFromHeightmap(int& i, int argc, char** argv) { float halfW = W * scaleXZ * 0.5f; float halfH = H * scaleXZ * 0.5f; auto sample = [&](int x, int y) { - if (x < 0) x = 0; if (x >= W) x = W - 1; - if (y < 0) y = 0; if (y >= H) y = H - 1; + x = std::clamp(x, 0, W - 1); + y = std::clamp(y, 0, H - 1); return data[y * W + x] / 255.0f * scaleY; }; wom.vertices.reserve(static_cast(W) * H); @@ -330,7 +330,7 @@ int handleExportMeshHeightmap(int& i, int argc, char** argv) { size_t idx = static_cast(y) * W + x; float h = wom.vertices[idx].position.y; float t = (range > 1e-6f) ? (h - yMin) / range : 0.0f; - if (t < 0) t = 0; if (t > 1) t = 1; + t = std::clamp(t, 0.0f, 1.0f); uint8_t g = static_cast(t * 255.0f + 0.5f); size_t i2 = idx * 3; pixels[i2 + 0] = g; diff --git a/tools/editor/editor_app.cpp b/tools/editor/editor_app.cpp index 0327e3fc..6ecc4942 100644 --- a/tools/editor/editor_app.cpp +++ b/tools/editor/editor_app.cpp @@ -1066,8 +1066,10 @@ void EditorApp::loadADT(const std::string& mapName, int tileX, int tileY) { // Always set mapName from the loaded ADT in case zone.json was absent // or stale. if (zoneManifest_.mapName.empty()) zoneManifest_.mapName = mapName; - if (objectPlacer_.objectCount() > 0 || npcSpawner_.spawnCount() > 0) - objectsDirty_ = true; autoSavePendingChanges_ = true; + if (objectPlacer_.objectCount() > 0 || npcSpawner_.spawnCount() > 0) { + objectsDirty_ = true; + autoSavePendingChanges_ = true; + } } void EditorApp::createNewTerrain(const std::string& mapName, int tileX, int tileY, float baseHeight, Biome biome) {