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. --- .../CoreModules/World/Land/LandManagementModule.cs | 10 ++++++---- OpenSim/Region/CoreModules/World/Land/LandObject.cs | 20 ++++++++++---------- .../World/Permissions/PermissionsModule.cs | 8 ++++---- .../CoreModules/World/WorldMap/MapImageModule.cs | 8 ++++---- .../World/WorldMap/ShadedMapTileRenderer.cs | 2 +- .../World/WorldMap/TexturedMapTileRenderer.cs | 2 +- OpenSim/Region/Framework/Scenes/ScenePresence.cs | 6 +++--- .../Framework/Scenes/Scripting/NullScriptHost.cs | 3 ++- .../InternetRelayClientView/Server/IRCClientView.cs | 2 +- .../OptionalModules/Avatar/Chat/IRCConnector.cs | 4 ++-- .../OptionalModules/Avatar/Chat/RegionState.cs | 2 +- .../Scripting/RegionReady/RegionReady.cs | 2 +- .../World/TreePopulator/TreePopulatorModule.cs | 4 ++-- .../Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs | 4 ++-- .../Physics/BulletDotNETPlugin/BulletDotNETPrim.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODECharacter.cs | 2 +- OpenSim/Region/Physics/OdePlugin/ODEPrim.cs | 4 ++-- .../Region/Physics/OdePlugin/Tests/ODETestClass.cs | 2 +- .../Shared/Api/Implementation/OSSL_Api.cs | 4 ++-- .../ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs | 9 +++++---- .../Region/UserStatistics/ActiveConnectionsAJAX.cs | 3 ++- OpenSim/Tests/Common/Mock/TestClient.cs | 2 +- 22 files changed, 55 insertions(+), 50 deletions(-) diff --git a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs index 4deb36e..097a62d 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs @@ -317,8 +317,8 @@ namespace OpenSim.Region.CoreModules.World.Land public void SendLandUpdate(ScenePresence avatar, bool force) { - ILandObject over = GetLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), - (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); + ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), + (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); if (over != null) { @@ -849,10 +849,12 @@ namespace OpenSim.Region.CoreModules.World.Land byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; int byteArrayCount = 0; int sequenceID = 0; + int blockmeters = 4 * (int) Constants.RegionSize/(int)Constants.TerrainPatchSize; - for (int y = 0; y < 64; y++) + + for (int y = 0; y < blockmeters; y++) { - for (int x = 0; x < 64; x++) + for (int x = 0; x < blockmeters; x++) { byte tempByte = 0; //This represents the byte for the current 4x4 diff --git a/OpenSim/Region/CoreModules/World/Land/LandObject.cs b/OpenSim/Region/CoreModules/World/Land/LandObject.cs index 715b48d..f41bdac 100644 --- a/OpenSim/Region/CoreModules/World/Land/LandObject.cs +++ b/OpenSim/Region/CoreModules/World/Land/LandObject.cs @@ -305,8 +305,8 @@ namespace OpenSim.Region.CoreModules.World.Land try { over = - m_scene.LandChannel.GetLandObject(Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.X), 0, 255), - Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, 255)); + m_scene.LandChannel.GetLandObject(Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)), + Util.Clamp((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1))); } catch (Exception) { @@ -455,21 +455,21 @@ namespace OpenSim.Region.CoreModules.World.Land } } int tx = min_x * 4; - if (tx > 255) - tx = 255; + if (tx > ((int)Constants.RegionSize - 1)) + tx = ((int)Constants.RegionSize - 1); int ty = min_y * 4; - if (ty > 255) - ty = 255; + if (ty > ((int)Constants.RegionSize - 1)) + ty = ((int)Constants.RegionSize - 1); landData.AABBMin = new Vector3((float) (min_x * 4), (float) (min_y * 4), (float) m_scene.Heightmap[tx, ty]); tx = max_x * 4; - if (tx > 255) - tx = 255; + if (tx > ((int)Constants.RegionSize - 1)) + tx = ((int)Constants.RegionSize - 1); ty = max_y * 4; - if (ty > 255) - ty = 255; + if (ty > ((int)Constants.RegionSize - 1)) + ty = ((int)Constants.RegionSize - 1); landData.AABBMax = new Vector3((float) (max_x * 4), (float) (max_y * 4), (float) m_scene.Heightmap[tx, ty]); diff --git a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs index a4793e6..6db9cbf 100644 --- a/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs +++ b/OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs @@ -1355,10 +1355,10 @@ namespace OpenSim.Region.CoreModules.World.Permissions float X = position.X; float Y = position.Y; - if (X > 255) - X = 255; - if (Y > 255) - Y = 255; + if (X > ((int)Constants.RegionSize - 1)) + X = ((int)Constants.RegionSize - 1); + if (Y > ((int)Constants.RegionSize - 1)) + Y = ((int)Constants.RegionSize - 1); if (X < 0) X = 0; if (Y < 0) diff --git a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs index d1d3045..5fd8369 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs @@ -331,9 +331,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap int mapdrawendY = (int)(pos.Y + scale.Y); // If object is beyond the edge of the map, don't draw it to avoid errors - if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255 - || mapdrawstartY < 0 || mapdrawstartY > 255 || mapdrawendY < 0 - || mapdrawendY > 255) + if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1) + || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0 + || mapdrawendY > ((int)Constants.RegionSize - 1)) continue; #region obb face reconstruction part duex @@ -537,7 +537,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // float z = -point3d.z - topos.z; returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); - returnpt.Y = (int)(255 - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); + returnpt.Y = (int)(((int)Constants.RegionSize - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); return returnpt; } diff --git a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs index f39cf68..a297cf3 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs @@ -107,7 +107,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // . // // Shade the terrain for shadows - if (x < 255 && yr < 255) + if (x < ((int)Constants.RegionSize - 1) && yr < ((int)Constants.RegionSize - 1)) { float hfvalue = (float)hm[x, y]; float hfvaluecompare = 0f; diff --git a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs index 97ee451..4ecad74 100644 --- a/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs +++ b/OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs @@ -266,7 +266,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap // the heigthfield might have some jumps in values. Rendered land is smooth, though, // as a slope is rendered at that place. So average 4 neighbour values to emulate that. private float getHeight(double[,] hm, int x, int y) { - if (x < 255 && y < 255) + if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1)) return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); else return (float)hm[x, y]; diff --git a/OpenSim/Region/Framework/Scenes/ScenePresence.cs b/OpenSim/Region/Framework/Scenes/ScenePresence.cs index 50baa9b..4695df7 100644 --- a/OpenSim/Region/Framework/Scenes/ScenePresence.cs +++ b/OpenSim/Region/Framework/Scenes/ScenePresence.cs @@ -777,9 +777,9 @@ namespace OpenSim.Region.Framework.Scenes // related to the handling of attachments //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); - if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0) + if (pos.X < 0 || pos.X >= (int)Constants.RegionSize || pos.Y < 0 || pos.Y >= (int)Constants.RegionSize || pos.Z < 0) { - Vector3 emergencyPos = new Vector3(128, 128, 128); + Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); m_log.WarnFormat( "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", @@ -2948,7 +2948,7 @@ namespace OpenSim.Region.Framework.Scenes public void Reset() { // Put the child agent back at the center - AbsolutePosition = new Vector3(128, 128, 70); + AbsolutePosition = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 70); ResetAnimations(); } diff --git a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs index abb514d..af18a98 100644 --- a/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs +++ b/OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs @@ -29,6 +29,7 @@ using System; using OpenMetaverse; using log4net; using System.Reflection; +using OpenSim.Framework; namespace OpenSim.Region.Framework.Scenes.Scripting { @@ -36,7 +37,7 @@ namespace OpenSim.Region.Framework.Scenes.Scripting { private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private Vector3 m_pos = new Vector3(128, 128, 30); + private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); public string Name { diff --git a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs index 44bd716..08fc61f 100644 --- a/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs +++ b/OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs @@ -513,7 +513,7 @@ namespace OpenSim.Region.OptionalModules.Agent.InternetRelayClientView.Server public Vector3 StartPos { - get { return new Vector3(128, 128, 50); } + get { return new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 50); } set { } } diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs index 2f1dbc1..9273fb5 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs @@ -50,8 +50,8 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); // Local constants - - private static readonly Vector3 CenterOfRegion = new Vector3(128, 128, 20); + + private static readonly Vector3 CenterOfRegion = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20); private static readonly char[] CS_SPACE = { ' ' }; private const int WD_INTERVAL = 1000; // base watchdog interval diff --git a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs index ba3f3e5..203948e 100644 --- a/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs +++ b/OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs @@ -45,7 +45,7 @@ namespace OpenSim.Region.OptionalModules.Avatar.Chat private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); - private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(128, 128, 20); + private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20); private const int DEBUG_CHANNEL = 2147483647; private static int _idk_ = 0; diff --git a/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs b/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs index d3f3e10..f2c6db1 100644 --- a/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs +++ b/OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs @@ -125,7 +125,7 @@ namespace OpenSim.Region.CoreModules.Scripting.RegionReady c.Channel = m_channelNotify; c.Message += numScriptsFailed.ToString() + "," + message; c.Type = ChatTypeEnum.Region; - c.Position = new Vector3(128, 128, 30); + c.Position = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30); c.Sender = null; c.SenderUUID = UUID.Zero; diff --git a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs index 3e9c326..d4bba10 100644 --- a/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs +++ b/OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs @@ -755,8 +755,8 @@ namespace OpenSim.Region.OptionalModules.World.TreePopulator position.X = s_tree.AbsolutePosition.X + (float)randX; position.Y = s_tree.AbsolutePosition.Y + (float)randY; - if (position.X <= 255 && position.X >= 0 && - position.Y <= 255 && position.Y >= 0 && + if (position.X <= ((int)Constants.RegionSize - 1) && position.X >= 0 && + position.Y <= ((int)Constants.RegionSize - 1) && position.Y >= 0 && Util.GetDistanceTo(position, copse.m_seed_point) <= copse.m_range) { UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs index 92d5771..d3d10bf 100644 --- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs +++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs @@ -144,7 +144,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin } else if (actor.Position.Y >= Constants.RegionSize) { - actor.Position.Y = 255.9F; + actor.Position.Y = ((int)Constants.RegionSize - 0.1f); } if (actor.Position.X < 0) @@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin } else if (actor.Position.X >= Constants.RegionSize) { - actor.Position.X = 255.9F; + actor.Position.X = ((int)Constants.RegionSize - 0.1f); } float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; diff --git a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs index 2cc5d41..7ab8b98 100644 --- a/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs +++ b/OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs @@ -2476,7 +2476,7 @@ namespace OpenSim.Region.Physics.BulletDotNETPlugin l_orientation.Z = tempOrientation2.getZ(); l_orientation.W = tempOrientation2.getW(); - if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) + if (l_position.X > ((int)Constants.RegionSize - 0.05f) || l_position.X < 0f || l_position.Y > ((int)Constants.RegionSize - 0.05f) || l_position.Y < 0f) { //base.RaiseOutOfBounds(l_position); diff --git a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs index b556395..759692f 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODECharacter.cs @@ -161,7 +161,7 @@ namespace OpenSim.Region.Physics.OdePlugin } else { - _position = new PhysicsVector(128,128,parent_scene.GetTerrainHeightAtXY(128,128) + 10); + _position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10); m_taintPosition.X = _position.X; m_taintPosition.Y = _position.Y; m_taintPosition.Z = _position.Z; diff --git a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs index d8d3b68..443788c 100644 --- a/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs +++ b/OpenSim/Region/Physics/OdePlugin/ODEPrim.cs @@ -181,7 +181,7 @@ namespace OpenSim.Region.Physics.OdePlugin _velocity = new PhysicsVector(); if (!PhysicsVector.isFinite(pos)) { - pos = new PhysicsVector(128, 128, parent_scene.GetTerrainHeightAtXY(128, 128) + 0.5f); + pos = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f)) + 0.5f); m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); } _position = pos; @@ -2538,7 +2538,7 @@ namespace OpenSim.Region.Physics.OdePlugin l_orientation.Z = ori.Z; l_orientation.W = ori.W; - if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) + if (l_position.X > ((int)Constants.RegionSize - 0.05f) || l_position.X < 0f || l_position.Y > ((int)Constants.RegionSize - 0.05f) || l_position.Y < 0f) { //base.RaiseOutOfBounds(l_position); diff --git a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs index b186175..cdd38c4 100644 --- a/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs +++ b/OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs @@ -76,7 +76,7 @@ namespace OpenSim.Region.Physics.OdePlugin public void CreateAndDropPhysicalCube() { PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); - PhysicsVector position = new PhysicsVector(128, 128, 128); + PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128); PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f); Quaternion rot = Quaternion.Identity; PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); 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) diff --git a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs index a20e70f..d7c39a3 100644 --- a/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs +++ b/OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs @@ -32,6 +32,7 @@ using System.Reflection; using System.Text; using Mono.Data.SqliteClient; using OpenMetaverse; +using OpenSim.Framework; using OpenSim.Region.Framework.Scenes; using OpenSim.Framework.Statistics; @@ -39,7 +40,7 @@ namespace OpenSim.Region.UserStatistics { public class ActiveConnectionsAJAX : IStatsController { - private Vector3 DefaultNeighborPosition = new Vector3(128, 128, 70); + private Vector3 DefaultNeighborPosition = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 70); #region IStatsController Members diff --git a/OpenSim/Tests/Common/Mock/TestClient.cs b/OpenSim/Tests/Common/Mock/TestClient.cs index 4b59b50..bf4ddf0 100644 --- a/OpenSim/Tests/Common/Mock/TestClient.cs +++ b/OpenSim/Tests/Common/Mock/TestClient.cs @@ -298,7 +298,7 @@ namespace OpenSim.Tests.Common.Mock /// public string CapsSeedUrl; - private Vector3 startPos = new Vector3(128, 128, 2); + private Vector3 startPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 2); public virtual Vector3 StartPos { -- cgit v1.1