Keeps track of a specific piece of land's information
Inheritance: ILandObject
コード例 #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);
        }
コード例 #2
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;
        }
コード例 #3
0
        /// <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);
            // we should always have the estate user
            string ownerName = "";
            if (account != null)
                ownerName = account.Name;

            while (fullSimParcel.LandData.OwnerID == UUID.Zero || account == null) {
                MainConsole.Instance.Warn (
                    "[Land management]: 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 ("A valid username is required.");
                    continue;
                }

                account = m_scene.UserAccountService.GetUserAccount (m_scene.RegionInfo.AllScopeIDs, userName);
                if (account != null) {
                    fullSimParcel.LandData.OwnerID = account.PrincipalID;
                    ownerName = account.Name;
                } else
                    MainConsole.Instance.Warn ("Could not find the user.");
            }


            MainConsole.Instance.InfoFormat ("[Land management]: Setting land owner for region {0} to {1}",
                m_scene.RegionInfo.RegionName,
                ownerName);                 //  was >>   fullSimParcel.LandData.OwnerID);

            fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch ();
            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;
        }
コード例 #4
0
 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);
 }
コード例 #5
0
        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 ();
        }
コード例 #6
0
        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 ();
        }