@@ -164,21 +164,14 @@ U64 LLViewerObjectList::getIndex(const U32 local_id,
164
164
return (((U64)index) << 32 ) | (U64)local_id;
165
165
}
166
166
167
- bool LLViewerObjectList::removeFromLocalIDTable (const LLViewerObject* objectp)
167
+ bool LLViewerObjectList::removeFromLocalIDTable (LLViewerObject* objectp)
168
168
{
169
169
LL_PROFILE_ZONE_SCOPED_CATEGORY_NETWORK;
170
170
171
- if (objectp && objectp->getRegion () )
171
+ if (objectp && objectp->mRegionIndex != 0 )
172
172
{
173
173
U32 local_id = objectp->mLocalID ;
174
- U32 ip = objectp->getRegion ()->getHost ().getAddress ();
175
- U32 port = objectp->getRegion ()->getHost ().getPort ();
176
- U64 ipport = (((U64)ip) << 32 ) | (U64)port;
177
- U32 index = mIPAndPortToIndex [ipport];
178
-
179
- // LL_INFOS() << "Removing object from table, local ID " << local_id << ", ip " << ip << ":" << port << LL_ENDL;
180
-
181
- U64 indexid = (((U64)index) << 32 ) | (U64)local_id;
174
+ U64 indexid = (((U64)objectp->mRegionIndex ) << 32 ) | (U64)local_id;
182
175
183
176
std::map<U64, LLUUID>::iterator iter = mIndexAndLocalIDToUUID .find (indexid);
184
177
if (iter == mIndexAndLocalIDToUUID .end ())
@@ -190,6 +183,7 @@ bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp)
190
183
if (iter->second == objectp->getID ())
191
184
{ // Full UUIDs match, so remove the entry
192
185
mIndexAndLocalIDToUUID .erase (iter);
186
+ objectp->mRegionIndex = 0 ;
193
187
return true ;
194
188
}
195
189
// UUIDs did not match - this would zap a valid entry, so don't erase it
@@ -203,7 +197,8 @@ bool LLViewerObjectList::removeFromLocalIDTable(const LLViewerObject* objectp)
203
197
void LLViewerObjectList::setUUIDAndLocal (const LLUUID &id,
204
198
const U32 local_id,
205
199
const U32 ip,
206
- const U32 port)
200
+ const U32 port,
201
+ LLViewerObject* objectp)
207
202
{
208
203
U64 ipport = (((U64)ip) << 32 ) | (U64)port;
209
204
@@ -215,6 +210,7 @@ void LLViewerObjectList::setUUIDAndLocal(const LLUUID &id,
215
210
mIPAndPortToIndex [ipport] = index;
216
211
}
217
212
213
+ objectp->mRegionIndex = index; // should never be zero, sSimulatorMachineIndex starts from 1
218
214
U64 indexid = (((U64)index) << 32 ) | (U64)local_id;
219
215
220
216
mIndexAndLocalIDToUUID [indexid] = id;
@@ -335,7 +331,8 @@ LLViewerObject* LLViewerObjectList::processObjectUpdateFromCache(LLVOCacheEntry*
335
331
removeFromLocalIDTable (objectp);
336
332
setUUIDAndLocal (fullid, entry->getLocalID (),
337
333
regionp->getHost ().getAddress (),
338
- regionp->getHost ().getPort ());
334
+ regionp->getHost ().getPort (),
335
+ objectp);
339
336
340
337
if (objectp->mLocalID != entry->getLocalID ())
341
338
{ // Update local ID in object with the one sent from the region
@@ -582,7 +579,8 @@ void LLViewerObjectList::processObjectUpdate(LLMessageSystem *mesgsys,
582
579
setUUIDAndLocal (fullid,
583
580
local_id,
584
581
gMessageSystem ->getSenderIP (),
585
- gMessageSystem ->getSenderPort ());
582
+ gMessageSystem ->getSenderPort (),
583
+ objectp);
586
584
587
585
if (objectp->mLocalID != local_id)
588
586
{ // Update local ID in object with the one sent from the region
@@ -1309,10 +1307,7 @@ void LLViewerObjectList::cleanupReferences(LLViewerObject *objectp)
1309
1307
// << objectp->getRegion()->getHost().getPort() << LL_ENDL;
1310
1308
// }
1311
1309
1312
- if (!mIndexAndLocalIDToUUID .empty ())
1313
- {
1314
- removeFromLocalIDTable (objectp);
1315
- }
1310
+ removeFromLocalIDTable (objectp);
1316
1311
1317
1312
if (objectp->onActiveList ())
1318
1313
{
@@ -1396,6 +1391,7 @@ void LLViewerObjectList::killAllObjects()
1396
1391
objectp = *iter;
1397
1392
objectp->setOnActiveList (false );
1398
1393
objectp->setListIndex (-1 );
1394
+ objectp->mRegionIndex = 0 ;
1399
1395
objectp->mOnMap = false ;
1400
1396
killObject (objectp);
1401
1397
// Object must be dead, or it's the LLVOAvatarSelf which never dies.
@@ -1508,9 +1504,9 @@ void LLViewerObjectList::updateActive(LLViewerObject *objectp)
1508
1504
mActiveObjects .push_back (objectp);
1509
1505
objectp->setListIndex (static_cast <S32>(mActiveObjects .size ()) - 1 );
1510
1506
objectp->setOnActiveList (true );
1511
- }
1512
- else
1513
- {
1507
+ }
1508
+ else
1509
+ {
1514
1510
llassert (idx < mActiveObjects .size ());
1515
1511
llassert (mActiveObjects [idx] == objectp);
1516
1512
@@ -1862,7 +1858,8 @@ LLViewerObject *LLViewerObjectList::createObjectFromCache(const LLPCode pcode, L
1862
1858
setUUIDAndLocal (uuid,
1863
1859
local_id,
1864
1860
regionp->getHost ().getAddress (),
1865
- regionp->getHost ().getPort ());
1861
+ regionp->getHost ().getPort (),
1862
+ objectp);
1866
1863
mObjects .push_back (objectp);
1867
1864
1868
1865
updateActive (objectp);
@@ -1900,7 +1897,8 @@ LLViewerObject *LLViewerObjectList::createObject(const LLPCode pcode, LLViewerRe
1900
1897
setUUIDAndLocal (fullid,
1901
1898
local_id,
1902
1899
gMessageSystem ->getSenderIP (),
1903
- gMessageSystem ->getSenderPort ());
1900
+ gMessageSystem ->getSenderPort (),
1901
+ objectp);
1904
1902
1905
1903
mObjects .push_back (objectp);
1906
1904
0 commit comments