diff options
author | Justin Clarke Casey | 2009-03-06 20:44:31 +0000 |
---|---|---|
committer | Justin Clarke Casey | 2009-03-06 20:44:31 +0000 |
commit | f12619b78665a6f6b148c870d36b528428cf78b4 (patch) | |
tree | a34dd0b82497fa347cdbe10ee2237dccd6fd5230 /OpenSim | |
parent | * Improve memory usage when writing OARs (diff) | |
download | opensim-SC_OLD-f12619b78665a6f6b148c870d36b528428cf78b4.zip opensim-SC_OLD-f12619b78665a6f6b148c870d36b528428cf78b4.tar.gz opensim-SC_OLD-f12619b78665a6f6b148c870d36b528428cf78b4.tar.bz2 opensim-SC_OLD-f12619b78665a6f6b148c870d36b528428cf78b4.tar.xz |
* refactor: Remove GetLandOwner function from Scene
* Simplify since the land is never null
Diffstat (limited to '')
3 files changed, 34 insertions, 42 deletions
diff --git a/OpenSim/Region/Framework/Scenes/Scene.cs b/OpenSim/Region/Framework/Scenes/Scene.cs index aa0218b..5cb9724 100644 --- a/OpenSim/Region/Framework/Scenes/Scene.cs +++ b/OpenSim/Region/Framework/Scenes/Scene.cs | |||
@@ -3019,19 +3019,6 @@ namespace OpenSim.Region.Framework.Scenes | |||
3019 | m_eventManager.TriggerOnPluginConsole(args); | 3019 | m_eventManager.TriggerOnPluginConsole(args); |
3020 | } | 3020 | } |
3021 | 3021 | ||
3022 | public UUID GetLandOwner(float x, float y) | ||
3023 | { | ||
3024 | ILandObject land = LandChannel.GetLandObject(x, y); | ||
3025 | if (land == null) | ||
3026 | { | ||
3027 | return UUID.Zero; | ||
3028 | } | ||
3029 | else | ||
3030 | { | ||
3031 | return land.landData.OwnerID; | ||
3032 | } | ||
3033 | } | ||
3034 | |||
3035 | public LandData GetLandData(float x, float y) | 3022 | public LandData GetLandData(float x, float y) |
3036 | { | 3023 | { |
3037 | return LandChannel.GetLandObject(x, y).landData; | 3024 | return LandChannel.GetLandObject(x, y).landData; |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index fad456f..517453e 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | |||
@@ -3706,8 +3706,10 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
3706 | ScenePresence presence = World.GetScenePresence(agentId); | 3706 | ScenePresence presence = World.GetScenePresence(agentId); |
3707 | if (presence != null) | 3707 | if (presence != null) |
3708 | { | 3708 | { |
3709 | // agent must be over the owners land | 3709 | // agent must be over the owners land |
3710 | if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) | 3710 | if (m_host.OwnerID |
3711 | == World.LandChannel.GetLandObject( | ||
3712 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | ||
3711 | { | 3713 | { |
3712 | presence.ControllingClient.SendTeleportLocationStart(); | 3714 | presence.ControllingClient.SendTeleportLocationStart(); |
3713 | World.TeleportClientHome(agentId, presence.ControllingClient); | 3715 | World.TeleportClientHome(agentId, presence.ControllingClient); |
@@ -5182,7 +5184,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5182 | if (presence != null) | 5184 | if (presence != null) |
5183 | { | 5185 | { |
5184 | // agent must be over the owners land | 5186 | // agent must be over the owners land |
5185 | if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) | 5187 | if (m_host.OwnerID |
5188 | == World.LandChannel.GetLandObject( | ||
5189 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | ||
5186 | World.TeleportClientHome(agentId, presence.ControllingClient); | 5190 | World.TeleportClientHome(agentId, presence.ControllingClient); |
5187 | } | 5191 | } |
5188 | } | 5192 | } |
@@ -5265,29 +5269,34 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
5265 | { | 5269 | { |
5266 | m_host.AddScriptLPS(1); | 5270 | m_host.AddScriptLPS(1); |
5267 | UUID key = new UUID(); | 5271 | UUID key = new UUID(); |
5268 | if (UUID.TryParse(id,out key)) | 5272 | if (UUID.TryParse(id, out key)) |
5269 | { | 5273 | { |
5270 | ScenePresence presence = World.GetScenePresence(key); | 5274 | ScenePresence presence = World.GetScenePresence(key); |
5271 | if (presence != null) // object is an avatar | 5275 | if (presence != null) // object is an avatar |
5272 | { | 5276 | { |
5273 | if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) | 5277 | if (m_host.OwnerID |
5278 | == World.LandChannel.GetLandObject( | ||
5279 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | ||
5274 | return 1; | 5280 | return 1; |
5275 | } | 5281 | } |
5276 | else // object is not an avatar | 5282 | else // object is not an avatar |
5277 | { | 5283 | { |
5278 | SceneObjectPart obj = World.GetSceneObjectPart(key); | 5284 | SceneObjectPart obj = World.GetSceneObjectPart(key); |
5279 | if (obj != null) | 5285 | if (obj != null) |
5280 | if (m_host.OwnerID == World.GetLandOwner(obj.AbsolutePosition.X, obj.AbsolutePosition.Y)) | 5286 | if (m_host.OwnerID |
5287 | == World.LandChannel.GetLandObject( | ||
5288 | obj.AbsolutePosition.X, obj.AbsolutePosition.Y).landData.OwnerID) | ||
5281 | return 1; | 5289 | return 1; |
5282 | } | 5290 | } |
5283 | } | 5291 | } |
5292 | |||
5284 | return 0; | 5293 | return 0; |
5285 | } | 5294 | } |
5286 | 5295 | ||
5287 | public LSL_String llGetLandOwnerAt(LSL_Vector pos) | 5296 | public LSL_String llGetLandOwnerAt(LSL_Vector pos) |
5288 | { | 5297 | { |
5289 | m_host.AddScriptLPS(1); | 5298 | m_host.AddScriptLPS(1); |
5290 | return World.GetLandOwner((float)pos.x, (float)pos.y).ToString(); | 5299 | return World.LandChannel.GetLandObject((float)pos.x, (float)pos.y).landData.OwnerID.ToString(); |
5291 | } | 5300 | } |
5292 | 5301 | ||
5293 | /// <summary> | 5302 | /// <summary> |
@@ -6812,17 +6821,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
6812 | public void llSetParcelMusicURL(string url) | 6821 | public void llSetParcelMusicURL(string url) |
6813 | { | 6822 | { |
6814 | m_host.AddScriptLPS(1); | 6823 | m_host.AddScriptLPS(1); |
6815 | UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 6824 | |
6816 | if (landowner == UUID.Zero) | 6825 | ILandObject land = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); |
6817 | { | 6826 | |
6818 | return; | 6827 | if (land.landData.OwnerID != m_host.ObjectOwner) |
6819 | } | ||
6820 | if (landowner != m_host.ObjectOwner) | ||
6821 | { | ||
6822 | return; | 6828 | return; |
6823 | } | ||
6824 | 6829 | ||
6825 | World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).SetMusicUrl(url); | 6830 | land.SetMusicUrl(url); |
6826 | 6831 | ||
6827 | // ScriptSleep(2000); | 6832 | // ScriptSleep(2000); |
6828 | } | 6833 | } |
diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index 17732e6..e96dd26 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | |||
@@ -503,12 +503,15 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
503 | if (presence != null) | 503 | if (presence != null) |
504 | { | 504 | { |
505 | // agent must be over owners land to avoid abuse | 505 | // agent must be over owners land to avoid abuse |
506 | if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) | 506 | if (m_host.OwnerID |
507 | == World.LandChannel.GetLandObject( | ||
508 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | ||
507 | { | 509 | { |
508 | presence.ControllingClient.SendTeleportLocationStart(); | 510 | presence.ControllingClient.SendTeleportLocationStart(); |
509 | World.RequestTeleportLocation(presence.ControllingClient, regionName, | 511 | World.RequestTeleportLocation(presence.ControllingClient, regionName, |
510 | new Vector3((float)position.x, (float)position.y, (float)position.z), | 512 | new Vector3((float)position.x, (float)position.y, (float)position.z), |
511 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); | 513 | new Vector3((float)lookat.x, (float)lookat.y, (float)lookat.z), (uint)TPFlags.ViaLocation); |
514 | |||
512 | ScriptSleep(5000); | 515 | ScriptSleep(5000); |
513 | } | 516 | } |
514 | } | 517 | } |
@@ -532,7 +535,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
532 | if (presence != null) | 535 | if (presence != null) |
533 | { | 536 | { |
534 | // agent must be over owners land to avoid abuse | 537 | // agent must be over owners land to avoid abuse |
535 | if (m_host.OwnerID == World.GetLandOwner(presence.AbsolutePosition.X, presence.AbsolutePosition.Y)) | 538 | if (m_host.OwnerID |
539 | == World.LandChannel.GetLandObject( | ||
540 | presence.AbsolutePosition.X, presence.AbsolutePosition.Y).landData.OwnerID) | ||
536 | { | 541 | { |
537 | presence.ControllingClient.SendTeleportLocationStart(); | 542 | presence.ControllingClient.SendTeleportLocationStart(); |
538 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, | 543 | World.RequestTeleportLocation(presence.ControllingClient, regionHandle, |
@@ -777,19 +782,14 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api | |||
777 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); | 782 | CheckThreatLevel(ThreatLevel.VeryLow, "osSetParcelMediaURL"); |
778 | 783 | ||
779 | m_host.AddScriptLPS(1); | 784 | m_host.AddScriptLPS(1); |
780 | UUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | 785 | |
786 | ILandObject land | ||
787 | = World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); | ||
781 | 788 | ||
782 | if (landowner == UUID.Zero) | 789 | if (land.landData.OwnerID != m_host.ObjectOwner) |
783 | { | ||
784 | return; | ||
785 | } | ||
786 | |||
787 | if (landowner != m_host.ObjectOwner) | ||
788 | { | ||
789 | return; | 790 | return; |
790 | } | ||
791 | 791 | ||
792 | World.LandChannel.GetLandObject(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y).SetMediaUrl(url); | 792 | land.SetMediaUrl(url); |
793 | } | 793 | } |
794 | 794 | ||
795 | public string osGetScriptEngineName() | 795 | public string osGetScriptEngineName() |