1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-06-15 00:05:02 +02:00

Fixed duplicated hero check - was used too early, before hero type is

loaded
This commit is contained in:
Ivan Savenko
2024-02-05 21:55:48 +02:00
parent 87059be67b
commit 9e09fe08e1
2 changed files with 15 additions and 22 deletions

View File

@ -1156,6 +1156,21 @@ void CMapLoaderJson::readObjects()
{
return a->getObjTypeIndex() < b->getObjTypeIndex();
});
std::set<HeroTypeID> debugHeroesOnMap;
for (auto const & object : map->objects)
{
if(object->ID != Obj::HERO && object->ID != Obj::PRISON)
continue;
auto * hero = dynamic_cast<const CGHeroInstance *>(object.get());
if (debugHeroesOnMap.count(hero->getHeroType()))
logGlobal->error("Hero is already on the map at %s", hero->visitablePos().toString());
debugHeroesOnMap.insert(hero->getHeroType());
}
}
void CMapLoaderJson::readTranslations()