2
0
Laserlicht 1 жил өмнө
parent
commit
46c169d20f

+ 1 - 1
lib/campaign/CampaignConstants.h

@@ -18,7 +18,7 @@ enum class CampaignVersion : uint8_t
 	AB = 5,
 	SoD = 6,
 	WoG = 6,
-	//		Chr = 7, // Heroes Chronicles, likely identical to SoD, untested
+	Chr = 7,
 
 	VCMI = 1,
 	VCMI_MIN = 1,

+ 2 - 1
lib/campaign/CampaignHandler.cpp

@@ -392,7 +392,8 @@ void CampaignHandler::readHeaderFromMemory( CampaignHeader & ret, CBinaryReader
 {
 	ret.version = static_cast<CampaignVersion>(reader.readUInt32());
 	ui8 campId = reader.readUInt8() - 1;//change range of it from [1, 20] to [0, 19]
-	ret.loadLegacyData(campId);
+	if(ret.version != CampaignVersion::Chr)
+		ret.loadLegacyData(campId);
 	ret.name.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "name"));
 	ret.description.appendTextID(readLocalizedString(ret, reader, filename, modName, encoding, "description"));
 	ret.author.appendRawString("");

+ 1 - 0
lib/mapping/CMapService.cpp

@@ -157,6 +157,7 @@ std::unique_ptr<IMapLoader> CMapService::getMapLoader(std::unique_ptr<CInputStre
 			case static_cast<int>(EMapFormat::AB)  :
 			case static_cast<int>(EMapFormat::ROE) :
 			case static_cast<int>(EMapFormat::SOD) :
+			case static_cast<int>(EMapFormat::CHR) :
 			case static_cast<int>(EMapFormat::HOTA) :
 				return std::unique_ptr<IMapLoader>(new CMapLoaderH3M(mapName, modName, encoding, stream.get()));
 			default :

+ 9 - 0
lib/mapping/MapFeaturesH3M.cpp

@@ -25,6 +25,8 @@ MapFormatFeaturesH3M MapFormatFeaturesH3M::find(EMapFormat format, uint32_t hota
 			return getFeaturesAB();
 		case EMapFormat::SOD:
 			return getFeaturesSOD();
+		case EMapFormat::CHR:
+			return getFeaturesCHR();
 		case EMapFormat::WOG:
 			return getFeaturesWOG();
 		case EMapFormat::HOTA:
@@ -107,6 +109,13 @@ MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesSOD()
 	return result;
 }
 
+MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesCHR()
+{
+	MapFormatFeaturesH3M result = getFeaturesSOD();
+
+	return result;
+}
+
 MapFormatFeaturesH3M MapFormatFeaturesH3M::getFeaturesWOG()
 {
 	MapFormatFeaturesH3M result = getFeaturesSOD();

+ 1 - 0
lib/mapping/MapFeaturesH3M.h

@@ -21,6 +21,7 @@ public:
 	static MapFormatFeaturesH3M getFeaturesROE();
 	static MapFormatFeaturesH3M getFeaturesAB();
 	static MapFormatFeaturesH3M getFeaturesSOD();
+	static MapFormatFeaturesH3M getFeaturesCHR();
 	static MapFormatFeaturesH3M getFeaturesWOG();
 	static MapFormatFeaturesH3M getFeaturesHOTA(uint32_t hotaVersion);
 

+ 1 - 1
lib/mapping/MapFormat.h

@@ -19,7 +19,7 @@ enum class EMapFormat : uint8_t
 	ROE   = 0x0e, // 14
 	AB    = 0x15, // 21
 	SOD   = 0x1c, // 28
-//	CHR   = 0x1d, // 29 Heroes Chronicles, presumably - identical to SoD, untested
+	CHR   = 0x1d, // 29
 	HOTA  = 0x20, // 32
 	WOG   = 0x33, // 51
 	VCMI  = 0x64