forked from mirror/openmw-tes3mp
[Client] Don't equip already equipped items in local setEquipment()
This avoids the following error when receiving repeated PlayerBaseInfo packets: "Error in frame: Invalid slot, make sure you are not calling RefData::setCount for a container object" Additionally, only re-equip items as the result of a PlayerBaseInfo packet if resetStats is true (because of its side effect of auto-equipping items for the player).
This commit is contained in:
parent
72463cfdb6
commit
9697595857
1 changed files with 8 additions and 3 deletions
|
@ -841,7 +841,10 @@ void LocalPlayer::setCharacter()
|
|||
MWBase::Environment::get().getWorld()->getPlayer().setBirthSign(birthsign);
|
||||
|
||||
if (resetStats)
|
||||
{
|
||||
MWBase::Environment::get().getMechanicsManager()->setPlayerRace(npc.mRace, npc.isMale(), npc.mHead, npc.mHair);
|
||||
setEquipment();
|
||||
}
|
||||
else
|
||||
{
|
||||
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
|
||||
|
@ -855,8 +858,6 @@ void LocalPlayer::setCharacter()
|
|||
MWBase::Environment::get().getMechanicsManager()->playerLoaded();
|
||||
}
|
||||
|
||||
setEquipment();
|
||||
|
||||
MWBase::Environment::get().getWindowManager()->getInventoryWindow()->rebuildAvatar();
|
||||
}
|
||||
else
|
||||
|
@ -1103,7 +1104,11 @@ void LocalPlayer::setEquipment()
|
|||
}
|
||||
}
|
||||
else
|
||||
ptrInventory.equip(slot, it, ptrPlayer);
|
||||
{
|
||||
// Don't try to equip an item that is already equipped
|
||||
if (!ptrInventory.getSlot(slot).isEqual(it))
|
||||
ptrInventory.equip(slot, it, ptrPlayer);
|
||||
}
|
||||
}
|
||||
else
|
||||
ptrInventory.unequipSlot(slot, ptrPlayer);
|
||||
|
|
Loading…
Reference in a new issue