public void IncomingLandDataFromOAR (List<LandData> data, bool merge, Vector2 parcelOffset) { if (!merge || data.Count == 0) //Serious fallback ResetSimLandObjects (); foreach (LandData land in data) { int oldRegionSize = (int)Math.Sqrt (land.Bitmap.Length * 8); int offset_x = (int)(parcelOffset.X > 0 ? (parcelOffset.X / 4f) : 0), offset_y = (int)(parcelOffset.Y > 0 ? (parcelOffset.Y / 4f) : 0), i = 0, bitNum = 0; byte tempByte; lock (m_landListLock) { //Update the localID land.LocalID = ++m_lastLandLocalID; } int x = 0, y = 0; for (i = 0; i < land.Bitmap.Length; i++) { tempByte = land.Bitmap [i]; for (bitNum = 0; bitNum < 8; bitNum++) { bool bit = Convert.ToBoolean (Convert.ToByte (tempByte >> bitNum) & 1); if (bit) m_landIDList [offset_x + x, offset_y + y] = land.LocalID; x++; if (x > oldRegionSize - 1) { x = 0; y++; } } } // verify that the owner exists UserAccount account = m_scene.UserAccountService.GetUserAccount (m_scene.RegionInfo.AllScopeIDs, land.OwnerID); if (account == null) { // incomming owner is invalid so re-assign land.OwnerID = (UUID)Constants.RealEstateOwnerUUID; land.IsGroupOwned = false; } ILandObject new_land = new LandObject (land.OwnerID, land.IsGroupOwned, m_scene); new_land.LandData = land; new_land.ForceUpdateLandInfo (); lock (m_landListLock) { m_lastLandLocalID -= 1; } AddLandObject (new_land); } UpdateAllParcelBitmaps (); }
public void EventManagerOnIncomingLandDataFromStorage (List<LandData> data, Vector2 parcelOffset) { bool result = data.All (t => PreprocessIncomingLandObjectFromStorage (t, parcelOffset)); if (!result || data.Count == 0) //Force a new base first, then force a merge later ResetSimLandObjects (); foreach (LandData t in data) { ILandObject new_land = new LandObject (t.OwnerID, t.IsGroupOwned, m_scene); new_land.LandData = t; if (SetLandBitmapFromByteArray (new_land, !result, parcelOffset)) //Merge it into the large parcel if possible { new_land.ForceUpdateLandInfo (); AddLandObject (new_land, true); } } if (AllParcels ().Count == 0) //Serious fallback ResetSimLandObjects (); }