protected ILandObject AddLandObject(ILandObject land, bool incomingFromDatabase) { //Don't make a copy unless necessary ILandObject new_land = incomingFromDatabase ? land : land.Copy(); new_land.LandData.RegionID = m_scene.RegionInfo.RegionID; new_land.LandData.RegionHandle = m_scene.RegionInfo.RegionHandle; lock (m_landListLock) { //Update the localID int newLandLocalID = ++m_lastLandLocalID; new_land.LandData.LocalID = newLandLocalID; //Add it to the list of land in this region m_landList.Add(newLandLocalID, new_land); } new_land.ForceUpdateLandInfo(); //If it isn't coming in from the database, make sure to save the new parcel and add it to search if (!incomingFromDatabase) { AddLandObjectToSearch(new_land); } //Trigger the event for any interested listeners m_scene.EventManager.TriggerLandObjectAdded(new_land.LandData); return new_land; }
/// <summary> /// Adds a land object to the stored list and adds them to the landIDList to what they own /// </summary> /// <param name="new_land">The land object being added</param> public ILandObject AddLandObject(ILandObject land) { ILandObject new_land = land.Copy(); // Only now can we add the prim counts to the land object - we rely on the global ID which is generated // as a random UUID inside LandData initialization if (m_primCountModule != null) new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); lock (m_landList) { int newLandLocalID = ++m_lastLandLocalID; new_land.LandData.LocalID = newLandLocalID; bool[,] landBitmap = new_land.GetLandBitmap(); for (int x = 0; x < landArrayMax; x++) { for (int y = 0; y < landArrayMax; y++) { if (landBitmap[x, y]) { // m_log.DebugFormat( // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); m_landIDList[x, y] = newLandLocalID; } } } m_landList.Add(newLandLocalID, new_land); } new_land.ForceUpdateLandInfo(); m_scene.EventManager.TriggerLandObjectAdded(new_land); return new_land; }
/// <summary> /// Adds a land object to the stored list and adds them to the landIDList to what they own /// </summary> /// <param name="new_land"> /// The land object being added. /// Will return null if this overlaps with an existing parcel that has not had its bitmap adjusted. /// </param> public ILandObject AddLandObject(ILandObject land) { ILandObject new_land = land.Copy(); // Only now can we add the prim counts to the land object - we rely on the global ID which is generated // as a random UUID inside LandData initialization if (m_primCountModule != null) new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); lock (m_landList) { int newLandLocalID = m_lastLandLocalID + 1; new_land.LandData.LocalID = newLandLocalID; bool[,] landBitmap = new_land.GetLandBitmap(); // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}", // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID); if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) { // Going to variable sized regions can cause mismatches m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) ); } else { // If other land objects still believe that they occupy any parts of the same space, // then do not allow the add to proceed. for (int x = 0; x < landBitmap.GetLength(0); x++) { for (int y = 0; y < landBitmap.GetLength(1); y++) { if (landBitmap[x, y]) { int lastRecordedLandId = m_landIDList[x, y]; if (lastRecordedLandId > 0) { ILandObject lastRecordedLo = m_landList[lastRecordedLandId]; if (lastRecordedLo.LandBitmap[x, y]) { m_log.ErrorFormat( "{0}: Cannot add parcel \"{1}\", local ID {2} at tile {3},{4} because this is still occupied by parcel \"{5}\", local ID {6} in {7}", LogHeader, new_land.LandData.Name, new_land.LandData.LocalID, x, y, lastRecordedLo.LandData.Name, lastRecordedLo.LandData.LocalID, m_scene.Name); return null; } } } } } for (int x = 0; x < landBitmap.GetLength(0); x++) { for (int y = 0; y < landBitmap.GetLength(1); y++) { if (landBitmap[x, y]) { // m_log.DebugFormat( // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); m_landIDList[x, y] = newLandLocalID; } } } } m_landList.Add(newLandLocalID, new_land); m_lastLandLocalID++; } new_land.ForceUpdateLandInfo(); m_scene.EventManager.TriggerLandObjectAdded(new_land); return new_land; }
/// <summary> /// Adds a land object to the stored list and adds them to the landIDList to what they own /// </summary> /// <param name="new_land">The land object being added</param> public ILandObject AddLandObject(ILandObject land) { ILandObject new_land = land.Copy(); lock (m_landList) { int newLandLocalID = ++m_lastLandLocalID; new_land.LandData.LocalID = newLandLocalID; bool[,] landBitmap = new_land.GetLandBitmap(); for (int x = 0; x < landArrayMax; x++) { for (int y = 0; y < landArrayMax; y++) { if (landBitmap[x, y]) { m_landIDList[x, y] = newLandLocalID; } } } m_landList.Add(newLandLocalID, new_land); } new_land.ForceUpdateLandInfo(); m_scene.EventManager.TriggerLandObjectAdded(new_land.LandData); return new_land; }
protected ILandObject AddLandObject(ILandObject land, bool incomingFromDatabase) { //Don't make a copy unless necessary ILandObject new_land = incomingFromDatabase ? land : land.Copy(); lock (m_landList) { //Update the localID int newLandLocalID = ++m_lastLandLocalID; new_land.LandData.LocalID = newLandLocalID; //Add this parcels area to the region wide area tracker bool[,] landBitmap = new_land.GetLandBitmap(); for (int x = 0; x < m_scene.RegionInfo.RegionSizeX / 4; x++) { for (int y = 0; y < m_scene.RegionInfo.RegionSizeY / 4; y++) { if (landBitmap[x, y]) { m_landIDList[x, y] = newLandLocalID; } } } //Add it to the list of land in this region m_landList.Add(newLandLocalID, new_land); } new_land.ForceUpdateLandInfo(); //If it isn't coming in from the database, make sure to save the new parcel and add it to search if (!incomingFromDatabase) { AddLandObjectToSearch(new_land.LandData); IParcelServiceConnector conn = Aurora.DataManager.DataManager.RequestPlugin<IParcelServiceConnector>(); if (conn != null) conn.StoreLandObject(new_land.LandData); } //Trigger the event for any interested listeners m_scene.EventManager.TriggerLandObjectAdded(new_land.LandData); return new_land; }
/// <summary> /// Adds a land object to the stored list and adds them to the landIDList to what they own /// </summary> /// <param name="new_land">The land object being added</param> public ILandObject AddLandObject(ILandObject land) { ILandObject new_land = land.Copy(); // Only now can we add the prim counts to the land object - we rely on the global ID which is generated // as a random UUID inside LandData initialization if (m_primCountModule != null) new_land.PrimCounts = m_primCountModule.GetPrimCounts(new_land.LandData.GlobalID); lock (m_landList) { int newLandLocalID = ++m_lastLandLocalID; new_land.LandData.LocalID = newLandLocalID; bool[,] landBitmap = new_land.GetLandBitmap(); // m_log.DebugFormat("{0} AddLandObject. new_land.bitmapSize=({1},{2}). newLocalID={3}", // LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), newLandLocalID); if (landBitmap.GetLength(0) != m_landIDList.GetLength(0) || landBitmap.GetLength(1) != m_landIDList.GetLength(1)) { // Going to variable sized regions can cause mismatches m_log.ErrorFormat("{0} AddLandObject. Added land bitmap different size than region ID map. bitmapSize=({1},{2}), landIDSize=({3},{4})", LogHeader, landBitmap.GetLength(0), landBitmap.GetLength(1), m_landIDList.GetLength(0), m_landIDList.GetLength(1) ); } else { for (int x = 0; x < landBitmap.GetLength(0); x++) { for (int y = 0; y < landBitmap.GetLength(1); y++) { if (landBitmap[x, y]) { // m_log.DebugFormat( // "[LAND MANAGEMENT MODULE]: Registering parcel {0} for land co-ord ({1}, {2}) on {3}", // new_land.LandData.Name, x, y, m_scene.RegionInfo.RegionName); m_landIDList[x, y] = newLandLocalID; } } } } m_landList.Add(newLandLocalID, new_land); } new_land.ForceUpdateLandInfo(); m_scene.EventManager.TriggerLandObjectAdded(new_land); return new_land; }