mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-02 22:19:41 +00:00
[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.
This commit is contained in:
parent
60bc7447d9
commit
f52364e05c
1 changed files with 3 additions and 13 deletions
|
@ -185,11 +185,8 @@ void DedicatedPlayer::setShapeshift()
|
||||||
if (creatureRefId != previousCreatureRefId || displayCreatureName != previousDisplayCreatureName)
|
if (creatureRefId != previousCreatureRefId || displayCreatureName != previousDisplayCreatureName)
|
||||||
{
|
{
|
||||||
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
|
if (!creatureRefId.empty() && RecordHelper::doesCreatureExist(creatureRefId))
|
||||||
{
|
|
||||||
if (isNpc)
|
|
||||||
{
|
{
|
||||||
deleteReference();
|
deleteReference();
|
||||||
}
|
|
||||||
|
|
||||||
const ESM::Creature *tmpCreature = world->getStore().get<ESM::Creature>().search(creatureRefId);
|
const ESM::Creature *tmpCreature = world->getStore().get<ESM::Creature>().search(creatureRefId);
|
||||||
creature = *tmpCreature;
|
creature = *tmpCreature;
|
||||||
|
@ -211,16 +208,9 @@ void DedicatedPlayer::setShapeshift()
|
||||||
RecordHelper::overrideCreatureRecord(creature);
|
RecordHelper::overrideCreatureRecord(creature);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reference)
|
|
||||||
{
|
|
||||||
LOG_APPEND(Log::LOG_INFO, "- Creating reference for %s", creature.mId.c_str());
|
LOG_APPEND(Log::LOG_INFO, "- Creating reference for %s", creature.mId.c_str());
|
||||||
createReference(creature.mId);
|
createReference(creature.mId);
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
reloadPtr();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// This player was already a creature, but the new creature refId was empty or
|
// 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
|
// invalid, so we'll turn this player into their NPC self again as a result
|
||||||
else if (!isNpc)
|
else if (!isNpc)
|
||||||
|
|
Loading…
Reference in a new issue