diff options
author | Justin Clarke Casey | 2008-05-25 00:09:08 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2008-05-25 00:09:08 +0000 |
commit | bc92d72828925d8b3df72cf66b003ae73731a352 (patch) | |
tree | cd0c17a61ebf5950d58cf70d6cb3c05af70d28d8 /OpenSim/Region/Environment/Scenes/Scene.cs | |
parent | * Refactor: Collapse some multiple remove object paths (diff) | |
download | opensim-SC_OLD-bc92d72828925d8b3df72cf66b003ae73731a352.zip opensim-SC_OLD-bc92d72828925d8b3df72cf66b003ae73731a352.tar.gz opensim-SC_OLD-bc92d72828925d8b3df72cf66b003ae73731a352.tar.bz2 opensim-SC_OLD-bc92d72828925d8b3df72cf66b003ae73731a352.tar.xz |
* Refactor: Collapses parts of different code paths in scene used when deleting and unlinking an object
Diffstat (limited to 'OpenSim/Region/Environment/Scenes/Scene.cs')
-rw-r--r-- | OpenSim/Region/Environment/Scenes/Scene.cs | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs index e30813c..1e88018 100644 --- a/OpenSim/Region/Environment/Scenes/Scene.cs +++ b/OpenSim/Region/Environment/Scenes/Scene.cs | |||
@@ -1335,7 +1335,7 @@ namespace OpenSim.Region.Environment.Scenes | |||
1335 | public void AddSceneObject(SceneObjectGroup sceneObject) | 1335 | public void AddSceneObject(SceneObjectGroup sceneObject) |
1336 | { | 1336 | { |
1337 | m_innerScene.AddSceneObject(sceneObject); | 1337 | m_innerScene.AddSceneObject(sceneObject); |
1338 | } | 1338 | } |
1339 | 1339 | ||
1340 | /// <summary> | 1340 | /// <summary> |
1341 | /// Delete this object from the scene. | 1341 | /// Delete this object from the scene. |
@@ -1344,21 +1344,20 @@ namespace OpenSim.Region.Environment.Scenes | |||
1344 | public void DeleteSceneObject(SceneObjectGroup group) | 1344 | public void DeleteSceneObject(SceneObjectGroup group) |
1345 | { | 1345 | { |
1346 | SceneObjectPart rootPart = (group).GetChildPart(group.UUID); | 1346 | SceneObjectPart rootPart = (group).GetChildPart(group.UUID); |
1347 | |||
1347 | if (rootPart.PhysActor != null) | 1348 | if (rootPart.PhysActor != null) |
1348 | { | 1349 | { |
1349 | PhysicsScene.RemovePrim(rootPart.PhysActor); | 1350 | PhysicsScene.RemovePrim(rootPart.PhysActor); |
1350 | rootPart.PhysActor = null; | 1351 | rootPart.PhysActor = null; |
1351 | } | 1352 | } |
1352 | 1353 | ||
1353 | m_storageManager.DataStore.RemoveObject(group.UUID, m_regInfo.RegionID); | 1354 | if (UnlinkSceneObject(group.UUID)) |
1354 | group.DeleteGroup(); | ||
1355 | |||
1356 | if (m_innerScene.DeleteSceneObject(group.UUID)) | ||
1357 | { | 1355 | { |
1358 | EventManager.TriggerObjectBeingRemovedFromScene(group); | 1356 | EventManager.TriggerObjectBeingRemovedFromScene(group); |
1359 | EventManager.TriggerParcelPrimCountTainted(); | 1357 | EventManager.TriggerParcelPrimCountTainted(); |
1360 | } | 1358 | } |
1361 | 1359 | ||
1360 | group.DeleteGroup(); | ||
1362 | group.DeleteParts(); | 1361 | group.DeleteParts(); |
1363 | 1362 | ||
1364 | // In case anybody else retains a reference to this group, signal deletion by changing the name | 1363 | // In case anybody else retains a reference to this group, signal deletion by changing the name |
@@ -1368,7 +1367,25 @@ namespace OpenSim.Region.Environment.Scenes | |||
1368 | // conditions where a user deletes an entity while it is being stored. Really, the update | 1367 | // conditions where a user deletes an entity while it is being stored. Really, the update |
1369 | // code needs a redesign. | 1368 | // code needs a redesign. |
1370 | group.Name = null; | 1369 | group.Name = null; |
1371 | } | 1370 | } |
1371 | |||
1372 | /// <summary> | ||
1373 | /// Unlink the given object from the scene. Unlike delete, this just removes the record of the object - the | ||
1374 | /// object itself is not destroyed. | ||
1375 | /// </summary> | ||
1376 | /// <param name="uuid"></param> | ||
1377 | /// <returns>true if the object was in the scene, false if it was not</returns> | ||
1378 | public bool UnlinkSceneObject(LLUUID uuid) | ||
1379 | { | ||
1380 | if (m_innerScene.DeleteSceneObject(uuid)) | ||
1381 | { | ||
1382 | m_storageManager.DataStore.RemoveObject(uuid, m_regInfo.RegionID); | ||
1383 | |||
1384 | return true; | ||
1385 | } | ||
1386 | |||
1387 | return false; | ||
1388 | } | ||
1372 | 1389 | ||
1373 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) | 1390 | public void LoadPrimsFromXml(string fileName, bool newIdsFlag, LLVector3 loadOffset) |
1374 | { | 1391 | { |
@@ -1971,23 +1988,6 @@ namespace OpenSim.Region.Environment.Scenes | |||
1971 | 1988 | ||
1972 | #region Entities | 1989 | #region Entities |
1973 | 1990 | ||
1974 | /// <summary> | ||
1975 | /// | ||
1976 | /// </summary> | ||
1977 | /// <param name="entID"></param> | ||
1978 | /// <returns></returns> | ||
1979 | public bool DeleteEntity(LLUUID entID) | ||
1980 | { | ||
1981 | if (Entities.ContainsKey(entID)) | ||
1982 | { | ||
1983 | Entities.Remove(entID); | ||
1984 | m_storageManager.DataStore.RemoveObject(entID, m_regInfo.RegionID); | ||
1985 | m_innerScene.RemoveAPrimCount(); | ||
1986 | return true; | ||
1987 | } | ||
1988 | return false; | ||
1989 | } | ||
1990 | |||
1991 | public void SendKillObject(uint localID) | 1991 | public void SendKillObject(uint localID) |
1992 | { | 1992 | { |
1993 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); | 1993 | Broadcast(delegate(IClientAPI client) { client.SendKillObject(m_regionHandle, localID); }); |