mirror of
https://github.com/vcmi/vcmi.git
synced 2025-01-20 03:29:32 +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
|
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
|
const CHero * CGHeroInstance::getHeroType() const
|
||||||
|
@ -139,6 +139,18 @@ void Initializer::initialize(CGHeroInstance * o)
|
|||||||
o->tempOwner = PlayerColor::NEUTRAL;
|
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())
|
if(o->getHeroTypeID().hasValue())
|
||||||
{
|
{
|
||||||
o->gender = o->getHeroType()->gender;
|
o->gender = o->getHeroType()->gender;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user