1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-01-26 03:52:01 +02:00

Fixed parsing of hota 'arena' map format hacks

This commit is contained in:
Ivan Savenko 2023-04-12 01:02:01 +03:00
parent 1704fab3a2
commit 5589e973a8
2 changed files with 16 additions and 9 deletions

View File

@ -129,11 +129,10 @@ void CMapLoaderH3M::readHeader()
{
reader->skipZero(1);
//TODO: HotA
bool isDuelMap = reader->readBool();
if (isDuelMap)
bool isArenaMap = reader->readBool();
if (isArenaMap)
{
logGlobal->warn("Map '%s': Duel maps are not supported!", mapName);
throw std::runtime_error("Invalid map format!");
logGlobal->warn("Map '%s': Arena maps are not supported!", mapName);
}
}
@ -1240,10 +1239,18 @@ CGObjectInstance * CMapLoaderH3M::readHeroPlaceholder(const int3 & mapPosition)
return object;
}
CGObjectInstance * CMapLoaderH3M::readGrail(const int3 & mapPosition)
CGObjectInstance * CMapLoaderH3M::readGrail(const int3 & mapPosition, std::shared_ptr<const ObjectTemplate> objectTemplate)
{
map->grailPos = mapPosition;
map->grailRadius = reader->readInt32();
if (objectTemplate->subid < 1000)
{
map->grailPos = mapPosition;
map->grailRadius = reader->readInt32();
}
else
{
// Battle location for arena mode in HotA
logGlobal->warn("Map '%s': Arena mode is not supported!", mapName);
}
return nullptr;
}
@ -1416,7 +1423,7 @@ CGObjectInstance * CMapLoaderH3M::readObject(std::shared_ptr<const ObjectTemplat
return readPandora(mapPosition);
case Obj::GRAIL:
return readGrail(mapPosition);
return readGrail(mapPosition, objectTemplate);
case Obj::RANDOM_DWELLING:
case Obj::RANDOM_DWELLING_LVL:

View File

@ -175,7 +175,7 @@ private:
CGObjectInstance * readDwellingRandom(const int3 & position, std::shared_ptr<const ObjectTemplate> objTempl);
CGObjectInstance * readShrine();
CGObjectInstance * readHeroPlaceholder(const int3 & position);
CGObjectInstance * readGrail(const int3 & position);
CGObjectInstance * readGrail(const int3 & position, std::shared_ptr<const ObjectTemplate> objectTemplate);
CGObjectInstance * readPyramid(const int3 & position, std::shared_ptr<const ObjectTemplate> objTempl);
CGObjectInstance * readBorderGuard();
CGObjectInstance * readBorderGate(const int3 & position, std::shared_ptr<const ObjectTemplate> objTempl);