aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorTeravus Ovares (Dan Olivares)2009-08-07 20:31:48 -0400
committerTeravus Ovares (Dan Olivares)2009-08-07 20:31:48 -0400
commit2b990a61bfa88e13d5ad19602e6acef751ea473c (patch)
treed7cf9705923c940646e2db3af67bdb98944d9392 /OpenSim
parent* Remove hard coded 256 limitations from various places. There's no more 2... (diff)
downloadopensim-SC_OLD-2b990a61bfa88e13d5ad19602e6acef751ea473c.zip
opensim-SC_OLD-2b990a61bfa88e13d5ad19602e6acef751ea473c.tar.gz
opensim-SC_OLD-2b990a61bfa88e13d5ad19602e6acef751ea473c.tar.bz2
opensim-SC_OLD-2b990a61bfa88e13d5ad19602e6acef751ea473c.tar.xz
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.
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandManagementModule.cs10
-rw-r--r--OpenSim/Region/CoreModules/World/Land/LandObject.cs20
-rw-r--r--OpenSim/Region/CoreModules/World/Permissions/PermissionsModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/MapImageModule.cs8
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/ShadedMapTileRenderer.cs2
-rw-r--r--OpenSim/Region/CoreModules/World/WorldMap/TexturedMapTileRenderer.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/ScenePresence.cs6
-rw-r--r--OpenSim/Region/Framework/Scenes/Scripting/NullScriptHost.cs3
-rw-r--r--OpenSim/Region/OptionalModules/Agent/InternetRelayClientView/Server/IRCClientView.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/IRCConnector.cs4
-rw-r--r--OpenSim/Region/OptionalModules/Avatar/Chat/RegionState.cs2
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/RegionReady/RegionReady.cs2
-rw-r--r--OpenSim/Region/OptionalModules/World/TreePopulator/TreePopulatorModule.cs4
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs4
-rw-r--r--OpenSim/Region/Physics/BulletDotNETPlugin/BulletDotNETPrim.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODECharacter.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/ODEPrim.cs4
-rw-r--r--OpenSim/Region/Physics/OdePlugin/Tests/ODETestClass.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs4
-rw-r--r--OpenSim/Region/ScriptEngine/Shared/Api/Runtime/OSSL_Stub.cs9
-rw-r--r--OpenSim/Region/UserStatistics/ActiveConnectionsAJAX.cs3
-rw-r--r--OpenSim/Tests/Common/Mock/TestClient.cs2
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
317 317
318 public void SendLandUpdate(ScenePresence avatar, bool force) 318 public void SendLandUpdate(ScenePresence avatar, bool force)
319 { 319 {
320 ILandObject over = GetLandObject((int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.X))), 320 ILandObject over = GetLandObject((int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.X))),
321 (int)Math.Min(255, Math.Max(0, Math.Round(avatar.AbsolutePosition.Y)))); 321 (int)Math.Min(((int)Constants.RegionSize - 1), Math.Max(0, Math.Round(avatar.AbsolutePosition.Y))));
322 322
323 if (over != null) 323 if (over != null)
324 { 324 {
@@ -849,10 +849,12 @@ namespace OpenSim.Region.CoreModules.World.Land
849 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET]; 849 byte[] byteArray = new byte[LAND_BLOCKS_PER_PACKET];
850 int byteArrayCount = 0; 850 int byteArrayCount = 0;
851 int sequenceID = 0; 851 int sequenceID = 0;
852 int blockmeters = 4 * (int) Constants.RegionSize/(int)Constants.TerrainPatchSize;
852 853
853 for (int y = 0; y < 64; y++) 854
855 for (int y = 0; y < blockmeters; y++)
854 { 856 {
855 for (int x = 0; x < 64; x++) 857 for (int x = 0; x < blockmeters; x++)
856 { 858 {
857 byte tempByte = 0; //This represents the byte for the current 4x4 859 byte tempByte = 0; //This represents the byte for the current 4x4
858 860
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
305 try 305 try
306 { 306 {
307 over = 307 over =
308 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.X), 0, 255), 308 m_scene.LandChannel.GetLandObject(Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.X), 0, ((int)Constants.RegionSize - 1)),
309 Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, 255)); 309 Util.Clamp<int>((int)Math.Round(avatars[i].AbsolutePosition.Y), 0, ((int)Constants.RegionSize - 1)));
310 } 310 }
311 catch (Exception) 311 catch (Exception)
312 { 312 {
@@ -455,21 +455,21 @@ namespace OpenSim.Region.CoreModules.World.Land
455 } 455 }
456 } 456 }
457 int tx = min_x * 4; 457 int tx = min_x * 4;
458 if (tx > 255) 458 if (tx > ((int)Constants.RegionSize - 1))
459 tx = 255; 459 tx = ((int)Constants.RegionSize - 1);
460 int ty = min_y * 4; 460 int ty = min_y * 4;
461 if (ty > 255) 461 if (ty > ((int)Constants.RegionSize - 1))
462 ty = 255; 462 ty = ((int)Constants.RegionSize - 1);
463 landData.AABBMin = 463 landData.AABBMin =
464 new Vector3((float) (min_x * 4), (float) (min_y * 4), 464 new Vector3((float) (min_x * 4), (float) (min_y * 4),
465 (float) m_scene.Heightmap[tx, ty]); 465 (float) m_scene.Heightmap[tx, ty]);
466 466
467 tx = max_x * 4; 467 tx = max_x * 4;
468 if (tx > 255) 468 if (tx > ((int)Constants.RegionSize - 1))
469 tx = 255; 469 tx = ((int)Constants.RegionSize - 1);
470 ty = max_y * 4; 470 ty = max_y * 4;
471 if (ty > 255) 471 if (ty > ((int)Constants.RegionSize - 1))
472 ty = 255; 472 ty = ((int)Constants.RegionSize - 1);
473 landData.AABBMax = 473 landData.AABBMax =
474 new Vector3((float) (max_x * 4), (float) (max_y * 4), 474 new Vector3((float) (max_x * 4), (float) (max_y * 4),
475 (float) m_scene.Heightmap[tx, ty]); 475 (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
1355 float X = position.X; 1355 float X = position.X;
1356 float Y = position.Y; 1356 float Y = position.Y;
1357 1357
1358 if (X > 255) 1358 if (X > ((int)Constants.RegionSize - 1))
1359 X = 255; 1359 X = ((int)Constants.RegionSize - 1);
1360 if (Y > 255) 1360 if (Y > ((int)Constants.RegionSize - 1))
1361 Y = 255; 1361 Y = ((int)Constants.RegionSize - 1);
1362 if (X < 0) 1362 if (X < 0)
1363 X = 0; 1363 X = 0;
1364 if (Y < 0) 1364 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
331 int mapdrawendY = (int)(pos.Y + scale.Y); 331 int mapdrawendY = (int)(pos.Y + scale.Y);
332 332
333 // If object is beyond the edge of the map, don't draw it to avoid errors 333 // If object is beyond the edge of the map, don't draw it to avoid errors
334 if (mapdrawstartX < 0 || mapdrawstartX > 255 || mapdrawendX < 0 || mapdrawendX > 255 334 if (mapdrawstartX < 0 || mapdrawstartX > ((int)Constants.RegionSize - 1) || mapdrawendX < 0 || mapdrawendX > ((int)Constants.RegionSize - 1)
335 || mapdrawstartY < 0 || mapdrawstartY > 255 || mapdrawendY < 0 335 || mapdrawstartY < 0 || mapdrawstartY > ((int)Constants.RegionSize - 1) || mapdrawendY < 0
336 || mapdrawendY > 255) 336 || mapdrawendY > ((int)Constants.RegionSize - 1))
337 continue; 337 continue;
338 338
339#region obb face reconstruction part duex 339#region obb face reconstruction part duex
@@ -537,7 +537,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
537 // float z = -point3d.z - topos.z; 537 // float z = -point3d.z - topos.z;
538 538
539 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d); 539 returnpt.X = (int)point3d.X;//(int)((topos.x - point3d.x) / z * d);
540 returnpt.Y = (int)(255 - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d))); 540 returnpt.Y = (int)(((int)Constants.RegionSize - 1) - point3d.Y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
541 541
542 return returnpt; 542 return returnpt;
543 } 543 }
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
107 // . 107 // .
108 // 108 //
109 // Shade the terrain for shadows 109 // Shade the terrain for shadows
110 if (x < 255 && yr < 255) 110 if (x < ((int)Constants.RegionSize - 1) && yr < ((int)Constants.RegionSize - 1))
111 { 111 {
112 float hfvalue = (float)hm[x, y]; 112 float hfvalue = (float)hm[x, y];
113 float hfvaluecompare = 0f; 113 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
266 // the heigthfield might have some jumps in values. Rendered land is smooth, though, 266 // the heigthfield might have some jumps in values. Rendered land is smooth, though,
267 // as a slope is rendered at that place. So average 4 neighbour values to emulate that. 267 // as a slope is rendered at that place. So average 4 neighbour values to emulate that.
268 private float getHeight(double[,] hm, int x, int y) { 268 private float getHeight(double[,] hm, int x, int y) {
269 if (x < 255 && y < 255) 269 if (x < ((int)Constants.RegionSize - 1) && y < ((int)Constants.RegionSize - 1))
270 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112); 270 return (float)(hm[x, y] * .444 + (hm[x + 1, y] + hm[x, y + 1]) * .222 + hm[x + 1, y +1] * .112);
271 else 271 else
272 return (float)hm[x, y]; 272 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
777 // related to the handling of attachments 777 // related to the handling of attachments
778 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance); 778 //m_scene.GetAvatarAppearance(m_controllingClient, out m_appearance);
779 779
780 if (pos.X < 0 || pos.X > Constants.RegionSize || pos.Y < 0 || pos.Y > Constants.RegionSize || pos.Z < 0) 780 if (pos.X < 0 || pos.X >= (int)Constants.RegionSize || pos.Y < 0 || pos.Y >= (int)Constants.RegionSize || pos.Z < 0)
781 { 781 {
782 Vector3 emergencyPos = new Vector3(128, 128, 128); 782 Vector3 emergencyPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
783 783
784 m_log.WarnFormat( 784 m_log.WarnFormat(
785 "[SCENE PRESENCE]: MakeRootAgent() was given an illegal position of {0} for avatar {1}, {2}. Substituting {3}", 785 "[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
2948 public void Reset() 2948 public void Reset()
2949 { 2949 {
2950 // Put the child agent back at the center 2950 // Put the child agent back at the center
2951 AbsolutePosition = new Vector3(128, 128, 70); 2951 AbsolutePosition = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 70);
2952 ResetAnimations(); 2952 ResetAnimations();
2953 } 2953 }
2954 2954
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;
29using OpenMetaverse; 29using OpenMetaverse;
30using log4net; 30using log4net;
31using System.Reflection; 31using System.Reflection;
32using OpenSim.Framework;
32 33
33namespace OpenSim.Region.Framework.Scenes.Scripting 34namespace OpenSim.Region.Framework.Scenes.Scripting
34{ 35{
@@ -36,7 +37,7 @@ namespace OpenSim.Region.Framework.Scenes.Scripting
36 { 37 {
37 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 38 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
38 39
39 private Vector3 m_pos = new Vector3(128, 128, 30); 40 private Vector3 m_pos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30);
40 41
41 public string Name 42 public string Name
42 { 43 {
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
513 513
514 public Vector3 StartPos 514 public Vector3 StartPos
515 { 515 {
516 get { return new Vector3(128, 128, 50); } 516 get { return new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 50); }
517 set { } 517 set { }
518 } 518 }
519 519
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
50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
51 51
52 // Local constants 52 // Local constants
53 53
54 private static readonly Vector3 CenterOfRegion = new Vector3(128, 128, 20); 54 private static readonly Vector3 CenterOfRegion = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20);
55 private static readonly char[] CS_SPACE = { ' ' }; 55 private static readonly char[] CS_SPACE = { ' ' };
56 56
57 private const int WD_INTERVAL = 1000; // base watchdog interval 57 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
45 private static readonly ILog m_log = 45 private static readonly ILog m_log =
46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 46 LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
47 47
48 private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(128, 128, 20); 48 private static readonly OpenMetaverse.Vector3 CenterOfRegion = new OpenMetaverse.Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 20);
49 private const int DEBUG_CHANNEL = 2147483647; 49 private const int DEBUG_CHANNEL = 2147483647;
50 50
51 private static int _idk_ = 0; 51 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
125 c.Channel = m_channelNotify; 125 c.Channel = m_channelNotify;
126 c.Message += numScriptsFailed.ToString() + "," + message; 126 c.Message += numScriptsFailed.ToString() + "," + message;
127 c.Type = ChatTypeEnum.Region; 127 c.Type = ChatTypeEnum.Region;
128 c.Position = new Vector3(128, 128, 30); 128 c.Position = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 30);
129 c.Sender = null; 129 c.Sender = null;
130 c.SenderUUID = UUID.Zero; 130 c.SenderUUID = UUID.Zero;
131 131
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
755 position.X = s_tree.AbsolutePosition.X + (float)randX; 755 position.X = s_tree.AbsolutePosition.X + (float)randX;
756 position.Y = s_tree.AbsolutePosition.Y + (float)randY; 756 position.Y = s_tree.AbsolutePosition.Y + (float)randY;
757 757
758 if (position.X <= 255 && position.X >= 0 && 758 if (position.X <= ((int)Constants.RegionSize - 1) && position.X >= 0 &&
759 position.Y <= 255 && position.Y >= 0 && 759 position.Y <= ((int)Constants.RegionSize - 1) && position.Y >= 0 &&
760 Util.GetDistanceTo(position, copse.m_seed_point) <= copse.m_range) 760 Util.GetDistanceTo(position, copse.m_seed_point) <= copse.m_range)
761 { 761 {
762 UUID uuid = m_scene.RegionInfo.EstateSettings.EstateOwner; 762 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
144 } 144 }
145 else if (actor.Position.Y >= Constants.RegionSize) 145 else if (actor.Position.Y >= Constants.RegionSize)
146 { 146 {
147 actor.Position.Y = 255.9F; 147 actor.Position.Y = ((int)Constants.RegionSize - 0.1f);
148 } 148 }
149 149
150 if (actor.Position.X < 0) 150 if (actor.Position.X < 0)
@@ -153,7 +153,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
153 } 153 }
154 else if (actor.Position.X >= Constants.RegionSize) 154 else if (actor.Position.X >= Constants.RegionSize)
155 { 155 {
156 actor.Position.X = 255.9F; 156 actor.Position.X = ((int)Constants.RegionSize - 0.1f);
157 } 157 }
158 158
159 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + actor.Size.Z; 159 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
2476 l_orientation.Z = tempOrientation2.getZ(); 2476 l_orientation.Z = tempOrientation2.getZ();
2477 l_orientation.W = tempOrientation2.getW(); 2477 l_orientation.W = tempOrientation2.getW();
2478 2478
2479 if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) 2479 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)
2480 { 2480 {
2481 //base.RaiseOutOfBounds(l_position); 2481 //base.RaiseOutOfBounds(l_position);
2482 2482
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
161 } 161 }
162 else 162 else
163 { 163 {
164 _position = new PhysicsVector(128,128,parent_scene.GetTerrainHeightAtXY(128,128) + 10); 164 _position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), parent_scene.GetTerrainHeightAtXY(128, 128) + 10);
165 m_taintPosition.X = _position.X; 165 m_taintPosition.X = _position.X;
166 m_taintPosition.Y = _position.Y; 166 m_taintPosition.Y = _position.Y;
167 m_taintPosition.Z = _position.Z; 167 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
181 _velocity = new PhysicsVector(); 181 _velocity = new PhysicsVector();
182 if (!PhysicsVector.isFinite(pos)) 182 if (!PhysicsVector.isFinite(pos))
183 { 183 {
184 pos = new PhysicsVector(128, 128, parent_scene.GetTerrainHeightAtXY(128, 128) + 0.5f); 184 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);
185 m_log.Warn("[PHYSICS]: Got nonFinite Object create Position"); 185 m_log.Warn("[PHYSICS]: Got nonFinite Object create Position");
186 } 186 }
187 _position = pos; 187 _position = pos;
@@ -2538,7 +2538,7 @@ namespace OpenSim.Region.Physics.OdePlugin
2538 l_orientation.Z = ori.Z; 2538 l_orientation.Z = ori.Z;
2539 l_orientation.W = ori.W; 2539 l_orientation.W = ori.W;
2540 2540
2541 if (l_position.X > 255.95f || l_position.X < 0f || l_position.Y > 255.95f || l_position.Y < 0f) 2541 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)
2542 { 2542 {
2543 //base.RaiseOutOfBounds(l_position); 2543 //base.RaiseOutOfBounds(l_position);
2544 2544
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
76 public void CreateAndDropPhysicalCube() 76 public void CreateAndDropPhysicalCube()
77 { 77 {
78 PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox(); 78 PrimitiveBaseShape newcube = PrimitiveBaseShape.CreateBox();
79 PhysicsVector position = new PhysicsVector(128, 128, 128); 79 PhysicsVector position = new PhysicsVector(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 128);
80 PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f); 80 PhysicsVector size = new PhysicsVector(0.5f, 0.5f, 0.5f);
81 Quaternion rot = Quaternion.Identity; 81 Quaternion rot = Quaternion.Identity;
82 PhysicsActor prim = ps.AddPrimShape("CoolShape", newcube, position, size, rot, true); 82 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
298 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight"); 298 CheckThreatLevel(ThreatLevel.High, "osTerrainSetHeight");
299 299
300 m_host.AddScriptLPS(1); 300 m_host.AddScriptLPS(1);
301 if (x > 255 || x < 0 || y > 255 || y < 0) 301 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
302 OSSLError("osTerrainSetHeight: Coordinate out of bounds"); 302 OSSLError("osTerrainSetHeight: Coordinate out of bounds");
303 303
304 if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0))) 304 if (World.Permissions.CanTerraformLand(m_host.OwnerID, new Vector3(x, y, 0)))
@@ -317,7 +317,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
317 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight"); 317 CheckThreatLevel(ThreatLevel.None, "osTerrainGetHeight");
318 318
319 m_host.AddScriptLPS(1); 319 m_host.AddScriptLPS(1);
320 if (x > 255 || x < 0 || y > 255 || y < 0) 320 if (x > ((int)Constants.RegionSize - 1) || x < 0 || y > ((int)Constants.RegionSize - 1) || y < 0)
321 OSSLError("osTerrainGetHeight: Coordinate out of bounds"); 321 OSSLError("osTerrainGetHeight: Coordinate out of bounds");
322 322
323 return World.Heightmap[x, y]; 323 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;
31using System.Reflection; 31using System.Reflection;
32using System.Collections; 32using System.Collections;
33using System.Collections.Generic; 33using System.Collections.Generic;
34using OpenSim.Framework;
34using OpenSim.Region.Framework.Interfaces; 35using OpenSim.Region.Framework.Interfaces;
35using OpenSim.Region.ScriptEngine.Interfaces; 36using OpenSim.Region.ScriptEngine.Interfaces;
36using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces; 37using OpenSim.Region.ScriptEngine.Shared.Api.Interfaces;
@@ -443,12 +444,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
443 } 444 }
444 private void Save() 445 private void Save()
445 { 446 {
446 if (Position.x > 255) 447 if (Position.x > ((int)Constants.RegionSize - 1))
447 Position.x = 255; 448 Position.x = ((int)Constants.RegionSize - 1);
448 if (Position.x < 0) 449 if (Position.x < 0)
449 Position.x = 0; 450 Position.x = 0;
450 if (Position.y > 255) 451 if (Position.y > ((int)Constants.RegionSize - 1))
451 Position.y = 255; 452 Position.y = ((int)Constants.RegionSize - 1);
452 if (Position.y < 0) 453 if (Position.y < 0)
453 Position.y = 0; 454 Position.y = 0;
454 if (Position.z > 768) 455 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;
32using System.Text; 32using System.Text;
33using Mono.Data.SqliteClient; 33using Mono.Data.SqliteClient;
34using OpenMetaverse; 34using OpenMetaverse;
35using OpenSim.Framework;
35using OpenSim.Region.Framework.Scenes; 36using OpenSim.Region.Framework.Scenes;
36using OpenSim.Framework.Statistics; 37using OpenSim.Framework.Statistics;
37 38
@@ -39,7 +40,7 @@ namespace OpenSim.Region.UserStatistics
39{ 40{
40 public class ActiveConnectionsAJAX : IStatsController 41 public class ActiveConnectionsAJAX : IStatsController
41 { 42 {
42 private Vector3 DefaultNeighborPosition = new Vector3(128, 128, 70); 43 private Vector3 DefaultNeighborPosition = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 70);
43 44
44 #region IStatsController Members 45 #region IStatsController Members
45 46
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
298 /// </value> 298 /// </value>
299 public string CapsSeedUrl; 299 public string CapsSeedUrl;
300 300
301 private Vector3 startPos = new Vector3(128, 128, 2); 301 private Vector3 startPos = new Vector3(((int)Constants.RegionSize * 0.5f), ((int)Constants.RegionSize * 0.5f), 2);
302 302
303 public virtual Vector3 StartPos 303 public virtual Vector3 StartPos
304 { 304 {