From f3afa68a2af6ad5999e6efe3e4725cb17293108d Mon Sep 17 00:00:00 2001
From: Adam Frisby
Date: Thu, 14 Feb 2008 12:16:33 +0000
Subject: * 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.
---
OpenSim/Framework/Communications/LoginResponse.cs | 10 +++++-----
OpenSim/Framework/Constants.cs | 11 +++++++++++
OpenSim/Framework/Data/RegionProfileData.cs | 4 ++--
OpenSim/Framework/RegionHandle.cs | 6 +++---
OpenSim/Framework/RegionInfo.cs | 2 +-
OpenSim/Framework/SerializableRegionInfo.cs | 2 +-
OpenSim/Framework/UserProfileData.cs | 2 +-
7 files changed, 24 insertions(+), 13 deletions(-)
create mode 100644 OpenSim/Framework/Constants.cs
(limited to 'OpenSim/Framework')
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
ErrorReason = "key";
welcomeMessage = "Welcome to OpenSim!";
seedCapability = String.Empty;
- home = "{'region_handle':[r" + (1000*256).ToString() + ",r" + (1000*256).ToString() + "], 'position':[r" +
+ home = "{'region_handle':[r" + (1000*Constants.RegionSize).ToString() + ",r" + (1000*Constants.RegionSize).ToString() + "], 'position':[r" +
userProfile.homepos.X.ToString() + ",r" + userProfile.homepos.Y.ToString() + ",r" +
userProfile.homepos.Z.ToString() + "], 'look_at':[r" + userProfile.homelookat.X.ToString() + ",r" +
userProfile.homelookat.Y.ToString() + ",r" + userProfile.homelookat.Z.ToString() + "]}";
@@ -347,8 +347,8 @@ namespace OpenSim.Framework.UserManagement
responseData["home"] = home;
responseData["look_at"] = lookAt;
responseData["message"] = welcomeMessage;
- responseData["region_x"] = (Int32) RegionX*256;
- responseData["region_y"] = (Int32) RegionY*256;
+ responseData["region_x"] = (Int32)RegionX * Constants.RegionSize;
+ responseData["region_y"] = (Int32)RegionY * Constants.RegionSize;
//responseData["inventory-lib-root"] = new ArrayList(); // todo
@@ -447,8 +447,8 @@ namespace OpenSim.Framework.UserManagement
map["home"] = LLSD.FromString(home);
map["look_at"] = LLSD.FromString(lookAt);
map["message"] = LLSD.FromString(welcomeMessage);
- map["region_x"] = LLSD.FromInteger(RegionX * 256);
- map["region_y"] = LLSD.FromInteger(RegionY * 256);
+ map["region_x"] = LLSD.FromInteger(RegionX * Constants.RegionSize);
+ map["region_y"] = LLSD.FromInteger(RegionY * Constants.RegionSize);
if (m_buddyList != null)
{
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 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace OpenSim.Framework
+{
+ public class Constants
+ {
+ public const uint RegionSize = 256;
+ }
+}
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
RegionProfileData simData = new RegionProfileData();
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
- simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
+ simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
simData.serverIP = (string) responseData["sim_ip"];
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
simData.httpPort = Convert.ToUInt32((string) responseData["http_port"]);
@@ -203,7 +203,7 @@ namespace OpenSim.Framework.Data
RegionProfileData simData = new RegionProfileData();
simData.regionLocX = Convert.ToUInt32((string) responseData["region_locx"]);
simData.regionLocY = Convert.ToUInt32((string) responseData["region_locy"]);
- simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX*256), (simData.regionLocY*256));
+ simData.regionHandle = Helpers.UIntsToLong((simData.regionLocX * Constants.RegionSize), (simData.regionLocY * Constants.RegionSize));
simData.serverIP = (string) responseData["sim_ip"];
simData.serverPort = Convert.ToUInt32((string) responseData["sim_port"]);
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
uint ny = (uint) y;
// Multiply grid coords to get region coords
- nx *= 256;
- ny *= 256;
+ nx *= Constants.RegionSize;
+ ny *= Constants.RegionSize;
// Stuff the IP address in too
nx = (uint) a << 16;
@@ -80,7 +80,7 @@ namespace OpenSim.Framework
/// Grid Y Coordinate
public RegionHandle(uint x, uint y)
{
- handle = ((x*256) << 32) | (y*256);
+ handle = ((x * Constants.RegionSize) << 32) | (y * Constants.RegionSize);
}
///
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
public ulong RegionHandle
{
- get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
+ get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); }
}
}
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
public ulong RegionHandle
{
- get { return Util.UIntsToLong((RegionLocX*256), (RegionLocY*256)); }
+ get { return Util.UIntsToLong((RegionLocX * (uint)Constants.RegionSize), (RegionLocY * (uint)Constants.RegionSize)); }
}
}
}
\ 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
///
public ulong homeRegion
{
- get { return Helpers.UIntsToLong((homeRegionX*256), (homeRegionY*256)); }
+ get { return Helpers.UIntsToLong((homeRegionX * (uint)Constants.RegionSize), (homeRegionY * (uint)Constants.RegionSize)); }
set
{
homeRegionX = (uint) (value >> 40);
--
cgit v1.1