aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
authorAdam Frisby2008-02-14 12:16:33 +0000
committerAdam Frisby2008-02-14 12:16:33 +0000
commitf3afa68a2af6ad5999e6efe3e4725cb17293108d (patch)
tree4253a44bee39976d6b3dd6813439f5966cf12632 /OpenSim
parent* Exposed AddHandlers in response to mantis #534. Thanks, kmeisthax! (diff)
downloadopensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.zip
opensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.gz
opensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.bz2
opensim-SC_OLD-f3afa68a2af6ad5999e6efe3e4725cb17293108d.tar.xz
* Made new Framework.Constants class, added RegionSize member.
* Converted all instances of "256" spotted to use RegionSize instead. Some approximations used for border crossings (ie 255.9f) are still using that value, but should be updated to use something based on RegionSize. * Moving Terrain to a RegionModule, implemented ITerrainChannel and TerrainModule - nonfunctional, but will be soon.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/Communications/LoginResponse.cs10
-rw-r--r--OpenSim/Framework/Constants.cs11
-rw-r--r--OpenSim/Framework/Data/RegionProfileData.cs4
-rw-r--r--OpenSim/Framework/RegionHandle.cs6
-rw-r--r--OpenSim/Framework/RegionInfo.cs2
-rw-r--r--OpenSim/Framework/SerializableRegionInfo.cs2
-rw-r--r--OpenSim/Framework/UserProfileData.cs2
-rw-r--r--OpenSim/Grid/GridServer/GridManager.cs28
-rw-r--r--OpenSim/Grid/MessagingServer/MessageService.cs2
-rw-r--r--OpenSim/Grid/UserServer/UserLoginService.cs10
-rw-r--r--OpenSim/Region/Communications/Local/LocalLoginService.cs4
-rw-r--r--OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs10
-rw-r--r--OpenSim/Region/Environment/LandManagement/Land.cs4
-rw-r--r--OpenSim/Region/Environment/LandManagement/LandManager.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/ChatModule.cs4
-rw-r--r--OpenSim/Region/Environment/Modules/TerrainModule.cs131
-rw-r--r--OpenSim/Region/Environment/Scenes/InnerScene.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/Scene.cs24
-rw-r--r--OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs2
-rw-r--r--OpenSim/Region/Environment/Scenes/ScenePresence.cs23
-rw-r--r--OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs8
-rw-r--r--OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs2
-rw-r--r--OpenSim/Region/Physics/OdePlugin/OdePlugin.cs8
-rw-r--r--OpenSim/Region/Physics/POSPlugin/POSPlugin.cs18
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs2
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs64
26 files changed, 276 insertions, 111 deletions
diff --git a/OpenSim/Framework/Communications/LoginResponse.cs b/OpenSim/Framework/Communications/LoginResponse.cs
index 9036884..00b691e 100644
--- a/OpenSim/Framework/Communications/LoginResponse.cs
+++ b/OpenSim/Framework/Communications/LoginResponse.cs
@@ -152,7 +152,7 @@ namespace OpenSim.Framework.UserManagement
152 ErrorReason = "key"; 152 ErrorReason = "key";
153 welcomeMessage = "Welcome to OpenSim!"; 153 welcomeMessage = "Welcome to OpenSim!";
154 seedCapability = String.Empty; 154 seedCapability = String.Empty;
155 home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" + 155 home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" +
156 userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" + 156 userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
157 userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" + 157 userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
158 userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}"; 158 userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
@@ -347,8 +347,8 @@ namespace OpenSim.Framework.UserManagement
347 responseData["home"] = home; 347 responseData["home"] = home;
348 responseData["look_at"] = lookAt; 348 responseData["look_at"] = lookAt;
349 responseData["message"] = welcomeMessage; 349 responseData["message"] = welcomeMessage;
350 responseData["region_x"] = (Int32) RegionX*256; 350 responseData["region_x"] = (Int32)RegionX * Constants.RegionSize;
351 responseData["region_y"] = (Int32) RegionY*256; 351 responseData["region_y"] = (Int32)RegionY * Constants.RegionSize;
352 352
353 //responseData["inventory-lib-root"] = new ArrayList(); // todo 353 //responseData["inventory-lib-root"] = new ArrayList(); // todo
354 354
@@ -447,8 +447,8 @@ namespace OpenSim.Framework.UserManagement
447 map["home"] = LLSD.FromString(home); 447 map["home"] = LLSD.FromString(home);
448 map["look_at"] = LLSD.FromString(lookAt); 448 map["look_at"] = LLSD.FromString(lookAt);
449 map["message"] = LLSD.FromString(welcomeMessage); 449 map["message"] = LLSD.FromString(welcomeMessage);
450 map["region_x"] = LLSD.FromInteger(RegionX * 256); 450 map["region_x"] = LLSD.FromInteger(RegionX * Constants.RegionSize);
451 map["region_y"] = LLSD.FromInteger(RegionY * 256); 451 map["region_y"] = LLSD.FromInteger(RegionY * Constants.RegionSize);
452 452
453 if (m_buddyList != null) 453 if (m_buddyList != null)
454 { 454 {
diff --git a/OpenSim/Framework/Constants.cs b/OpenSim/Framework/Constants.cs
new file mode 100644
index 0000000..b308221
--- /dev/null
+++ b/OpenSim/Framework/Constants.cs
@@ -0,0 +1,11 @@
1using System;
2using System.Collections.Generic;
3using System.Text;
4
5namespace OpenSim.Framework
6{
7 public class Constants
8 {
9 public const uint RegionSize = 256;
10 }
11}
diff --git a/OpenSim/Framework/Data/RegionProfileData.cs b/OpenSim/Framework/Data/RegionProfileData.cs
index 48d3ebc..8119d01 100644
--- a/OpenSim/Framework/Data/RegionProfileData.cs
+++ b/OpenSim/Framework/Data/RegionProfileData.cs
@@ -169,7 +169,7 @@ namespace OpenSim.Framework.Data
169 RegionProfileData simData = new RegionProfileData(); 169 RegionProfileData simData = new RegionProfileData();
170 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); 170 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
171 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); 171 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
172 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256)); 172 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
173 simData.serverIP = (string) responseData["sim_ip"]; 173 simData.serverIP = (string) responseData["sim_ip"];
174 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); 174 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
175 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); 175 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
@@ -203,7 +203,7 @@ namespace OpenSim.Framework.Data
203 RegionProfileData simData = new RegionProfileData(); 203 RegionProfileData simData = new RegionProfileData();
204 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]); 204 simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
205 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]); 205 simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
206 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256)); 206 simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
207 simData.serverIP = (string) responseData["sim_ip"]; 207 simData.serverIP = (string) responseData["sim_ip"];
208 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]); 208 simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
209 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]); 209 simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
diff --git a/OpenSim/Framework/RegionHandle.cs b/OpenSim/Framework/RegionHandle.cs
index 440aaf6..9cfe53d 100644
--- a/OpenSim/Framework/RegionHandle.cs
+++ b/OpenSim/Framework/RegionHandle.cs
@@ -63,8 +63,8 @@ namespace OpenSim.Framework
63 uint ny = (uint) y; 63 uint ny = (uint) y;
64 64
65 // Multiply grid coords to get region coords 65 // Multiply grid coords to get region coords
66 nx *= 256; 66 nx *= Constants.RegionSize;
67 ny *= 256; 67 ny *= Constants.RegionSize;
68 68
69 // Stuff the IP address in too 69 // Stuff the IP address in too
70 nx = (uint) a << 16; 70 nx = (uint) a << 16;
@@ -80,7 +80,7 @@ namespace OpenSim.Framework
80 /// <param name="y">Grid Y Coordinate</param> 80 /// <param name="y">Grid Y Coordinate</param>
81 public RegionHandle(uint x, uint y) 81 public RegionHandle(uint x, uint y)
82 { 82 {
83 handle = ((x*256) << 32) | (y*256); 83 handle = ((x * Constants.RegionSize) << 32) | (y * Constants.RegionSize);
84 } 84 }
85 85
86 /// <summary> 86 /// <summary>
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs
index e953182..f97db5c 100644
--- a/OpenSim/Framework/RegionInfo.cs
+++ b/OpenSim/Framework/RegionInfo.cs
@@ -156,7 +156,7 @@ namespace OpenSim.Framework
156 156
157 public ulong RegionHandle 157 public ulong RegionHandle
158 { 158 {
159 get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } 159 get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); }
160 } 160 }
161 } 161 }
162 162
diff --git a/OpenSim/Framework/SerializableRegionInfo.cs b/OpenSim/Framework/SerializableRegionInfo.cs
index 0097fe4..077ed8d 100644
--- a/OpenSim/Framework/SerializableRegionInfo.cs
+++ b/OpenSim/Framework/SerializableRegionInfo.cs
@@ -155,7 +155,7 @@ namespace OpenSim.Framework
155 155
156 public ulong RegionHandle 156 public ulong RegionHandle
157 { 157 {
158 get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); } 158 get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); }
159 } 159 }
160 } 160 }
161} \ No newline at end of file 161} \ No newline at end of file
diff --git a/OpenSim/Framework/UserProfileData.cs b/OpenSim/Framework/UserProfileData.cs
index de44a0d..9c02d78 100644
--- a/OpenSim/Framework/UserProfileData.cs
+++ b/OpenSim/Framework/UserProfileData.cs
@@ -70,7 +70,7 @@ namespace OpenSim.Framework
70 /// </summary> 70 /// </summary>
71 public ulong homeRegion 71 public ulong homeRegion
72 { 72 {
73 get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); } 73 get { return Helpers.UIntsToLong((homeRegionX * (uint)Constants.RegionSize), (homeRegionY * (uint)Constants.RegionSize)); }
74 set 74 set
75 { 75 {
76 homeRegionX = (uint) (value >> 40); 76 homeRegionX = (uint) (value >> 40);
diff --git a/OpenSim/Grid/GridServer/GridManager.cs b/OpenSim/Grid/GridServer/GridManager.cs
index 0ccffd9..efab4fc 100644
--- a/OpenSim/Grid/GridServer/GridManager.cs
+++ b/OpenSim/Grid/GridServer/GridManager.cs
@@ -203,13 +203,13 @@ namespace OpenSim.Grid.GridServer
203 { 203 {
204 if ( 204 if (
205 getRegion( 205 getRegion(
206 Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256), 206 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
207 (uint) (central_region.regionLocY + y)*256)) != null) 207 (uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null)
208 { 208 {
209 neighbour = 209 neighbour =
210 getRegion( 210 getRegion(
211 Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256), 211 Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
212 (uint) (central_region.regionLocY + y)*256)); 212 (uint)(central_region.regionLocY + y) * Constants.RegionSize));
213 response += "<neighbour>"; 213 response += "<neighbour>";
214 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>"; 214 response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
215 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>"; 215 response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
@@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer
303 } 303 }
304 catch (KeyNotFoundException) { } 304 catch (KeyNotFoundException) { }
305 305
306 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256)); 306 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
307 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/"; 307 TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
308 308
309 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/"; 309 TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
@@ -416,13 +416,13 @@ namespace OpenSim.Grid.GridServer
416 { 416 {
417 if ( 417 if (
418 getRegion( 418 getRegion(
419 Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), 419 Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * Constants.RegionSize),
420 (uint)(TheSim.regionLocY + y) * 256)) != null) 420 (uint)(TheSim.regionLocY + y) * Constants.RegionSize)) != null)
421 { 421 {
422 neighbour = 422 neighbour =
423 getRegion( 423 getRegion(
424 Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256), 424 Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * Constants.RegionSize),
425 (uint)(TheSim.regionLocY + y) * 256)); 425 (uint)(TheSim.regionLocY + y) * Constants.RegionSize));
426 426
427 NeighbourBlock = new Hashtable(); 427 NeighbourBlock = new Hashtable();
428 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString(); 428 NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
@@ -604,7 +604,7 @@ namespace OpenSim.Grid.GridServer
604 { 604 {
605 for (int y = ymin; y < ymax + 1; y++) 605 for (int y = ymin; y < ymax + 1; y++)
606 { 606 {
607 ulong regHandle = Helpers.UIntsToLong((uint) (x*256), (uint) (y*256)); 607 ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
608 simProfile = getRegion(regHandle); 608 simProfile = getRegion(regHandle);
609 if (simProfile != null) 609 if (simProfile != null)
610 { 610 {
@@ -764,12 +764,12 @@ namespace OpenSim.Grid.GridServer
764 764
765 case "region_locx": 765 case "region_locx":
766 TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText); 766 TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
767 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256)); 767 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
768 break; 768 break;
769 769
770 case "region_locy": 770 case "region_locy":
771 TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText); 771 TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
772 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256)); 772 TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
773 break; 773 break;
774 } 774 }
775 } 775 }
@@ -787,9 +787,9 @@ namespace OpenSim.Grid.GridServer
787 return "ERROR! Servers must register with public addresses."; 787 return "ERROR! Servers must register with public addresses.";
788 } 788 }
789 789
790 if (requireValid && (TheSim.serverIP.StartsWith("0."))) 790 if (requireValid && (TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
791 { 791 {
792 return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again"; 792 return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again";
793 } 793 }
794 794
795 795
diff --git a/OpenSim/Grid/MessagingServer/MessageService.cs b/OpenSim/Grid/MessagingServer/MessageService.cs
index c2669b0..059a6b0 100644
--- a/OpenSim/Grid/MessagingServer/MessageService.cs
+++ b/OpenSim/Grid/MessagingServer/MessageService.cs
@@ -451,7 +451,7 @@ namespace OpenSim.Grid.MessagingServer
451 regionProfile = new RegionProfileData(); 451 regionProfile = new RegionProfileData();
452 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]); 452 regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
453 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/"; 453 regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
454 regionProfile.regionHandle = Helpers.UIntsToLong((regX * 256), (regY * 256)); 454 regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
455 regionProfile.regionLocX = regX; 455 regionProfile.regionLocX = regX;
456 regionProfile.regionLocY = regY; 456 regionProfile.regionLocY = regY;
457 457
diff --git a/OpenSim/Grid/UserServer/UserLoginService.cs b/OpenSim/Grid/UserServer/UserLoginService.cs
index af234e2..09cd9fd 100644
--- a/OpenSim/Grid/UserServer/UserLoginService.cs
+++ b/OpenSim/Grid/UserServer/UserLoginService.cs
@@ -82,8 +82,8 @@ namespace OpenSim.Grid.UserServer
82 // Customise the response 82 // Customise the response
83 //CFK: This is redundant and the next message should always appear. 83 //CFK: This is redundant and the next message should always appear.
84 //CFK: m_log.Info("[LOGIN]: Home Location"); 84 //CFK: m_log.Info("[LOGIN]: Home Location");
85 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + 85 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
86 (SimInfo.regionLocY*256).ToString() + "], " + 86 (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
87 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 87 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
88 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 88 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
89 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 89 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
@@ -144,7 +144,7 @@ namespace OpenSim.Grid.UserServer
144 // Send him to default region instead 144 // Send him to default region instead
145 // Load information from the gridserver 145 // Load information from the gridserver
146 146
147 ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256); 147 ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize);
148 148
149 m_log.Warn( 149 m_log.Warn(
150 "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString()); 150 "[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString());
@@ -158,8 +158,8 @@ namespace OpenSim.Grid.UserServer
158 158
159 // Customise the response 159 // Customise the response
160 m_log.Info("[LOGIN]: Home Location"); 160 m_log.Info("[LOGIN]: Home Location");
161 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" + 161 response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
162 (SimInfo.regionLocY*256).ToString() + "], " + 162 (SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
163 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 163 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
164 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 164 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
165 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 165 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
diff --git a/OpenSim/Region/Communications/Local/LocalLoginService.cs b/OpenSim/Region/Communications/Local/LocalLoginService.cs
index f6dd379..53748ab 100644
--- a/OpenSim/Region/Communications/Local/LocalLoginService.cs
+++ b/OpenSim/Region/Communications/Local/LocalLoginService.cs
@@ -128,8 +128,8 @@ namespace OpenSim.Region.Communications.Local
128 128
129 if (reg != null) 129 if (reg != null)
130 { 130 {
131 response.Home = "{'region_handle':[r" + (reg.RegionLocX*256).ToString() + ",r" + 131 response.Home = "{'region_handle':[r" + (reg.RegionLocX * Constants.RegionSize).ToString() + ",r" +
132 (reg.RegionLocY*256).ToString() + "], " + 132 (reg.RegionLocY * Constants.RegionSize).ToString() + "], " +
133 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" + 133 "'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
134 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " + 134 theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
135 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" + 135 "'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
diff --git a/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs b/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs
new file mode 100644
index 0000000..9f70b98
--- /dev/null
+++ b/OpenSim/Region/Environment/Interfaces/ITerrainChannel.cs
@@ -0,0 +1,10 @@
1using System;
2namespace OpenSim.Region.Environment.Interfaces
3{
4 interface ITerrainChannel
5 {
6 int Height { get; }
7 double this[int x, int y] { get; set; }
8 int Width { get; }
9 }
10}
diff --git a/OpenSim/Region/Environment/LandManagement/Land.cs b/OpenSim/Region/Environment/LandManagement/Land.cs
index 7cc8519..fec8899 100644
--- a/OpenSim/Region/Environment/LandManagement/Land.cs
+++ b/OpenSim/Region/Environment/LandManagement/Land.cs
@@ -78,7 +78,7 @@ namespace OpenSim.Region.Environment.LandManagement
78 /// <returns>Returns true if the piece of land contains the specified point</returns> 78 /// <returns>Returns true if the piece of land contains the specified point</returns>
79 public bool containsPoint(int x, int y) 79 public bool containsPoint(int x, int y)
80 { 80 {
81 if (x >= 0 && y >= 0 && x <= 256 && x <= 256) 81 if (x >= 0 && y >= 0 && x <= Constants.RegionSize && x <= Constants.RegionSize)
82 { 82 {
83 return (landBitmap[x/4, y/4] == true); 83 return (landBitmap[x/4, y/4] == true);
84 } 84 }
@@ -545,7 +545,7 @@ namespace OpenSim.Region.Environment.LandManagement
545 /// <returns></returns> 545 /// <returns></returns>
546 public static bool[,] basicFullRegionLandBitmap() 546 public static bool[,] basicFullRegionLandBitmap()
547 { 547 {
548 return getSquareLandBitmap(0, 0, 256, 256); 548 return getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize);
549 } 549 }
550 550
551 /// <summary> 551 /// <summary>
diff --git a/OpenSim/Region/Environment/LandManagement/LandManager.cs b/OpenSim/Region/Environment/LandManagement/LandManager.cs
index a4d8868..f5e2a3e 100644
--- a/OpenSim/Region/Environment/LandManagement/LandManager.cs
+++ b/OpenSim/Region/Environment/LandManagement/LandManager.cs
@@ -281,7 +281,7 @@ namespace OpenSim.Region.Environment.LandManagement
281 281
282 public Land getLandObject(int x, int y) 282 public Land getLandObject(int x, int y)
283 { 283 {
284 if (x >= 256 || y >= 256 || x < 0 || y < 0) 284 if (x >= Constants.RegionSize || y >= Constants.RegionSize || x < 0 || y < 0)
285 { 285 {
286 // These exceptions here will cause a lot of complaints from the users specifically because 286 // These exceptions here will cause a lot of complaints from the users specifically because
287 // they happen every time at border crossings 287 // they happen every time at border crossings
@@ -614,7 +614,7 @@ namespace OpenSim.Region.Environment.LandManagement
614 614
615 Land fullSimParcel = new Land(LLUUID.Zero, false, m_scene); 615 Land fullSimParcel = new Land(LLUUID.Zero, false, m_scene);
616 616
617 fullSimParcel.setLandBitmap(Land.getSquareLandBitmap(0, 0, 256, 256)); 617 fullSimParcel.setLandBitmap(Land.getSquareLandBitmap(0, 0, (int)Constants.RegionSize, (int)Constants.RegionSize));
618 fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID; 618 fullSimParcel.landData.ownerID = m_regInfo.MasterAvatarAssignedUUID;
619 619
620 addLandObject(fullSimParcel); 620 addLandObject(fullSimParcel);
diff --git a/OpenSim/Region/Environment/Modules/ChatModule.cs b/OpenSim/Region/Environment/Modules/ChatModule.cs
index 82bd2ec..a34bd96 100644
--- a/OpenSim/Region/Environment/Modules/ChatModule.cs
+++ b/OpenSim/Region/Environment/Modules/ChatModule.cs
@@ -223,7 +223,7 @@ namespace OpenSim.Region.Environment.Modules
223 223
224 // Filled in since it's easier than rewriting right now. 224 // Filled in since it's easier than rewriting right now.
225 LLVector3 fromPos = e.Position; 225 LLVector3 fromPos = e.Position;
226 LLVector3 regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); 226 LLVector3 regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
227 227
228 string fromName = e.From; 228 string fromName = e.From;
229 string message = e.Message; 229 string message = e.Message;
@@ -237,7 +237,7 @@ namespace OpenSim.Region.Environment.Modules
237 if (avatar != null) 237 if (avatar != null)
238 { 238 {
239 fromPos = avatar.AbsolutePosition; 239 fromPos = avatar.AbsolutePosition;
240 regionPos = new LLVector3(scene.RegionInfo.RegionLocX*256, scene.RegionInfo.RegionLocY*256, 0); 240 regionPos = new LLVector3(scene.RegionInfo.RegionLocX * Constants.RegionSize, scene.RegionInfo.RegionLocY * Constants.RegionSize, 0);
241 fromName = avatar.Firstname + " " + avatar.Lastname; 241 fromName = avatar.Firstname + " " + avatar.Lastname;
242 fromAgentID = e.Sender.AgentId; 242 fromAgentID = e.Sender.AgentId;
243 } 243 }
diff --git a/OpenSim/Region/Environment/Modules/TerrainModule.cs b/OpenSim/Region/Environment/Modules/TerrainModule.cs
new file mode 100644
index 0000000..7e163a3
--- /dev/null
+++ b/OpenSim/Region/Environment/Modules/TerrainModule.cs
@@ -0,0 +1,131 @@
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 OpenSim 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*/
28
29using Nini.Config;
30using System;
31using System.Collections;
32using System.Collections.Generic;
33using OpenSim.Framework;
34using OpenSim.Framework.Console;
35using OpenSim.Region.Environment.Interfaces;
36using OpenSim.Region.Environment.Scenes;
37using libsecondlife;
38
39namespace OpenSim.Region.Environment.Modules
40{
41 /// <summary>
42 /// A new version of the old Channel class, simplified
43 /// </summary>
44 public class TerrainChannel : ITerrainChannel
45 {
46 private double[,] map;
47
48 public int Width
49 {
50 get { return map.GetLength(0); }
51 }
52
53 public int Height
54 {
55 get { return map.GetLength(1); }
56 }
57
58 public TerrainChannel Copy()
59 {
60 TerrainChannel copy = new TerrainChannel(false);
61 copy.map = (double[,])this.map.Clone();
62
63 return copy;
64 }
65
66 public double this[int x, int y]
67 {
68 get
69 {
70 return map[x, y];
71 }
72 set
73 {
74 map[x, y] = value;
75 }
76 }
77
78 public TerrainChannel()
79 {
80 map = new double[Constants.RegionSize, Constants.RegionSize];
81 }
82
83 public TerrainChannel(bool createMap)
84 {
85 if (createMap)
86 map = new double[Constants.RegionSize, Constants.RegionSize];
87 }
88
89 public TerrainChannel(int w, int h)
90 {
91 map = new double[w, h];
92 }
93 }
94
95 public class TerrainModule : IRegionModule
96 {
97 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
98
99 Scene m_scene;
100
101 private IConfigSource m_gConfig;
102
103 public void Initialise(Scene scene, IConfigSource config)
104 {
105 m_scene = scene;
106 m_gConfig = config;
107 }
108
109 public void Close()
110 {
111
112 }
113
114 public string Name
115 {
116 get { return "TerrainModule"; }
117 }
118
119 public bool IsSharedModule
120 {
121 get { return false; }
122 }
123
124 public void PostInitialise()
125 {
126
127 }
128
129 }
130
131}
diff --git a/OpenSim/Region/Environment/Scenes/InnerScene.cs b/OpenSim/Region/Environment/Scenes/InnerScene.cs
index 7698127..48fa3dc 100644
--- a/OpenSim/Region/Environment/Scenes/InnerScene.cs
+++ b/OpenSim/Region/Environment/Scenes/InnerScene.cs
@@ -81,7 +81,7 @@ namespace OpenSim.Region.Environment.Scenes
81 m_parentScene = parent; 81 m_parentScene = parent;
82 m_regInfo = regInfo; 82 m_regInfo = regInfo;
83 PermissionsMngr = permissionsMngr; 83 PermissionsMngr = permissionsMngr;
84 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, 256, 256); 84 QuadTree = new BasicQuadTreeNode(null, "/0/", 0, 0, (short)Constants.RegionSize, (short)Constants.RegionSize);
85 QuadTree.Subdivide(); 85 QuadTree.Subdivide();
86 QuadTree.Subdivide(); 86 QuadTree.Subdivide();
87 } 87 }
diff --git a/OpenSim/Region/Environment/Scenes/Scene.cs b/OpenSim/Region/Environment/Scenes/Scene.cs
index 5842932..eec51e6 100644
--- a/OpenSim/Region/Environment/Scenes/Scene.cs
+++ b/OpenSim/Region/Environment/Scenes/Scene.cs
@@ -1232,31 +1232,31 @@ namespace OpenSim.Region.Environment.Scenes
1232 ulong newRegionHandle = 0; 1232 ulong newRegionHandle = 0;
1233 LLVector3 pos = position; 1233 LLVector3 pos = position;
1234 1234
1235 if (position.X > 257f) 1235 if (position.X > Constants.RegionSize + 0.1f)
1236 { 1236 {
1237 pos.X = ((pos.X - 256)); 1237 pos.X = ((pos.X - Constants.RegionSize));
1238 1238
1239 newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * 256), (uint)(thisy * 256)); 1239 newRegionHandle = Util.UIntsToLong((uint)((thisx + 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
1240 1240
1241 // x + 1 1241 // x + 1
1242 } 1242 }
1243 else if (position.X < -1f) 1243 else if (position.X < -0.1f)
1244 { 1244 {
1245 pos.X = ((pos.X + 256)); 1245 pos.X = ((pos.X + Constants.RegionSize));
1246 newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * 256), (uint)(thisy * 256)); 1246 newRegionHandle = Util.UIntsToLong((uint)((thisx - 1) * Constants.RegionSize), (uint)(thisy * Constants.RegionSize));
1247 // x - 1 1247 // x - 1
1248 } 1248 }
1249 1249
1250 if (position.Y > 257f) 1250 if (position.Y > Constants.RegionSize + 0.1f)
1251 { 1251 {
1252 pos.Y = ((pos.Y - 256)); 1252 pos.Y = ((pos.Y - Constants.RegionSize));
1253 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy + 1) * 256)); 1253 newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy + 1) * Constants.RegionSize));
1254 // y + 1 1254 // y + 1
1255 } 1255 }
1256 else if (position.Y < -1f) 1256 else if (position.Y < -1f)
1257 { 1257 {
1258 pos.Y = ((pos.Y + 256)); 1258 pos.Y = ((pos.Y + Constants.RegionSize));
1259 newRegionHandle = Util.UIntsToLong((uint)(thisx * 256), (uint)((thisy - 1) * 256)); 1259 newRegionHandle = Util.UIntsToLong((uint)(thisx * Constants.RegionSize), (uint)((thisy - 1) * Constants.RegionSize));
1260 // y - 1 1260 // y - 1
1261 } 1261 }
1262 1262
diff --git a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
index aa2f2d0..e8d4766 100644
--- a/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
+++ b/OpenSim/Region/Environment/Scenes/SceneObjectGroup.cs
@@ -387,7 +387,7 @@ namespace OpenSim.Region.Environment.Scenes
387 // This may need to be updated to the maximum draw distance possible.. 387 // This may need to be updated to the maximum draw distance possible..
388 // We might (and probably will) be checking for prim creation from other sims 388 // We might (and probably will) be checking for prim creation from other sims
389 // when the camera crosses the border. 389 // when the camera crosses the border.
390 float idist = 256f; 390 float idist = (float)Constants.RegionSize;
391 391
392 392
393 if (inter.HitTF) 393 if (inter.HitTF)
diff --git a/OpenSim/Region/Environment/Scenes/ScenePresence.cs b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
index 61fce39..2b02ab9 100644
--- a/OpenSim/Region/Environment/Scenes/ScenePresence.cs
+++ b/OpenSim/Region/Environment/Scenes/ScenePresence.cs
@@ -1514,12 +1514,12 @@ namespace OpenSim.Region.Environment.Scenes
1514 pos2.Y = pos2.Y + (vel.Y*timeStep); 1514 pos2.Y = pos2.Y + (vel.Y*timeStep);
1515 pos2.Z = pos2.Z + (vel.Z*timeStep); 1515 pos2.Z = pos2.Z + (vel.Z*timeStep);
1516 1516
1517 if ((pos2.X < 0) || (pos2.X > 256)) 1517 if ((pos2.X < 0) || (pos2.X > Constants.RegionSize))
1518 { 1518 {
1519 CrossToNewRegion(); 1519 CrossToNewRegion();
1520 } 1520 }
1521 1521
1522 if ((pos2.Y < 0) || (pos2.Y > 256)) 1522 if ((pos2.Y < 0) || (pos2.Y > Constants.RegionSize))
1523 { 1523 {
1524 CrossToNewRegion(); 1524 CrossToNewRegion();
1525 } 1525 }
@@ -1544,17 +1544,12 @@ namespace OpenSim.Region.Environment.Scenes
1544 // distance into new region to place avatar 1544 // distance into new region to place avatar
1545 const float enterDistance = 0.1f; 1545 const float enterDistance = 0.1f;
1546 1546
1547 // region size
1548 // TODO: this should be hard-coded in some common place
1549 const float regionWidth = 256;
1550 const float regionHeight = 256;
1551
1552 if (pos.X < boundaryDistance) 1547 if (pos.X < boundaryDistance)
1553 { 1548 {
1554 neighbourx--; 1549 neighbourx--;
1555 newpos.X = regionWidth - enterDistance; 1550 newpos.X = Constants.RegionSize - enterDistance;
1556 } 1551 }
1557 else if (pos.X > regionWidth - boundaryDistance) 1552 else if (pos.X > Constants.RegionSize - boundaryDistance)
1558 { 1553 {
1559 neighbourx++; 1554 neighbourx++;
1560 newpos.X = enterDistance; 1555 newpos.X = enterDistance;
@@ -1563,16 +1558,16 @@ namespace OpenSim.Region.Environment.Scenes
1563 if (pos.Y < boundaryDistance) 1558 if (pos.Y < boundaryDistance)
1564 { 1559 {
1565 neighboury--; 1560 neighboury--;
1566 newpos.Y = regionHeight - enterDistance; 1561 newpos.Y = Constants.RegionSize - enterDistance;
1567 } 1562 }
1568 else if (pos.Y > regionHeight - boundaryDistance) 1563 else if (pos.Y > Constants.RegionSize - boundaryDistance)
1569 { 1564 {
1570 neighboury++; 1565 neighboury++;
1571 newpos.Y = enterDistance; 1566 newpos.Y = enterDistance;
1572 } 1567 }
1573 1568
1574 LLVector3 vel = m_velocity; 1569 LLVector3 vel = m_velocity;
1575 ulong neighbourHandle = Helpers.UIntsToLong((uint) (neighbourx*256), (uint) (neighboury*256)); 1570 ulong neighbourHandle = Helpers.UIntsToLong((uint)(neighbourx * Constants.RegionSize), (uint)(neighboury * Constants.RegionSize));
1576 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle); 1571 SimpleRegionInfo neighbourRegion = m_scene.RequestNeighbouringRegionInfo(neighbourHandle);
1577 if (neighbourRegion != null) 1572 if (neighbourRegion != null)
1578 { 1573 {
@@ -1622,8 +1617,8 @@ namespace OpenSim.Region.Environment.Scenes
1622 public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY) 1617 public void ChildAgentDataUpdate(ChildAgentDataUpdate cAgentData, uint tRegionX, uint tRegionY, uint rRegionX, uint rRegionY)
1623 { 1618 {
1624 // 1619 //
1625 int shiftx = ((int)rRegionX - (int)tRegionX) * 256; 1620 int shiftx = ((int)rRegionX - (int)tRegionX) * (int)Constants.RegionSize;
1626 int shifty = ((int)rRegionY - (int)tRegionY) * 256; 1621 int shifty = ((int)rRegionY - (int)tRegionY) * (int)Constants.RegionSize;
1627 1622
1628 m_DrawDistance = cAgentData.drawdistance; 1623 m_DrawDistance = cAgentData.drawdistance;
1629 m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z); 1624 m_pos = new LLVector3(cAgentData.Position.x + shiftx, cAgentData.Position.y + shifty, cAgentData.Position.z);
diff --git a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
index a32bca5..d767eab 100644
--- a/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
+++ b/OpenSim/Region/Physics/BasicPhysicsPlugin/BasicPhysicsPlugin.cs
@@ -137,7 +137,7 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
137 { 137 {
138 actor.Position.Y = 0.1F; 138 actor.Position.Y = 0.1F;
139 } 139 }
140 else if (actor.Position.Y >= 256) 140 else if (actor.Position.Y >= Constants.RegionSize)
141 { 141 {
142 actor.Position.Y = 255.9F; 142 actor.Position.Y = 255.9F;
143 } 143 }
@@ -146,16 +146,16 @@ namespace OpenSim.Region.Physics.BasicPhysicsPlugin
146 { 146 {
147 actor.Position.X = 0.1F; 147 actor.Position.X = 0.1F;
148 } 148 }
149 else if (actor.Position.X >= 256) 149 else if (actor.Position.X >= Constants.RegionSize)
150 { 150 {
151 actor.Position.X = 255.9F; 151 actor.Position.X = 255.9F;
152 } 152 }
153 153
154 float height = _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 1.0f; 154 float height = _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 1.0f;
155 if (actor.Flying) 155 if (actor.Flying)
156 { 156 {
157 if (actor.Position.Z + (actor.Velocity.Z*timeStep) < 157 if (actor.Position.Z + (actor.Velocity.Z*timeStep) <
158 _heightMap[(int) actor.Position.Y*256 + (int) actor.Position.X] + 2) 158 _heightMap[(int)actor.Position.Y * Constants.RegionSize + (int)actor.Position.X] + 2)
159 { 159 {
160 actor.Position.Z = height; 160 actor.Position.Z = height;
161 actor.Velocity.Z = 0; 161 actor.Velocity.Z = 0;
diff --git a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
index 5a8589c..314708f 100644
--- a/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
+++ b/OpenSim/Region/Physics/BulletXPlugin/BulletXPlugin.cs
@@ -336,7 +336,7 @@ namespace OpenSim.Region.Physics.BulletXPlugin
336 336
337 private const int minXY = 0; 337 private const int minXY = 0;
338 private const int minZ = 0; 338 private const int minZ = 0;
339 private const int maxXY = 256; 339 private const int maxXY = (int)Constants.RegionSize;
340 private const int maxZ = 4096; 340 private const int maxZ = 4096;
341 private const int maxHandles = 32766; //Why? I don't know 341 private const int maxHandles = 32766; //Why? I don't know
342 private const float gravity = 9.8f; 342 private const float gravity = 9.8f;
diff --git a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
index 4fbf653..3d70a3d 100644
--- a/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
+++ b/OpenSim/Region/Physics/OdePlugin/OdePlugin.cs
@@ -85,9 +85,9 @@ namespace OpenSim.Region.Physics.OdePlugin
85 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType); 85 private static readonly log4net.ILog m_log = log4net.LogManager.GetLogger(System.Reflection.MethodBase.GetCurrentMethod().DeclaringType);
86 86
87 CollisionLocker ode; 87 CollisionLocker ode;
88 // TODO: this should be hard-coded in some common place 88
89 private const uint m_regionWidth = 256; 89 private const uint m_regionWidth = Constants.RegionSize;
90 private const uint m_regionHeight = 256; 90 private const uint m_regionHeight = Constants.RegionSize;
91 91
92 private static float ODE_STEPSIZE = 0.020f; 92 private static float ODE_STEPSIZE = 0.020f;
93 private static bool RENDER_FLAG = false; 93 private static bool RENDER_FLAG = false;
@@ -585,7 +585,7 @@ namespace OpenSim.Region.Physics.OdePlugin
585 } 585 }
586 private float GetTerrainHeightAtXY(float x, float y) 586 private float GetTerrainHeightAtXY(float x, float y)
587 { 587 {
588 return (float)_origheightmap[(int) y*256 + (int) x]; 588 return (float)_origheightmap[(int)y * Constants.RegionSize + (int)x];
589 589
590 590
591 } 591 }
diff --git a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
index 7652934..3bd25f6 100644
--- a/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
+++ b/OpenSim/Region/Physics/POSPlugin/POSPlugin.cs
@@ -203,21 +203,21 @@ namespace OpenSim.Region.Physics.POSPlugin
203 { 203 {
204 character.Position.Y = 0.1F; 204 character.Position.Y = 0.1F;
205 } 205 }
206 else if (character.Position.Y >= 256) 206 else if (character.Position.Y >= Constants.RegionSize)
207 { 207 {
208 character.Position.Y = 255.9F; 208 character.Position.Y = Constants.RegionSize - 0.1f;
209 } 209 }
210 210
211 if (character.Position.X < 0) 211 if (character.Position.X < 0)
212 { 212 {
213 character.Position.X = 0.1F; 213 character.Position.X = 0.1F;
214 } 214 }
215 else if (character.Position.X >= 256) 215 else if (character.Position.X >= Constants.RegionSize)
216 { 216 {
217 character.Position.X = 255.9F; 217 character.Position.X = Constants.RegionSize - 0.1f;
218 } 218 }
219 219
220 float terrainheight = _heightMap[(int) character.Position.Y*256 + (int) character.Position.X]; 220 float terrainheight = _heightMap[(int)character.Position.Y * Constants.RegionSize + (int)character.Position.X];
221 if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2) 221 if (character.Position.Z + (character._target_velocity.Z*timeStep) < terrainheight + 2)
222 { 222 {
223 character.Position.Z = terrainheight + 1.0f; 223 character.Position.Z = terrainheight + 1.0f;
@@ -269,18 +269,18 @@ namespace OpenSim.Region.Physics.POSPlugin
269 { 269 {
270 character.Position.Y = 0.1F; 270 character.Position.Y = 0.1F;
271 } 271 }
272 else if (character.Position.Y >= 256) 272 else if (character.Position.Y >= Constants.RegionSize)
273 { 273 {
274 character.Position.Y = 255.9F; 274 character.Position.Y = Constants.RegionSize - 0.1f;
275 } 275 }
276 276
277 if (character.Position.X < 0) 277 if (character.Position.X < 0)
278 { 278 {
279 character.Position.X = 0.1F; 279 character.Position.X = 0.1F;
280 } 280 }
281 else if (character.Position.X >= 256) 281 else if (character.Position.X >= Constants.RegionSize)
282 { 282 {
283 character.Position.X = 255.9F; 283 character.Position.X = Constants.RegionSize - 0.1f;
284 } 284 }
285 285
286 character._velocity.X = (character.Position.X - oldposX)/timeStep; 286 character._velocity.X = (character.Position.X - oldposX)/timeStep;
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
index 2fc610a..c350301 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_BuiltIn_Commands.cs
@@ -2232,7 +2232,7 @@ namespace OpenSim.Region.ScriptEngine.Common
2232 public LSL_Types.Vector3 llGetRegionCorner() 2232 public LSL_Types.Vector3 llGetRegionCorner()
2233 { 2233 {
2234 m_host.AddScriptLPS(1); 2234 m_host.AddScriptLPS(1);
2235 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * 256, World.RegionInfo.RegionLocY * 256, 0); 2235 return new LSL_Types.Vector3(World.RegionInfo.RegionLocX * Constants.RegionSize, World.RegionInfo.RegionLocY * Constants.RegionSize, 0);
2236 } 2236 }
2237 2237
2238 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start) 2238 public LSL_Types.list llListInsertList(LSL_Types.list dest, LSL_Types.list src, int start)
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
index 5c8b4b5..58586c0 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/Compiler/LSL/Compiler.cs
@@ -272,41 +272,59 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL
272 switch (l) 272 switch (l)
273 { 273 {
274 case enumCompileType.cs: 274 case enumCompileType.cs:
275 compileScript = String.Empty + 275 compileScript = CreateCSCompilerScript(compileScript);
276 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
277 String.Empty + "namespace SecondLife { " +
278 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
279 @"public Script() { } " +
280 compileScript +
281 "} }\r\n";
282 break; 276 break;
283 case enumCompileType.vb: 277 case enumCompileType.vb:
284 compileScript = String.Empty + 278 compileScript = CreateVBCompilerScript(compileScript);
285 "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " +
286 String.Empty + "NameSpace SecondLife:" +
287 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
288 "\r\nPublic Sub New()\r\nEnd Sub: " +
289 compileScript +
290 ":End Class :End Namespace\r\n";
291 break; 279 break;
292 case enumCompileType.js: 280 case enumCompileType.js:
293 compileScript = String.Empty + 281 compileScript = CreateJSCompilerScript(compileScript);
294 "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" +
295 "package SecondLife {\r\n" +
296 "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
297 compileScript +
298 "} }\r\n";
299 break; 282 break;
300 } 283 }
301 return CompileFromCSorVBText(compileScript, l); 284 return CompileFromDotNetText(compileScript, l);
285 }
286
287 private static string CreateJSCompilerScript(string compileScript)
288 {
289 compileScript = String.Empty +
290 "import OpenSim.Region.ScriptEngine.Common; import System.Collections.Generic;\r\n" +
291 "package SecondLife {\r\n" +
292 "class Script extends OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
293 compileScript +
294 "} }\r\n";
295 return compileScript;
296 }
297
298 private static string CreateCSCompilerScript(string compileScript)
299 {
300 compileScript = String.Empty +
301 "using OpenSim.Region.ScriptEngine.Common; using System.Collections.Generic;\r\n" +
302 String.Empty + "namespace SecondLife { " +
303 String.Empty + "public class Script : OpenSim.Region.ScriptEngine.Common.LSL_BaseClass { \r\n" +
304 @"public Script() { } " +
305 compileScript +
306 "} }\r\n";
307 return compileScript;
308 }
309
310 private static string CreateVBCompilerScript(string compileScript)
311 {
312 compileScript = String.Empty +
313 "Imports OpenSim.Region.ScriptEngine.Common: Imports System.Collections.Generic: " +
314 String.Empty + "NameSpace SecondLife:" +
315 String.Empty + "Public Class Script: Inherits OpenSim.Region.ScriptEngine.Common.LSL_BaseClass: " +
316 "\r\nPublic Sub New()\r\nEnd Sub: " +
317 compileScript +
318 ":End Class :End Namespace\r\n";
319 return compileScript;
302 } 320 }
303 321
304 /// <summary> 322 /// <summary>
305 /// Compile CS script to .Net assembly (.dll) 323 /// Compile .NET script to .Net assembly (.dll)
306 /// </summary> 324 /// </summary>
307 /// <param name="Script">CS script</param> 325 /// <param name="Script">CS script</param>
308 /// <returns>Filename to .dll assembly</returns> 326 /// <returns>Filename to .dll assembly</returns>
309 internal string CompileFromCSorVBText(string Script, enumCompileType lang) 327 internal string CompileFromDotNetText(string Script, enumCompileType lang)
310 { 328 {
311 string ext = "." + lang.ToString(); 329 string ext = "." + lang.ToString();
312 330