From e419e25e72f157eb767d22d87902bd4f4e683574 Mon Sep 17 00:00:00 2001
From: David Cernat <davidcernat@gmail.com>
Date: Fri, 28 Apr 2017 23:17:23 +0300
Subject: [PATCH] [Client] Don't initialize actors without unique indexes

---
 apps/openmw/mwmp/ActorList.cpp | 6 ++++++
 apps/openmw/mwmp/Cell.cpp      | 6 ++++++
 2 files changed, 12 insertions(+)

diff --git a/apps/openmw/mwmp/ActorList.cpp b/apps/openmw/mwmp/ActorList.cpp
index 28ceb7003..6abfb5b11 100644
--- a/apps/openmw/mwmp/ActorList.cpp
+++ b/apps/openmw/mwmp/ActorList.cpp
@@ -193,6 +193,9 @@ void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
     {
         MWWorld::Ptr ptr(&*listIter, 0);
 
+        // If this Ptr is lacking a unique index, ignore it
+        if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue;
+
         BaseActor actor;
         actor.refId = ptr.getCellRef().getRefId();
         actor.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
@@ -208,6 +211,9 @@ void ActorList::sendActorsInCell(MWWorld::CellStore* cellStore)
     {
         MWWorld::Ptr ptr(&*listIter, 0);
 
+        // If this Ptr is lacking a unique index, ignore it
+        if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue;
+
         BaseActor actor;
         actor.refId = ptr.getCellRef().getRefId();
         actor.refNumIndex = ptr.getCellRef().getRefNum().mIndex;
diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp
index 1dc5a26e0..d95dea727 100644
--- a/apps/openmw/mwmp/Cell.cpp
+++ b/apps/openmw/mwmp/Cell.cpp
@@ -253,6 +253,9 @@ void Cell::initializeLocalActors()
     {
         MWWorld::Ptr ptr(&*listIter, store);
 
+        // If this Ptr is lacking a unique index, ignore it
+        if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue;
+
         initializeLocalActor(ptr);
     }
 
@@ -263,6 +266,9 @@ void Cell::initializeLocalActors()
     {
         MWWorld::Ptr ptr(&*listIter, store);
 
+        // If this Ptr is lacking a unique index, ignore it
+        if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue;
+
         initializeLocalActor(ptr);
     }
 }