[Client] Always create new references for new creature disguises

Previously, attempts to reuse the same reference for multiple creature disguises led to movement animation issues, as well as a dynamic_cast error in Creature::getInventoryStore() that made a DedicatedPlayer vanish completely when they first lost their creature disguise, then disguised themselves as a creature that could not hold weapons and then disguised themselves as a creature that could hold weapons.
fix/skillcap
David Cernat 7 years ago
parent 60bc7447d9
commit f52364e05c

@ -186,10 +186,7 @@ void DedicatedPlayer::setShapeshift()
{
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
{
if (isNpc)
{
deleteReference();
}
deleteReference();
const ESM::Creature *tmpCreature = world->getStore().get<ESM::Creature>().search(creatureRefId);
creature = *tmpCreature;
@ -211,15 +208,8 @@ void DedicatedPlayer::setShapeshift()
RecordHelper::overrideCreatureRecord(creature);
}
if (!reference)
{
LOG_APPEND(Log::LOG_INFO, "- Creating reference for %s", creature.mId.c_str());
createReference(creature.mId);
}
else
{
reloadPtr();
}
LOG_APPEND(Log::LOG_INFO, "- Creating reference for %s", creature.mId.c_str());
createReference(creature.mId);
}
// This player was already a creature, but the new creature refId was empty or
// invalid, so we'll turn this player into their NPC self again as a result

Loading…
Cancel
Save