public void IncomingLandObjectFromStorage(LandData data) { ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); new_land.LandData = data; new_land.SetLandBitmapFromByteArray(); new_land.SetInfoID(); AddLandObject(new_land); }
/// <summary> /// Resets the sim to the default land object (full sim piece of land owned by the default user) /// </summary> public void ResetSimLandObjects() { //Remove all the land objects in the sim and add a blank, full sim land object set to public lock (m_landList) { m_landList.Clear(); m_lastLandLocalID = ParcelManagementModule.START_LAND_LOCAL_ID; m_landIDList.Initialize(); } ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); fullSimParcel.SetInfoID(); AddLandObject(fullSimParcel); }
/// <summary> /// Resets the sim to the default land object (full sim piece of land owned by the default user) /// </summary> public void ResetSimLandObjects() { //Remove all the land objects in the sim and add a blank, full sim land object set to public lock (m_landList) { m_landList.Clear(); m_lastLandLocalID = ParcelManagementModule.START_LAND_LOCAL_ID; m_landIDList.Initialize(); } ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, m_scene.RegionInfo.RegionSizeX, m_scene.RegionInfo.RegionSizeY)); if (fullSimParcel.LandData.OwnerID == UUID.Zero) fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; UserAccount account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, fullSimParcel.LandData.OwnerID); while (fullSimParcel.LandData.OwnerID == UUID.Zero || account == null) { m_log.Warn("[ParcelManagement]: Could not find user for parcel, please give a valid user to make the owner"); string userName = MainConsole.Instance.CmdPrompt("User Name:", ""); if (userName == "") { m_log.Warn("Put in a valid username."); continue; } account = m_scene.UserAccountService.GetUserAccount(m_scene.RegionInfo.ScopeID, userName); if (account != null) fullSimParcel.LandData.OwnerID = account.PrincipalID; else m_log.Warn("Could not find the user."); } m_log.Info("[ParcelManagement]: No land found for region " + m_scene.RegionInfo.RegionName + ", setting owner to " + fullSimParcel.LandData.OwnerID); fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); fullSimParcel.SetInfoID(); AddLandObject(fullSimParcel); }
public bool PreprocessIncomingLandObjectFromStorage(LandData data) { ILandObject new_land = new LandObject(data.OwnerID, data.IsGroupOwned, m_scene); new_land.LandData = data; new_land.SetInfoID(); if (!new_land.SetLandBitmapFromByteArray()) return false; AddLandObject(new_land, true); return true; }
/// <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.ScopeID, fullSimParcel.LandData.OwnerID); while (fullSimParcel.LandData.OwnerID == UUID.Zero || account == null) { m_log.Warn ("[ParcelManagement]: Could not find user for parcel, please give a valid user to make the owner"); string userName = MainConsole.Instance.CmdPrompt ("User Name:", ""); if (userName == "") { m_log.Warn ("Put in a valid username."); continue; } account = m_scene.UserAccountService.GetUserAccount (m_scene.RegionInfo.ScopeID, userName); if (account != null) fullSimParcel.LandData.OwnerID = account.PrincipalID; else m_log.Warn ("Could not find the user."); } m_log.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.LandData.LocalID); return fullSimParcel; }
public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data, Vector2 parcelOffset) { bool result = true; for (int i = 0; i < data.Count; i++) { if (!PreprocessIncomingLandObjectFromStorage(data[i], parcelOffset)) result = false; } List<ILandObject> newSimDefault = new List<ILandObject>(); if (!result || data.Count == 0)//Force a new base first, then force a merge later if (AllParcels().Count > 0) newSimDefault = AllParcels(); else newSimDefault = new List<ILandObject>(new ILandObject[1]{ResetSimLandObjects()}); for (int i = 0; i < data.Count; i++) { ILandObject new_land = new LandObject(data[i].OwnerID, data[i].IsGroupOwned, m_scene); new_land.LandData = data[i]; 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(); }
public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data, Vector2 parcelOffset) { bool result = true; #if (!ISWIN) foreach (LandData t in data) { if (!PreprocessIncomingLandObjectFromStorage(t, parcelOffset)) { result = false; } } #else foreach (LandData t in data.Where(t => !PreprocessIncomingLandObjectFromStorage(t, parcelOffset))) { result = false; } #endif List<ILandObject> newSimDefault = new List<ILandObject>(); if (!result || data.Count == 0) //Force a new base first, then force a merge later newSimDefault = AllParcels().Count > 0 ? AllParcels() : new List<ILandObject>(new ILandObject[1] {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(); }