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:
@ -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()
|
||||
|
Reference in New Issue
Block a user