1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-25 22:42:04 +02:00

Bugfixing, game can finally load to main menu without crash

This commit is contained in:
Ivan Savenko
2014-06-04 11:25:13 +03:00
parent 32b6568b65
commit 7e057b6df8
8 changed files with 68 additions and 45 deletions

View File

@@ -231,15 +231,15 @@ void CHeroClassHandler::afterLoadFinalization()
}
}
ObjectTemplate base = VLC->objtypeh->getHandlerFor(Obj::HERO, 0)->getTemplates().front();
for (CHeroClass * hc : heroClasses)
{
base.animationFile = hc->imageMapMale;
base.subid = hc->id;
// replace existing (if any) and add new template.
// Necessary for objects added via mods that don't have any templates in H3
VLC->objtypeh->getHandlerFor(Obj::HERO, base.subid)->addTemplate(base);
VLC->objtypeh->createObject(hc->identifier, JsonNode(), Obj::HERO, hc->id);
if (!hc->imageMapMale.empty())
{
JsonNode templ;
templ["animation"].String() = hc->imageMapMale;
VLC->objtypeh->getHandlerFor(Obj::HERO, hc->id)->addTemplate(templ);
}
}
}