mirror of
https://github.com/vcmi/vcmi.git
synced 2025-08-10 22:31:40 +02:00
Fix regressions from previous PR
This commit is contained in:
@@ -141,7 +141,7 @@ ArtifactID CArtifactInstance::getTypeId() const
|
|||||||
|
|
||||||
const CArtifact * CArtifactInstance::getType() const
|
const CArtifact * CArtifactInstance::getType() const
|
||||||
{
|
{
|
||||||
return artTypeID.toArtifact();
|
return artTypeID.hasValue() ? artTypeID.toArtifact() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
ArtifactInstanceID CArtifactInstance::getId() const
|
ArtifactInstanceID CArtifactInstance::getId() const
|
||||||
|
@@ -1005,12 +1005,12 @@ CStackBasicDescriptor::CStackBasicDescriptor(const CCreature *c, TQuantity Count
|
|||||||
|
|
||||||
const CCreature * CStackBasicDescriptor::getCreature() const
|
const CCreature * CStackBasicDescriptor::getCreature() const
|
||||||
{
|
{
|
||||||
return typeID.toCreature();
|
return typeID.hasValue() ? typeID.toCreature() : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Creature * CStackBasicDescriptor::getType() const
|
const Creature * CStackBasicDescriptor::getType() const
|
||||||
{
|
{
|
||||||
return typeID.toEntity(VLC);
|
return typeID.hasValue() ? typeID.toEntity(VLC) : nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
CreatureID CStackBasicDescriptor::getId() const
|
CreatureID CStackBasicDescriptor::getId() const
|
||||||
|
@@ -51,9 +51,16 @@ public:
|
|||||||
|
|
||||||
template <typename Handler> void serialize(Handler &h)
|
template <typename Handler> void serialize(Handler &h)
|
||||||
{
|
{
|
||||||
h & typeID;
|
if(h.saving)
|
||||||
if(!h.saving)
|
{
|
||||||
setType(typeID.toCreature());
|
h & typeID;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
CreatureID creatureID;
|
||||||
|
h & creatureID;
|
||||||
|
setType(creatureID.toCreature());
|
||||||
|
}
|
||||||
|
|
||||||
h & count;
|
h & count;
|
||||||
}
|
}
|
||||||
|
@@ -358,7 +358,7 @@ TObjectTypeHandler CGHeroInstance::getObjectHandler() const
|
|||||||
void CGHeroInstance::updateAppearance()
|
void CGHeroInstance::updateAppearance()
|
||||||
{
|
{
|
||||||
auto handler = VLC->objtypeh->getHandlerFor(Obj::HERO, getHeroClass()->getIndex());;
|
auto handler = VLC->objtypeh->getHandlerFor(Obj::HERO, getHeroClass()->getIndex());;
|
||||||
auto terrain = cb->gameState()->getTile(visitablePos())->terType->getId();
|
auto terrain = cb->gameState()->getTile(visitablePos())->getTerrainID();
|
||||||
auto app = handler->getOverride(terrain, this);
|
auto app = handler->getOverride(terrain, this);
|
||||||
if (app)
|
if (app)
|
||||||
appearance = app;
|
appearance = app;
|
||||||
|
Reference in New Issue
Block a user