1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-06 09:09:40 +02:00

Fixed parsing of hota format '0'

This commit is contained in:
Ivan Savenko
2023-04-09 01:03:43 +03:00
parent cc8c1c769a
commit b1e7774bbd
3 changed files with 27 additions and 14 deletions

View File

@@ -125,7 +125,15 @@ void CMapLoaderH3M::readHeader()
features = MapFormatFeaturesH3M::find(mapHeader->version, hotaVersion);
reader->setFormatLevel(mapHeader->version, hotaVersion);
reader->skipZero(2);
if(hotaVersion > 0)
{
reader->skipZero(1);
//TODO: HotA
bool isDuelMap = reader->readBool();
if (isDuelMap)
logGlobal->warn("Map '%s': Duel maps are not supported!", mapName);
}
if(hotaVersion > 1)
{
uint8_t unknown = reader->readUInt32();
@@ -587,7 +595,7 @@ void CMapLoaderH3M::readAllowedHeroes()
uint32_t heroesCount = features.heroesCount;
uint32_t heroesBytes = features.heroesBytes;
if(features.levelHOTA)
if(features.levelHOTA0)
{
heroesCount = reader->readUInt32();
heroesBytes = (heroesCount + 7) / 8;
@@ -627,14 +635,17 @@ void CMapLoaderH3M::readMapOptions()
//omitting NULLS
reader->skipZero(31);
if(features.levelHOTA)
if(features.levelHOTA0)
{
//TODO: HotA
bool allowSpecialMonths = reader->readBool();
if(!allowSpecialMonths)
logGlobal->warn("Map '%s': Option 'allow special months' is not implemented!", mapName);
reader->skipZero(3);
}
if(features.levelHOTA1)
{
uint8_t unknownConstant = reader->readUInt8();
assert(unknownConstant == 16);
MAYBE_UNUSED(unknownConstant);
@@ -657,7 +668,7 @@ void CMapLoaderH3M::readAllowedArtifacts()
uint32_t artifactsCount = features.artifactsCount;
uint32_t artifactsBytes = features.artifactsBytes;
if(features.levelHOTA)
if(features.levelHOTA0)
{
artifactsCount = reader->readUInt32();
artifactsBytes = (artifactsCount + 7) / 8;
@@ -730,7 +741,7 @@ void CMapLoaderH3M::readPredefinedHeroes()
uint32_t heroesCount = features.heroesCount;
if(features.levelHOTA)
if(features.levelHOTA0)
heroesCount = reader->readUInt32();
assert(heroesCount <= features.heroesCount);
@@ -1988,7 +1999,7 @@ CGObjectInstance * CMapLoaderH3M::readTown(const int3 & position, std::shared_pt
object->possibleSpells.emplace_back(i);
}
if(features.levelHOTA)
if(features.levelHOTA1)
{
// TODO: HOTA support
bool spellResearchAvailable = reader->readBool();
@@ -2033,7 +2044,7 @@ CGObjectInstance * CMapLoaderH3M::readTown(const int3 & position, std::shared_pt
object->events.push_back(event);
}
if(features.levelHOTA)
if(features.levelHOTA0)
{
// TODO: HOTA support
uint8_t alignment = reader->readUInt8();