[Client] Use faster check for whether actors are DedicatedPlayers

0.6.3
David Cernat 7 years ago
parent c8ec77875c
commit f7a084c824

@ -71,8 +71,10 @@ DedicatedPlayer *PlayerList::getPlayer(const MWWorld::Ptr &ptr)
{ {
if (p.second == 0 || p.second->getPtr().mRef == 0) if (p.second == 0 || p.second->getPtr().mRef == 0)
continue; 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 p.second;
} }
return 0; return 0;
@ -83,6 +85,10 @@ bool PlayerList::isDedicatedPlayer(const MWWorld::Ptr &ptr)
if (ptr.mRef == nullptr) if (ptr.mRef == nullptr)
return false; 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); return (getPlayer(ptr) != 0);
} }

Loading…
Cancel
Save