From 2b990a61bfa88e13d5ad19602e6acef751ea473c Mon Sep 17 00:00:00 2001 From: Teravus Ovares (Dan Olivares) Date: Fri, 7 Aug 2009 20:31:48 -0400 Subject: This is the second part of the 'not crash on regionsize changes'. This lets you configure region sizes to be smaller without crashing the region. I remind you that regions are still square, must be a multiple of 4, and the Linden client doesn't like anything other then 256. If you set it bigger or smaller, the terrain doesn't load in the client, the map has issues, and god forbid you connect it to a grid that expects 256m regions. --- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 9 +++++---- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'OpenSim/Region/ScriptEngine/Shared') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index fd4ba71..5c6996f 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -298,7 +298,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); m_host.AddScriptLPS(1); - if (x > 255 || x < 0 || y > 255 || y < 0) + if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) OSSLError("osTerrainSetHeight: Coordinate out of bounds"); if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) @@ -317,7 +317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); m_host.AddScriptLPS(1); - if (x > 255 || x < 0 || y > 255 || y < 0) + if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0) OSSLError("osTerrainGetHeight: Coordinate out of bounds"); return World.Heightmap[x, y]; diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs index 2408129..22c8887 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs @@ -31,6 +31,7 @@ using System.Threading; using System.Reflection; using System.Collections; using System.Collections.Generic; +using OpenSim.Framework; using OpenSim.Region.Framework.Interfaces; using OpenSim.Region.ScriptEngine.Interfaces; using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; @@ -443,12 +444,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase } private void Save() { - if (Position.x > 255) - Position.x = 255; + if (Position.x > ((int)Constants.RegionSize - 1)) + Position.x = ((int)Constants.RegionSize - 1); if (Position.x < 0) Position.x = 0; - if (Position.y > 255) - Position.y = 255; + if (Position.y > ((int)Constants.RegionSize - 1)) + Position.y = ((int)Constants.RegionSize - 1); if (Position.y < 0) Position.y = 0; if (Position.z > 768) -- cgit v1.1