Browse Source

clear land object on delete

UbitUmarov 7 năm trước cách đây
mục cha
commit
156707edfb

+ 2 - 0
OpenSim/Framework/ILandObject.cs

@@ -189,5 +189,7 @@ namespace OpenSim.Framework
         /// </summary>
         /// <returns>The music url.</returns>
         string GetMusicUrl();
+
+        void Clear();
     }
 }

+ 5 - 1
OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs

@@ -274,6 +274,9 @@ namespace OpenSim.Region.CoreModules.World.Land
             //Remove all the land objects in the sim and add a blank, full sim land object set to public
             lock (m_landList)
             {
+                foreach(ILandObject parcel in m_landList.Values)
+                    parcel.Clear();
+
                 m_landList.Clear();
                 m_landUUIDList.Clear();
                 m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1;
@@ -696,6 +699,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                 m_landList.Remove(local_id);
                 if(land.LandData != null)
                     m_landUUIDList.Remove(land.LandData.GlobalID);
+                land.Clear();
             }
 
             m_scene.EventManager.TriggerLandObjectRemoved(land.LandData.GlobalID);
@@ -746,7 +750,7 @@ namespace OpenSim.Region.CoreModules.World.Land
                     }
                 }
             }
-
+            master.LandData.Dwell += slave.LandData.Dwell;
             removeLandObject(slave.LandData.LocalID);
             UpdateLandObject(master.LandData.LocalID, master.LandData);
         }

+ 12 - 0
OpenSim/Region/CoreModules/World/Land/LandObject.cs

@@ -269,6 +269,7 @@ namespace OpenSim.Region.CoreModules.World.Land
         {
             LandData = landData.Copy();
             m_scene = scene;
+            m_scene.EventManager.OnFrame += OnFrame;
             m_dwellModule = m_scene.RequestModuleInterface<IDwellModule>();
         }
 
@@ -296,9 +297,20 @@ namespace OpenSim.Region.CoreModules.World.Land
             
             LandData.IsGroupOwned = is_group_owned;
 
+            if(m_dwellModule == null)
+                LandData.Dwell = 0;
+
             m_scene.EventManager.OnFrame += OnFrame;
         }
 
+        public void Clear()
+        {
+            if(m_scene != null)
+                 m_scene.EventManager.OnFrame -= OnFrame;
+            LandData = null;     
+        }
+
+
         #endregion
 
         #region Member Functions