[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

@ -185,11 +185,8 @@ void DedicatedPlayer::setShapeshift()
if (creatureRefId != previousCreatureRefId || displayCreatureName != previousDisplayCreatureName)
{
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
{
if (isNpc)
{
deleteReference();
}
const ESM::Creature *tmpCreature = world->getStore().get<ESM::Creature>().search(creatureRefId);
creature = *tmpCreature;
@ -211,16 +208,9 @@ 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();
}
}
// 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
else if (!isNpc)

Loading…
Cancel
Save