Esempio n. 1
0
        public ILandObject Copy()
        {
            ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene);

            //Place all new variables here!
            newLand.LandData = LandData.Copy();

            return(newLand);
        }
        public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data, Vector2 parcelOffset)
        {
            bool result = true;
            foreach (LandData t in data.Where(t => !PreprocessIncomingLandObjectFromStorage(t, parcelOffset)))
                result = false;

            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();
                    new_land.SetInfoID();
                    AddLandObject(new_land, true);
                }
            }
            if (AllParcels().Count == 0) //Serious fallback
                ResetSimLandObjects();
        }
        /// <summary>
        ///     Resets the sim to the default land object (full sim piece of land owned by the default user)
        /// </summary>
        public ILandObject ResetSimLandObjects()
        {
            ClearAllParcels();
            ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene);
            if (fullSimParcel.LandData.OwnerID == UUID.Zero)
                fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner;

            UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.AllScopeIDs,
                                                                            fullSimParcel.LandData.OwnerID);

            while (fullSimParcel.LandData.OwnerID == UUID.Zero || account == null)
            {
                MainConsole.Instance.Warn(
                    "[ParcelManagement]: Could not find user for parcel, please give a valid user to make the owner");
                string userName = MainConsole.Instance.Prompt("User Name:", "");
                if (userName == "")
                {
                    MainConsole.Instance.Warn("Put in a valid username.");
                    continue;
                }
                account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.AllScopeIDs, userName);
                if (account != null)
                    fullSimParcel.LandData.OwnerID = account.PrincipalID;
                else
                    MainConsole.Instance.Warn("Could not find the user.");
            }
            MainConsole.Instance.Info("[ParcelManagement]: No land found for region " + m_scene.RegionInfo.RegionName +
                                      ", setting owner to " + fullSimParcel.LandData.OwnerID);
            fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch();
            fullSimParcel.SetInfoID();
            fullSimParcel.LandData.Bitmap =
                new byte[(m_scene.RegionInfo.RegionSizeX/4)*(m_scene.RegionInfo.RegionSizeY/4)/8];
            fullSimParcel = AddLandObject(fullSimParcel);
            ModifyLandBitmapSquare(0, 0,
                                   m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY,
                                   fullSimParcel);
            return fullSimParcel;
        }
 public bool PreprocessIncomingLandObjectFromStorage(LandData data, Vector2 parcelOffset)
 {
     ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene);
     new_land.LandData = data;
     return SetLandBitmapFromByteArray(new_land, false, parcelOffset);
 }
Esempio n. 5
0
        public ILandObject Copy()
        {
            ILandObject newLand = new LandObject(LandData.OwnerID, LandData.IsGroupOwned, m_scene);

            //Place all new variables here!
            newLand.LandData = LandData.Copy();

            return newLand;
        }
 public void IncomingLandDataFromOAR(List<LandData> data, bool merge, Vector2 parcelOffset)
 {
     if (!merge || data.Count == 0) //Serious fallback
         ResetSimLandObjects();
     foreach (LandData t in data)
     {
         int oldRegionSize = (int)Math.Sqrt(t.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
             t.LocalID = ++m_lastLandLocalID;
         }
         int x = 0, y = 0;
         for (i = 0; i < t.Bitmap.Length; i++)
         {
             tempByte = t.Bitmap[i];
             for (bitNum = 0; bitNum < 8; bitNum++)
             {
                 bool bit = Convert.ToBoolean(Convert.ToByte(tempByte >> bitNum) & (byte)1);
                 if (bit)
                     m_landIDList[offset_x + x, offset_y + y] = t.LocalID;
                 x++;
                 if (x > oldRegionSize - 1)
                 {
                     x = 0;
                     y++;
                 }
             }
         }
         ILandObject new_land = new LandObject(t.OwnerID, t.IsGroupOwned, m_scene);
         new_land.LandData = t;
         new_land.ForceUpdateLandInfo();
         lock (m_landListLock)
         {
             m_lastLandLocalID -= 1;
         }
         AddLandObject(new_land);
     }
     UpdateAllParcelBitmaps();
 }