Browse Source

Update docs, fix sonar

Ivan Savenko 4 months ago
parent
commit
899701a87d

+ 10 - 1
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" :

+ 0 - 2
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);

+ 0 - 3
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;

+ 3 - 2
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);
 	}

+ 1 - 1
lib/mapping/CMapService.cpp

@@ -169,7 +169,7 @@ std::unique_ptr<IMapPatcher> CMapService::getMapPatcher(std::string scenarioName
 {
 	boost::to_lower(scenarioName);
 	logGlobal->debug("Request to patch map %s", scenarioName);
-	return std::unique_ptr<IMapPatcher>(new CMapPatcher(LIBRARY->mapFormat->mapOverrides(scenarioName)));
+	return std::make_unique<CMapPatcher>(LIBRARY->mapFormat->mapOverrides(scenarioName));
 }
 
 VCMI_LIB_NAMESPACE_END

+ 2 - 2
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;

+ 2 - 2
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];
 	}