mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:53:51 +00:00
[Client] Prevent invalid race used by other player from freezing client
This commit is contained in:
parent
4110fac629
commit
02487dce13
1 changed files with 6 additions and 2 deletions
|
@ -53,7 +53,7 @@ MWWorld::Ptr DedicatedPlayer::getPtr()
|
|||
|
||||
void Players::createPlayer(RakNet::RakNetGUID guid)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "%s", "- Setting up character info");
|
||||
LOG_APPEND(Log::LOG_INFO, "- Setting up character info");
|
||||
|
||||
MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
MWWorld::Ptr player = world->getPlayerPtr();
|
||||
|
@ -61,7 +61,11 @@ void Players::createPlayer(RakNet::RakNetGUID guid)
|
|||
ESM::NPC npc = *player.get<ESM::NPC>()->mBase;
|
||||
DedicatedPlayer *dedicPlayer = players[guid];
|
||||
|
||||
npc.mRace = dedicPlayer->npc.mRace;
|
||||
// To avoid freezes caused by invalid races, only set race if we find it
|
||||
// on our client
|
||||
if (world->getStore().get<ESM::Race>().search(dedicPlayer->npc.mRace) != 0)
|
||||
npc.mRace = dedicPlayer->npc.mRace;
|
||||
|
||||
npc.mHead = dedicPlayer->npc.mHead;
|
||||
npc.mHair = dedicPlayer->npc.mHair;
|
||||
npc.mClass = dedicPlayer->npc.mClass;
|
||||
|
|
Loading…
Reference in a new issue