diff options
author | BlueWall | 2011-02-09 14:45:40 -0500 |
---|---|---|
committer | BlueWall | 2011-02-09 14:45:40 -0500 |
commit | 0f736e5601a738b4da435b392774ba211647da9c (patch) | |
tree | edb1f9d90c01841eea86b2ce0b2fbf410dc416ee /OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |
parent | Merge branch 'master' of /home/opensim/src/OpenSim/Core (diff) | |
parent | Flash out the prim count module (diff) | |
download | opensim-SC_OLD-0f736e5601a738b4da435b392774ba211647da9c.zip opensim-SC_OLD-0f736e5601a738b4da435b392774ba211647da9c.tar.gz opensim-SC_OLD-0f736e5601a738b4da435b392774ba211647da9c.tar.bz2 opensim-SC_OLD-0f736e5601a738b4da435b392774ba211647da9c.tar.xz |
Merge branch 'master' of /home/opensim/src/OpenSim/Core
Diffstat (limited to '')
-rw-r--r-- | OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | 92 |
1 files changed, 66 insertions, 26 deletions
diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 70767f7..98ba8c3 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs | |||
@@ -298,13 +298,19 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
298 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; | 298 | m_lastLandLocalID = LandChannel.START_LAND_LOCAL_ID - 1; |
299 | m_landIDList.Initialize(); | 299 | m_landIDList.Initialize(); |
300 | } | 300 | } |
301 | 301 | } | |
302 | |||
303 | /// <summary> | ||
304 | /// Create a default parcel that spans the entire region and is owned by the estate owner. | ||
305 | /// </summary> | ||
306 | /// <returns>The parcel created.</returns> | ||
307 | protected ILandObject CreateDefaultParcel() | ||
308 | { | ||
302 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); | 309 | ILandObject fullSimParcel = new LandObject(UUID.Zero, false, m_scene); |
303 | |||
304 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); | 310 | fullSimParcel.SetLandBitmap(fullSimParcel.GetSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize)); |
305 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; | 311 | fullSimParcel.LandData.OwnerID = m_scene.RegionInfo.EstateSettings.EstateOwner; |
306 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); | 312 | fullSimParcel.LandData.ClaimDate = Util.UnixTimeSinceEpoch(); |
307 | AddLandObject(fullSimParcel); | 313 | return AddLandObject(fullSimParcel); |
308 | } | 314 | } |
309 | 315 | ||
310 | public List<ILandObject> AllParcels() | 316 | public List<ILandObject> AllParcels() |
@@ -578,15 +584,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
578 | } | 584 | } |
579 | 585 | ||
580 | /// <summary> | 586 | /// <summary> |
581 | /// Creates a basic Parcel object without an owner (a zeroed key) | ||
582 | /// </summary> | ||
583 | /// <returns></returns> | ||
584 | public ILandObject CreateBaseLand() | ||
585 | { | ||
586 | return new LandObject(UUID.Zero, false, m_scene); | ||
587 | } | ||
588 | |||
589 | /// <summary> | ||
590 | /// Adds a land object to the stored list and adds them to the landIDList to what they own | 587 | /// Adds a land object to the stored list and adds them to the landIDList to what they own |
591 | /// </summary> | 588 | /// </summary> |
592 | /// <param name="new_land">The land object being added</param> | 589 | /// <param name="new_land">The land object being added</param> |
@@ -645,6 +642,28 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
645 | m_landList.Remove(local_id); | 642 | m_landList.Remove(local_id); |
646 | } | 643 | } |
647 | } | 644 | } |
645 | |||
646 | /// <summary> | ||
647 | /// Clear the scene of all parcels | ||
648 | /// </summary> | ||
649 | public void Clear(bool setupDefaultParcel) | ||
650 | { | ||
651 | lock (m_landList) | ||
652 | { | ||
653 | foreach (ILandObject lo in m_landList.Values) | ||
654 | { | ||
655 | //m_scene.SimulationDataService.RemoveLandObject(lo.LandData.GlobalID); | ||
656 | m_scene.EventManager.TriggerLandObjectRemoved(lo.LandData.GlobalID); | ||
657 | } | ||
658 | |||
659 | m_landList.Clear(); | ||
660 | } | ||
661 | |||
662 | ResetSimLandObjects(); | ||
663 | |||
664 | if (setupDefaultParcel) | ||
665 | CreateDefaultParcel(); | ||
666 | } | ||
648 | 667 | ||
649 | private void performFinalLandJoin(ILandObject master, ILandObject slave) | 668 | private void performFinalLandJoin(ILandObject master, ILandObject slave) |
650 | { | 669 | { |
@@ -690,7 +709,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
690 | int x; | 709 | int x; |
691 | int y; | 710 | int y; |
692 | 711 | ||
693 | if (x_float > Constants.RegionSize || x_float <= 0 || y_float > Constants.RegionSize || y_float <= 0) | 712 | if (x_float >= Constants.RegionSize || x_float < 0 || y_float >= Constants.RegionSize || y_float < 0) |
694 | return null; | 713 | return null; |
695 | 714 | ||
696 | try | 715 | try |
@@ -732,10 +751,10 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
732 | { | 751 | { |
733 | try | 752 | try |
734 | { | 753 | { |
735 | if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) | 754 | //if (m_landList.ContainsKey(m_landIDList[x / 4, y / 4])) |
736 | return m_landList[m_landIDList[x / 4, y / 4]]; | 755 | return m_landList[m_landIDList[x / 4, y / 4]]; |
737 | else | 756 | //else |
738 | return null; | 757 | // return null; |
739 | } | 758 | } |
740 | catch (IndexOutOfRangeException) | 759 | catch (IndexOutOfRangeException) |
741 | { | 760 | { |
@@ -1311,7 +1330,6 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1311 | } | 1330 | } |
1312 | } | 1331 | } |
1313 | 1332 | ||
1314 | |||
1315 | void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) | 1333 | void ClientOnParcelDeedToGroup(int parcelLocalID, UUID groupID, IClientAPI remote_client) |
1316 | { | 1334 | { |
1317 | ILandObject land; | 1335 | ILandObject land; |
@@ -1327,10 +1345,8 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1327 | { | 1345 | { |
1328 | land.DeedToGroup(groupID); | 1346 | land.DeedToGroup(groupID); |
1329 | } | 1347 | } |
1330 | |||
1331 | } | 1348 | } |
1332 | 1349 | ||
1333 | |||
1334 | #region Land Object From Storage Functions | 1350 | #region Land Object From Storage Functions |
1335 | 1351 | ||
1336 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) | 1352 | public void EventManagerOnIncomingLandDataFromStorage(List<LandData> data) |
@@ -1365,6 +1381,7 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1365 | public void EventManagerOnNoLandDataFromStorage() | 1381 | public void EventManagerOnNoLandDataFromStorage() |
1366 | { | 1382 | { |
1367 | ResetSimLandObjects(); | 1383 | ResetSimLandObjects(); |
1384 | CreateDefaultParcel(); | ||
1368 | } | 1385 | } |
1369 | 1386 | ||
1370 | #endregion | 1387 | #endregion |
@@ -1622,14 +1639,36 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1622 | 1639 | ||
1623 | protected void InstallInterfaces() | 1640 | protected void InstallInterfaces() |
1624 | { | 1641 | { |
1625 | Command showCommand = | 1642 | Command clearCommand |
1626 | new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the current region."); | 1643 | = new Command("clear", CommandIntentions.COMMAND_HAZARDOUS, ClearCommand, "Clears all the parcels from the region."); |
1644 | Command showCommand | ||
1645 | = new Command("show", CommandIntentions.COMMAND_STATISTICAL, ShowParcelsCommand, "Shows all parcels on the region."); | ||
1627 | 1646 | ||
1647 | m_commander.RegisterCommand("clear", clearCommand); | ||
1628 | m_commander.RegisterCommand("show", showCommand); | 1648 | m_commander.RegisterCommand("show", showCommand); |
1629 | 1649 | ||
1630 | // Add this to our scene so scripts can call these functions | 1650 | // Add this to our scene so scripts can call these functions |
1631 | m_scene.RegisterModuleCommander(m_commander); | 1651 | m_scene.RegisterModuleCommander(m_commander); |
1632 | } | 1652 | } |
1653 | |||
1654 | protected void ClearCommand(Object[] args) | ||
1655 | { | ||
1656 | string response = MainConsole.Instance.CmdPrompt( | ||
1657 | string.Format( | ||
1658 | "Are you sure that you want to clear all land parcels from {0} (y or n)", | ||
1659 | m_scene.RegionInfo.RegionName), | ||
1660 | "n"); | ||
1661 | |||
1662 | if (response.ToLower() == "y") | ||
1663 | { | ||
1664 | Clear(true); | ||
1665 | MainConsole.Instance.OutputFormat("Cleared all parcels from {0}", m_scene.RegionInfo.RegionName); | ||
1666 | } | ||
1667 | else | ||
1668 | { | ||
1669 | MainConsole.Instance.OutputFormat("Aborting clear of all parcels from {0}", m_scene.RegionInfo.RegionName); | ||
1670 | } | ||
1671 | } | ||
1633 | 1672 | ||
1634 | protected void ShowParcelsCommand(Object[] args) | 1673 | protected void ShowParcelsCommand(Object[] args) |
1635 | { | 1674 | { |
@@ -1637,8 +1676,9 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1637 | 1676 | ||
1638 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); | 1677 | report.AppendFormat("Land information for {0}\n", m_scene.RegionInfo.RegionName); |
1639 | report.AppendFormat( | 1678 | report.AppendFormat( |
1640 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | 1679 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", |
1641 | "Parcel Name", | 1680 | "Parcel Name", |
1681 | "Local ID", | ||
1642 | "Area", | 1682 | "Area", |
1643 | "Starts", | 1683 | "Starts", |
1644 | "Ends", | 1684 | "Ends", |
@@ -1651,12 +1691,12 @@ namespace OpenSim.Region.CoreModules.World.Land | |||
1651 | LandData ld = lo.LandData; | 1691 | LandData ld = lo.LandData; |
1652 | 1692 | ||
1653 | report.AppendFormat( | 1693 | report.AppendFormat( |
1654 | "{0,-20} {1,-9} {2,-18} {3,-18} {4,-20}\n", | 1694 | "{0,-20} {1,-10} {2,-9} {3,-18} {4,-18} {5,-20}\n", |
1655 | ld.Name, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); | 1695 | ld.Name, ld.LocalID, ld.Area, lo.StartPoint, lo.EndPoint, m_userManager.GetUserName(ld.OwnerID)); |
1656 | } | 1696 | } |
1657 | } | 1697 | } |
1658 | 1698 | ||
1659 | MainConsole.Instance.Output(report.ToString()); | 1699 | MainConsole.Instance.Output(report.ToString()); |
1660 | } | 1700 | } |
1661 | } | 1701 | } |
1662 | } \ No newline at end of file | 1702 | } \ No newline at end of file |