1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

Merge pull request #1533 from IvanSavenko/mapeditor_fix_heroes

Fix assignment of hero type on object creation
This commit is contained in:
Ivan Savenko 2023-02-01 12:25:17 +02:00 committed by GitHub
commit 552b5bc458
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -109,7 +109,8 @@ void Initializer::initialize(CGLighthouse * o)
void Initializer::initialize(CGHeroInstance * o)
{
if(!o) return;
if(!o)
return;
o->tempOwner = defaultPlayer;
if(o->ID == Obj::PRISON)
@ -119,9 +120,9 @@ void Initializer::initialize(CGHeroInstance * o)
{
for(auto t : VLC->heroh->objects)
{
if(t->heroClass == VLC->heroh->classes.objects[o->subID].get())
if(t->heroClass->getId() == HeroClassID(o->subID))
{
o->type = VLC->heroh->objects[o->subID];
o->type = t;
break;
}
}