mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-02 00:10:22 +02:00
Fix initialization of hero type in map editor
This commit is contained in:
parent
115439f16a
commit
e221cdccab
@ -309,7 +309,11 @@ const CHeroClass * CGHeroInstance::getHeroClass() const
|
||||
|
||||
HeroClassID CGHeroInstance::getHeroClassID() const
|
||||
{
|
||||
return getHeroType()->heroClass->getId();
|
||||
auto heroType = getHeroTypeID();
|
||||
if (heroType.hasValue())
|
||||
return getHeroType()->heroClass->getId();
|
||||
else
|
||||
return HeroClassID();
|
||||
}
|
||||
|
||||
const CHero * CGHeroInstance::getHeroType() const
|
||||
|
@ -139,6 +139,18 @@ void Initializer::initialize(CGHeroInstance * o)
|
||||
o->tempOwner = PlayerColor::NEUTRAL;
|
||||
}
|
||||
|
||||
if(o->ID == Obj::HERO)
|
||||
{
|
||||
for(auto const & t : VLC->heroh->objects)
|
||||
{
|
||||
if(t->heroClass->getId() == HeroClassID(o->subID))
|
||||
{
|
||||
o->subID = t->getId();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(o->getHeroTypeID().hasValue())
|
||||
{
|
||||
o->gender = o->getHeroType()->gender;
|
||||
|
Loading…
Reference in New Issue
Block a user