From f7a084c8247fedc188451bd3c0cca97b68f63ac2 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sat, 26 May 2018 08:13:26 +0300 Subject: [PATCH] [Client] Use faster check for whether actors are DedicatedPlayers --- apps/openmw/mwmp/PlayerList.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/openmw/mwmp/PlayerList.cpp b/apps/openmw/mwmp/PlayerList.cpp index 24e392511..e07c16b07 100644 --- a/apps/openmw/mwmp/PlayerList.cpp +++ b/apps/openmw/mwmp/PlayerList.cpp @@ -71,8 +71,10 @@ DedicatedPlayer *PlayerList::getPlayer(const MWWorld::Ptr &ptr) { if (p.second == 0 || p.second->getPtr().mRef == 0) continue; - string refid = ptr.getCellRef().getRefId(); - if (p.second->getPtr().getCellRef().getRefId() == refid) + + string refId = ptr.getCellRef().getRefId(); + + if (p.second->getPtr().getCellRef().getRefId() == refId) return p.second; } return 0; @@ -83,6 +85,10 @@ bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr) if (ptr.mRef == nullptr) return false; + // Players always have 0 as their refNumIndex and mpNum + if (ptr.getCellRef().getRefNum().mIndex != 0 || ptr.getCellRef().getMpNum() != 0) + return false; + return (getPlayer(ptr) != 0); }