1
0
mirror of https://github.com/vcmi/vcmi.git synced 2025-11-29 23:07:48 +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

@@ -1114,17 +1114,14 @@ void CCreatureHandler::buildBonusTreeForTiers()
void CCreatureHandler::afterLoadFinalization()
{
ObjectTemplate base = VLC->objtypeh->getHandlerFor(Obj::MONSTER, 0)->getTemplates().front();
for (CCreature * crea : creatures)
{
VLC->objtypeh->createObject(crea->nameSing, JsonNode(), Obj::MONSTER, crea->idNumber.num);
if (!crea->advMapDef.empty())
{
base.animationFile = crea->advMapDef;
base.subid = crea->idNumber;
// 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::MONSTER, crea->idNumber)->addTemplate(base);
JsonNode templ;
templ["animation"].String() = crea->advMapDef;
VLC->objtypeh->getHandlerFor(Obj::MONSTER, crea->idNumber)->addTemplate(templ);
}
}
}