From 899701a87decb828169b09803896f3a1accbc532 Mon Sep 17 00:00:00 2001 From: Ivan Savenko Date: Sun, 15 Jun 2025 15:11:09 +0300 Subject: [PATCH] Update docs, fix sonar --- docs/modders/Mod_File_Format.md | 11 ++++++++++- lib/constants/EntityIdentifiers.cpp | 2 -- lib/constants/EntityIdentifiers.h | 3 --- lib/gameState/CGameStateCampaign.cpp | 5 +++-- lib/mapping/CMapService.cpp | 2 +- lib/mapping/MapFeaturesH3M.h | 4 ++-- lib/mapping/MapFormatSettings.h | 4 ++-- 7 files changed, 18 insertions(+), 13 deletions(-) diff --git a/docs/modders/Mod_File_Format.md b/docs/modders/Mod_File_Format.md index d6917d4ff..846b07ba6 100644 --- a/docs/modders/Mod_File_Format.md +++ b/docs/modders/Mod_File_Format.md @@ -119,7 +119,16 @@ These are fields that are present only in local mod.json file ], // List of configuration files for skills - skills + "skills" : + [ + "config/skills.json" + ], + + // List of configuration files for campaign regions for h3c campaigns + "campaignRegions" : + [ + "config/campaignRegions.json" + ], // list of creature configuration files "creatures" : diff --git a/lib/constants/EntityIdentifiers.cpp b/lib/constants/EntityIdentifiers.cpp index 88661311a..d246da948 100644 --- a/lib/constants/EntityIdentifiers.cpp +++ b/lib/constants/EntityIdentifiers.cpp @@ -55,8 +55,6 @@ const QueryID QueryID::NONE(-1); const QueryID QueryID::CLIENT(-2); const HeroTypeID HeroTypeID::NONE(-1); const HeroTypeID HeroTypeID::RANDOM(-2); -const HeroTypeID HeroTypeID::GEM(27); -const HeroTypeID HeroTypeID::SOLMYR(45); const HeroTypeID HeroTypeID::CAMP_STRONGEST(-3); const HeroTypeID HeroTypeID::CAMP_GENERATED(-2); const HeroTypeID HeroTypeID::CAMP_RANDOM(-1); diff --git a/lib/constants/EntityIdentifiers.h b/lib/constants/EntityIdentifiers.h index c26327e6f..a2794cbf4 100644 --- a/lib/constants/EntityIdentifiers.h +++ b/lib/constants/EntityIdentifiers.h @@ -115,9 +115,6 @@ public: static const HeroTypeID NONE; static const HeroTypeID RANDOM; - static const HeroTypeID GEM; // aka Gem, Sorceress in campaign - static const HeroTypeID SOLMYR; // aka Young Yog in campaigns - static const HeroTypeID CAMP_STRONGEST; static const HeroTypeID CAMP_GENERATED; static const HeroTypeID CAMP_RANDOM; diff --git a/lib/gameState/CGameStateCampaign.cpp b/lib/gameState/CGameStateCampaign.cpp index 94ff8c307..4e7e5ed93 100644 --- a/lib/gameState/CGameStateCampaign.cpp +++ b/lib/gameState/CGameStateCampaign.cpp @@ -577,9 +577,10 @@ void CGameStateCampaign::initHeroes() } auto campaignState = gameState->scenarioOps->campState; - auto * yog = gameState->getUsedHero(HeroTypeID::SOLMYR); - if (yog && boost::starts_with(campaignState->getFilename(), "DATA/YOG") && campaignState->currentScenario()->getNum() == 2) + if (campaignState->getYogWizardID().hasValue() && boost::starts_with(campaignState->getFilename(), "DATA/YOG") && campaignState->currentScenario()->getNum() == 2) { + auto * yog = gameState->getUsedHero(campaignState->getYogWizardID()); + assert(yog); assert(yog->isCampaignYog()); gameState->giveHeroArtifact(yog, ArtifactID::ANGELIC_ALLIANCE); } diff --git a/lib/mapping/CMapService.cpp b/lib/mapping/CMapService.cpp index b09e85114..252297f2c 100644 --- a/lib/mapping/CMapService.cpp +++ b/lib/mapping/CMapService.cpp @@ -169,7 +169,7 @@ std::unique_ptr CMapService::getMapPatcher(std::string scenarioName { boost::to_lower(scenarioName); logGlobal->debug("Request to patch map %s", scenarioName); - return std::unique_ptr(new CMapPatcher(LIBRARY->mapFormat->mapOverrides(scenarioName))); + return std::make_unique(LIBRARY->mapFormat->mapOverrides(scenarioName)); } VCMI_LIB_NAMESPACE_END diff --git a/lib/mapping/MapFeaturesH3M.h b/lib/mapping/MapFeaturesH3M.h index a42430d44..4afd48dea 100644 --- a/lib/mapping/MapFeaturesH3M.h +++ b/lib/mapping/MapFeaturesH3M.h @@ -16,6 +16,7 @@ enum class EMapFormat : uint8_t; struct MapFormatFeaturesH3M { +private: static MapFormatFeaturesH3M getFeaturesROE(); static MapFormatFeaturesH3M getFeaturesAB(); static MapFormatFeaturesH3M getFeaturesSOD(); @@ -23,12 +24,11 @@ struct MapFormatFeaturesH3M static MapFormatFeaturesH3M getFeaturesWOG(); static MapFormatFeaturesH3M getFeaturesHOTA(uint32_t hotaVersion); +public: MapFormatFeaturesH3M() = default; -public: static MapFormatFeaturesH3M find(EMapFormat format, uint32_t hotaVersion); - // number of bytes in bitmask of appropriate type int factionsBytes; diff --git a/lib/mapping/MapFormatSettings.h b/lib/mapping/MapFormatSettings.h index 3a91ab871..0dab2cd8b 100644 --- a/lib/mapping/MapFormatSettings.h +++ b/lib/mapping/MapFormatSettings.h @@ -51,12 +51,12 @@ public: return mapping.at(campaignToMap.at(format)); } - const JsonNode & campaignOverrides(std::string & campaignName) + const JsonNode & campaignOverrides(const std::string & campaignName) { return campaignOverridesConfig[campaignName]; } - const JsonNode & mapOverrides(std::string & mapName) + const JsonNode & mapOverrides(const std::string & mapName) { return mapOverridesConfig[mapName]; }