1
0

RegionCombinerLargeLandChannel.cs 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. /*
  2. * Copyright (c) Contributors, http://opensimulator.org/
  3. * See CONTRIBUTORS.TXT for a full list of copyright holders.
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions are met:
  7. * * Redistributions of source code must retain the above copyright
  8. * notice, this list of conditions and the following disclaimer.
  9. * * Redistributions in binary form must reproduce the above copyright
  10. * notice, this list of conditions and the following disclaimer in the
  11. * documentation and/or other materials provided with the distribution.
  12. * * Neither the name of the OpenSimulator Project nor the
  13. * names of its contributors may be used to endorse or promote products
  14. * derived from this software without specific prior written permission.
  15. *
  16. * THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY
  17. * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
  18. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  19. * DISCLAIMED. IN NO EVENT SHALL THE CONTRIBUTORS BE LIABLE FOR ANY
  20. * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
  21. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
  22. * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  23. * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  24. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
  25. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  26. */
  27. using System;
  28. using System.Collections.Generic;
  29. using OpenMetaverse;
  30. using OpenSim.Framework;
  31. using OpenSim.Region.Framework.Interfaces;
  32. using OpenSim.Region.CoreModules.World.Land;
  33. namespace OpenSim.Region.RegionCombinerModule
  34. {
  35. public class RegionCombinerLargeLandChannel : ILandChannel
  36. {
  37. // private static readonly ILog m_log =
  38. // LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
  39. private RegionData RegData;
  40. private ILandChannel RootRegionLandChannel;
  41. private readonly List<RegionData> RegionConnections;
  42. #region ILandChannel Members
  43. public RegionCombinerLargeLandChannel(RegionData regData, ILandChannel rootRegionLandChannel,
  44. List<RegionData> regionConnections)
  45. {
  46. RegData = regData;
  47. RootRegionLandChannel = rootRegionLandChannel;
  48. RegionConnections = regionConnections;
  49. }
  50. public List<ILandObject> ParcelsNearPoint(Vector3 position)
  51. {
  52. //m_log.DebugFormat("[LANDPARCELNEARPOINT]: {0}>", position);
  53. return RootRegionLandChannel.ParcelsNearPoint(position - RegData.Offset);
  54. }
  55. public List<ILandObject> AllParcels()
  56. {
  57. return RootRegionLandChannel.AllParcels();
  58. }
  59. public void Clear(bool setupDefaultParcel)
  60. {
  61. RootRegionLandChannel.Clear(setupDefaultParcel);
  62. }
  63. public ILandObject GetLandObject(int x, int y)
  64. {
  65. //m_log.DebugFormat("[BIGLANDTESTINT]: <{0},{1}>", x, y);
  66. if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
  67. {
  68. return RootRegionLandChannel.GetLandObject(x, y);
  69. }
  70. else
  71. {
  72. int offsetX = (x / (int)Constants.RegionSize);
  73. int offsetY = (y / (int)Constants.RegionSize);
  74. offsetX *= (int)Constants.RegionSize;
  75. offsetY *= (int)Constants.RegionSize;
  76. foreach (RegionData regionData in RegionConnections)
  77. {
  78. if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
  79. {
  80. return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
  81. }
  82. }
  83. ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
  84. obj.LandData.Name = "NO LAND";
  85. return obj;
  86. }
  87. }
  88. public ILandObject GetLandObject(int localID)
  89. {
  90. return RootRegionLandChannel.GetLandObject(localID);
  91. }
  92. public ILandObject GetLandObject(float x, float y)
  93. {
  94. //m_log.DebugFormat("[BIGLANDTESTFLOAT]: <{0},{1}>", x, y);
  95. if (x > 0 && x <= (int)Constants.RegionSize && y > 0 && y <= (int)Constants.RegionSize)
  96. {
  97. return RootRegionLandChannel.GetLandObject(x, y);
  98. }
  99. else
  100. {
  101. int offsetX = (int)(x/(int) Constants.RegionSize);
  102. int offsetY = (int)(y/(int) Constants.RegionSize);
  103. offsetX *= (int) Constants.RegionSize;
  104. offsetY *= (int) Constants.RegionSize;
  105. foreach (RegionData regionData in RegionConnections)
  106. {
  107. if (regionData.Offset.X == offsetX && regionData.Offset.Y == offsetY)
  108. {
  109. return regionData.RegionScene.LandChannel.GetLandObject(x - offsetX, y - offsetY);
  110. }
  111. }
  112. ILandObject obj = new LandObject(UUID.Zero, false, RegData.RegionScene);
  113. obj.LandData.Name = "NO LAND";
  114. return obj;
  115. }
  116. }
  117. public bool IsForcefulBansAllowed()
  118. {
  119. return RootRegionLandChannel.IsForcefulBansAllowed();
  120. }
  121. public void UpdateLandObject(int localID, LandData data)
  122. {
  123. RootRegionLandChannel.UpdateLandObject(localID, data);
  124. }
  125. public void Join(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
  126. {
  127. RootRegionLandChannel.Join(start_x, start_y, end_x, end_y, attempting_user_id);
  128. }
  129. public void Subdivide(int start_x, int start_y, int end_x, int end_y, UUID attempting_user_id)
  130. {
  131. RootRegionLandChannel.Subdivide(start_x, start_y, end_x, end_y, attempting_user_id);
  132. }
  133. public void ReturnObjectsInParcel(int localID, uint returnType, UUID[] agentIDs, UUID[] taskIDs, IClientAPI remoteClient)
  134. {
  135. RootRegionLandChannel.ReturnObjectsInParcel(localID, returnType, agentIDs, taskIDs, remoteClient);
  136. }
  137. public void setParcelObjectMaxOverride(overrideParcelMaxPrimCountDelegate overrideDel)
  138. {
  139. RootRegionLandChannel.setParcelObjectMaxOverride(overrideDel);
  140. }
  141. public void setSimulatorObjectMaxOverride(overrideSimulatorMaxPrimCountDelegate overrideDel)
  142. {
  143. RootRegionLandChannel.setSimulatorObjectMaxOverride(overrideDel);
  144. }
  145. public void SetParcelOtherCleanTime(IClientAPI remoteClient, int localID, int otherCleanTime)
  146. {
  147. RootRegionLandChannel.SetParcelOtherCleanTime(remoteClient, localID, otherCleanTime);
  148. }
  149. #endregion
  150. }
  151. }