diff --git a/.github/badges/files.json b/.github/badges/files.json index e6ff8b765..52a7aeea0 100644 --- a/.github/badges/files.json +++ b/.github/badges/files.json @@ -1,6 +1,6 @@ { - "schemaVersion": 1, - "label": "source files", - "message": "1574", - "color": "green" + "schemaVersion": 1, + "label": "source files", + "message": "1574", + "color": "green" } diff --git a/.github/badges/loc-breakdown.json b/.github/badges/loc-breakdown.json index f33035f64..fceaf43ac 100644 --- a/.github/badges/loc-breakdown.json +++ b/.github/badges/loc-breakdown.json @@ -1,11 +1,11 @@ { - "schemaVersion": 1, - "total": 510938, - "files": 1574, - "engine": 261074, - "editor": 85302, - "game": 57841, - "tests": 104330, - "tools": 2391, - "updated": "2026-04-06T13:14:10Z" + "schemaVersion": 1, + "total": 510938, + "files": 1574, + "engine": 261074, + "editor": 85303, + "game": 57841, + "tests": 104329, + "tools": 2391, + "updated": "2026-04-06T14:24:43Z" } diff --git a/.github/badges/loc.json b/.github/badges/loc.json index 703141ee8..02ae6ccdf 100644 --- a/.github/badges/loc.json +++ b/.github/badges/loc.json @@ -1,8 +1,8 @@ { - "schemaVersion": 1, - "label": "C++ lines of code", - "message": "510938", - "color": "blue", - "namedLogo": "cplusplus", - "logoColor": "white" + "schemaVersion": 1, + "label": "C++ lines of code", + "message": "510938", + "color": "blue", + "namedLogo": "cplusplus", + "logoColor": "white" } diff --git a/GameModules/SparkGameMMO/Source/Chat/MMOChatSystem.cpp b/GameModules/SparkGameMMO/Source/Chat/MMOChatSystem.cpp index 65b368c3e..211f62740 100644 --- a/GameModules/SparkGameMMO/Source/Chat/MMOChatSystem.cpp +++ b/GameModules/SparkGameMMO/Source/Chat/MMOChatSystem.cpp @@ -25,9 +25,6 @@ namespace MMO bool MMOChatSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; SetupNetworkHandlers(); diff --git a/GameModules/SparkGameOpenWorld/Source/Events/OWDynamicEventSystem.cpp b/GameModules/SparkGameOpenWorld/Source/Events/OWDynamicEventSystem.cpp index 9824df8f4..f41150b86 100644 --- a/GameModules/SparkGameOpenWorld/Source/Events/OWDynamicEventSystem.cpp +++ b/GameModules/SparkGameOpenWorld/Source/Events/OWDynamicEventSystem.cpp @@ -19,9 +19,6 @@ namespace OpenWorld bool OWDynamicEventSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; DefineEventTemplates(); diff --git a/GameModules/SparkGameOpenWorld/Source/Exploration/OWExplorationSystem.cpp b/GameModules/SparkGameOpenWorld/Source/Exploration/OWExplorationSystem.cpp index 2d7133448..3d53df939 100644 --- a/GameModules/SparkGameOpenWorld/Source/Exploration/OWExplorationSystem.cpp +++ b/GameModules/SparkGameOpenWorld/Source/Exploration/OWExplorationSystem.cpp @@ -19,9 +19,6 @@ namespace OpenWorld bool OWExplorationSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; DefinePointsOfInterest(); diff --git a/GameModules/SparkGameOpenWorld/Source/Gathering/OWGatheringSystem.cpp b/GameModules/SparkGameOpenWorld/Source/Gathering/OWGatheringSystem.cpp index 4bea73975..0c38e839e 100644 --- a/GameModules/SparkGameOpenWorld/Source/Gathering/OWGatheringSystem.cpp +++ b/GameModules/SparkGameOpenWorld/Source/Gathering/OWGatheringSystem.cpp @@ -49,9 +49,6 @@ namespace OpenWorld bool OWGatheringSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; DefineResourceNodes(); diff --git a/GameModules/SparkGameOpenWorld/Source/Player/OWPlayerSystem.cpp b/GameModules/SparkGameOpenWorld/Source/Player/OWPlayerSystem.cpp index eb9dffe51..84aabe105 100644 --- a/GameModules/SparkGameOpenWorld/Source/Player/OWPlayerSystem.cpp +++ b/GameModules/SparkGameOpenWorld/Source/Player/OWPlayerSystem.cpp @@ -20,9 +20,6 @@ namespace OpenWorld bool OWPlayerSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; // Start in the Emerald Meadows center diff --git a/GameModules/SparkGameOpenWorld/Source/Settlement/OWSettlementSystem.cpp b/GameModules/SparkGameOpenWorld/Source/Settlement/OWSettlementSystem.cpp index bed71758e..d64a484cd 100644 --- a/GameModules/SparkGameOpenWorld/Source/Settlement/OWSettlementSystem.cpp +++ b/GameModules/SparkGameOpenWorld/Source/Settlement/OWSettlementSystem.cpp @@ -19,9 +19,6 @@ namespace OpenWorld bool OWSettlementSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; DefineSettlements(); diff --git a/GameModules/SparkGameOpenWorld/Source/Wildlife/OWWildlifeSystem.cpp b/GameModules/SparkGameOpenWorld/Source/Wildlife/OWWildlifeSystem.cpp index c2b788abe..f8a5a6d2a 100644 --- a/GameModules/SparkGameOpenWorld/Source/Wildlife/OWWildlifeSystem.cpp +++ b/GameModules/SparkGameOpenWorld/Source/Wildlife/OWWildlifeSystem.cpp @@ -20,9 +20,6 @@ namespace OpenWorld bool OWWildlifeSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; DefineSpecies(); diff --git a/GameModules/SparkGameOpenWorld/Source/World/OWWorldSetup.cpp b/GameModules/SparkGameOpenWorld/Source/World/OWWorldSetup.cpp index d5b1e24a5..e3e202549 100644 --- a/GameModules/SparkGameOpenWorld/Source/World/OWWorldSetup.cpp +++ b/GameModules/SparkGameOpenWorld/Source/World/OWWorldSetup.cpp @@ -21,9 +21,6 @@ namespace OpenWorld bool OWWorldSetup::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; DefineBiomeRegions(); diff --git a/GameModules/SparkGameRTS/Source/Building/RTSBuildingSystem.cpp b/GameModules/SparkGameRTS/Source/Building/RTSBuildingSystem.cpp index bb1082005..e340de553 100644 --- a/GameModules/SparkGameRTS/Source/Building/RTSBuildingSystem.cpp +++ b/GameModules/SparkGameRTS/Source/Building/RTSBuildingSystem.cpp @@ -82,7 +82,7 @@ namespace RTS { auto it = m_buildings.find(buildingId); if (it != m_buildings.end()) - it->second.health = 0.0f; + m_buildings.erase(it); } // === Production === diff --git a/GameModules/SparkGameRTS/Source/Unit/RTSUnitSystem.cpp b/GameModules/SparkGameRTS/Source/Unit/RTSUnitSystem.cpp index 57f9e0fef..3d1bc7136 100644 --- a/GameModules/SparkGameRTS/Source/Unit/RTSUnitSystem.cpp +++ b/GameModules/SparkGameRTS/Source/Unit/RTSUnitSystem.cpp @@ -87,9 +87,8 @@ namespace RTS auto it = m_units.find(unitId); if (it != m_units.end()) { - it->second.state = RTSUnitState::Dead; - it->second.health = 0.0f; SPARK_LOG_DEBUG(Spark::LogCategory::Game, "RTS unit %u killed", unitId); + m_units.erase(it); } } diff --git a/GameModules/SparkGameRacing/Source/Vehicle/RacingVehicleSystem.cpp b/GameModules/SparkGameRacing/Source/Vehicle/RacingVehicleSystem.cpp index 53b8a68cc..a26f7da1d 100644 --- a/GameModules/SparkGameRacing/Source/Vehicle/RacingVehicleSystem.cpp +++ b/GameModules/SparkGameRacing/Source/Vehicle/RacingVehicleSystem.cpp @@ -19,9 +19,6 @@ namespace Racing bool RacingVehicleSystem::Initialize(Spark::IEngineContext* context) { - if (!context) - return false; - m_context = context; m_initialized = true; diff --git a/SparkEditor/Source/Core/EditorLogger.cpp b/SparkEditor/Source/Core/EditorLogger.cpp index d813f05de..b341a2197 100644 --- a/SparkEditor/Source/Core/EditorLogger.cpp +++ b/SparkEditor/Source/Core/EditorLogger.cpp @@ -110,25 +110,25 @@ namespace SparkEditor bool EditorLogger::Initialize(const std::string& logDirectory, size_t maxMemoryEntries) { - std::lock_guard lock(m_mutex); - - if (m_initialized) { - return true; - } + std::lock_guard lock(m_mutex); - // Add console target - AddTarget(std::make_unique()); + if (m_initialized) + { + return true; + } - // Add memory target - AddTarget(std::make_unique(maxMemoryEntries)); + // Push targets directly — calling AddTarget() would deadlock on m_mutex + m_targets.push_back(std::make_unique()); + m_targets.push_back(std::make_unique(maxMemoryEntries)); - // Add file target - std::string logFile = logDirectory + "/editor.log"; - AddTarget(std::make_unique(logFile)); + std::string logFile = logDirectory + "/editor.log"; + m_targets.push_back(std::make_unique(logFile)); - m_initialized = true; + m_initialized = true; + } + // Log after releasing m_mutex — Log() acquires it internally Log(LogLevel::INFO, "Logger", "Editor logger initialized"); return true; } @@ -142,7 +142,7 @@ namespace SparkEditor return; } - Log(LogLevel::INFO, "Logger", "Editor logger shutting down"); + // Don't call Log() here — it would deadlock on m_mutex // Flush all targets for (auto& target : m_targets) diff --git a/SparkEditor/Source/Prefabs/PrefabManager.cpp b/SparkEditor/Source/Prefabs/PrefabManager.cpp index a1bfb0b97..7e2c84da1 100644 --- a/SparkEditor/Source/Prefabs/PrefabManager.cpp +++ b/SparkEditor/Source/Prefabs/PrefabManager.cpp @@ -10,6 +10,7 @@ #include "Utils/LogMacros.h" #include "Utils/Validate.h" #include +#include #include #include #include @@ -79,7 +80,7 @@ namespace SparkEditor } m_prefabs[prefabName] = std::move(prefab); - SPARK_LOG_INFO(Spark::LogCategory::Editor, "Created prefab from entity %llu: '%s'", entityId, + SPARK_LOG_INFO(Spark::LogCategory::Editor, "Created prefab from entity %" PRIu64 ": '%s'", entityId, prefabName.c_str()); NotifyPrefabsChanged(); return &m_prefabs[prefabName]; diff --git a/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp b/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp index ff149c23d..424afe0fb 100644 --- a/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp +++ b/SparkEngine/Source/Engine/AI/AIDebugRenderer.cpp @@ -254,7 +254,7 @@ namespace Spark::AI from.y += 0.1f; to.y += 0.1f; - DebugColor segColor = (i < currentIndex) ? visitedColor : pathColor; + [[maybe_unused]] DebugColor segColor = (i < currentIndex) ? visitedColor : pathColor; DEBUG_DRAW_LINE(from, to, segColor); } @@ -263,7 +263,7 @@ namespace Spark::AI XMFLOAT3 pos = path[i].position; pos.y += 0.1f; - DebugColor color = (i == currentIndex) ? activeColor : pathColor; + [[maybe_unused]] DebugColor color = (i == currentIndex) ? activeColor : pathColor; float size = (i == currentIndex) ? 0.3f : 0.15f; DEBUG_DRAW_SPHERE(pos, size, color); } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index fca5a4a69..0c558519a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -460,11 +460,13 @@ if(TARGET imgui) "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Hero/ARPGHeroSystem.cpp" "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Combat/ARPGCombatSystem.cpp" "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Loot/ARPGLootSystem.cpp" + "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Dungeon/ARPGDungeonSystem.cpp" "${CMAKE_SOURCE_DIR}/GameModules/SparkGameARPG/Source/Core/ARPGEngineSystems.cpp" ) # Editor sources that require ImGui target_sources(SparkTests PRIVATE + "${CMAKE_SOURCE_DIR}/SparkEditor/Source/Core/EditorPanel.cpp" "${CMAKE_SOURCE_DIR}/SparkEditor/Source/Core/EditorTheme.cpp" "${CMAKE_SOURCE_DIR}/SparkEditor/Source/Search/CommandPalette.cpp" "${CMAKE_SOURCE_DIR}/SparkEditor/Source/LevelStreaming/LevelStreamingSystem.cpp" diff --git a/Tests/TestCoreAndBuildSystems.cpp b/Tests/TestCoreAndBuildSystems.cpp index 3c240f20a..1767a90b3 100644 --- a/Tests/TestCoreAndBuildSystems.cpp +++ b/Tests/TestCoreAndBuildSystems.cpp @@ -203,8 +203,7 @@ TEST(CSGSystem_UnionCombinesFaces) auto result = csg.Union(*a, *b); // Union should at least return a valid solid (faces may vary by implementation) - EXPECT_TRUE(result.operation == Spark::LevelDesign::CSGOperation::Additive || - result.faces.size() >= 0); + EXPECT_TRUE(result.operation == Spark::LevelDesign::CSGOperation::Additive); csg.ClearAll(); } @@ -400,14 +399,14 @@ TEST(Reflection_TypeRegistryCount) auto& reg = Spark::TypeRegistry::Get(); // Registry exists and has some count (may be zero or populated by static init) size_t count = reg.GetTypeCount(); - EXPECT_TRUE(count >= 0); // Always true, but confirms no crash + (void)count; // confirms no crash } TEST(Reflection_ComponentFactoryCount) { auto& factory = Spark::ComponentFactory::Get(); size_t count = factory.GetRegisteredCount(); - EXPECT_TRUE(count >= 0); + (void)count; // confirms no crash } TEST(Reflection_ComponentFactoryGetNames) diff --git a/Tests/TestEditorSubsystems.cpp b/Tests/TestEditorSubsystems.cpp index 2fb1d4d58..910565d0a 100644 --- a/Tests/TestEditorSubsystems.cpp +++ b/Tests/TestEditorSubsystems.cpp @@ -20,6 +20,8 @@ #include "../SparkEditor/Source/Core/ProjectManager.h" #include "../SparkEditor/Source/Core/EditorPluginManager.h" #include +#include +#include using namespace SparkEditor; @@ -602,8 +604,10 @@ TEST(EditorLogger_ExportLogs) logger.Clear(); logger.Log(LogLevel::INFO, "General", "export test"); - bool result = logger.ExportLogs("TestLogs/test_export.log", nullptr); + // Export to a file in the current directory (TestLogs/ may not exist) + bool result = logger.ExportLogs("test_export.log", nullptr); EXPECT_TRUE(result); + std::remove("test_export.log"); logger.Shutdown(); } @@ -649,6 +653,7 @@ TEST(CrashHandler_RecordOperation) TEST(CrashHandler_SaveAndHasRecoveryData) { + std::filesystem::create_directories("TestCrashes"); auto& handler = EditorCrashHandler::GetInstance(); handler.Initialize("TestCrashes"); @@ -665,6 +670,7 @@ TEST(CrashHandler_SaveAndHasRecoveryData) EXPECT_TRUE(saved); EXPECT_TRUE(handler.HasRecoveryData()); handler.Shutdown(); + std::filesystem::remove_all("TestCrashes"); } TEST(CrashHandler_ClearRecoveryData) @@ -755,7 +761,7 @@ TEST(ProjectManager_RecentProjects) auto recent = pm.GetRecentProjects(); // May be empty — just verify it returns without crashing - EXPECT_TRUE(recent.size() >= 0); + (void)recent; // just verify it returns without crashing pm.Shutdown(); } @@ -1037,7 +1043,7 @@ TEST(Gated_VCS_SceneMergeHandler) SceneMergeHandler handler; auto exts = handler.GetSupportedExtensions(); EXPECT_TRUE(!exts.empty()); - EXPECT_TRUE(handler.CanMerge("level.scene")); + EXPECT_TRUE(handler.CanMerge("level.sparkscene")); EXPECT_FALSE(handler.CanMerge("readme.txt")); } diff --git a/Tests/TestOpenWorldModule.cpp b/Tests/TestOpenWorldModule.cpp index f684f6444..5125459b6 100644 --- a/Tests/TestOpenWorldModule.cpp +++ b/Tests/TestOpenWorldModule.cpp @@ -504,7 +504,7 @@ TEST(Gated_OWWildlife_HuntAnimal) wildlife.Initialize(nullptr); auto drops = wildlife.HuntAnimal(1); // Hunting should produce some resource drops - EXPECT_TRUE(drops.size() >= 0); // may be empty if animal not found + (void)drops; // may be empty if animal not found, just verify no crash } TEST(Gated_OWWildlife_Strings) diff --git a/wiki/Codebase-Statistics.md b/wiki/Codebase-Statistics.md index 1229db5d7..77ae730cd 100644 --- a/wiki/Codebase-Statistics.md +++ b/wiki/Codebase-Statistics.md @@ -9,9 +9,9 @@ Comprehensive metrics and analysis of the SparkEngine codebase. Updated 2026-04- | Section | Lines | |---------|------:| | **SparkEngine/Source** | 261074 | -| **SparkEditor/Source** | 85302 | +| **SparkEditor/Source** | 85303 | | **GameModules** | 57841 | -| **Tests** | 104330 | +| **Tests** | 104329 | | **SparkConsole/src** | 1858 | | **SparkShaderCompiler/src** | 533 | | **Total C++ (excl. ThirdParty)** | **~510938** | @@ -99,7 +99,7 @@ Comprehensive metrics and analysis of the SparkEngine codebase. Updated 2026-04- | Metric | Count | |--------|------:| | Editor panel classes | 59 | -| Total editor lines | 85302 | +| Total editor lines | 85303 | ## Testing Metrics diff --git a/wiki/Home.md b/wiki/Home.md index e47e0ad2b..632a96f82 100644 --- a/wiki/Home.md +++ b/wiki/Home.md @@ -185,5 +185,5 @@ SparkEngine is licensed under the [Spark Open License](https://github.com/Krilli | Test files | 337 | | Test cases | 4290+ | | Wiki pages | 117 | -| *Last synced* | *2026-04-06 13:09* | +| *Last synced* | *2026-04-06 14:23* |