mirror of
https://github.com/opensim/opensim.git
synced 2026-08-11 11:57:03 +08:00
* 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.
This commit is contained in:
@@ -203,13 +203,13 @@ namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
if (
|
||||
getRegion(
|
||||
Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256),
|
||||
(uint) (central_region.regionLocY + y)*256)) != null)
|
||||
Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
|
||||
(uint)(central_region.regionLocY + y) * Constants.RegionSize)) != null)
|
||||
{
|
||||
neighbour =
|
||||
getRegion(
|
||||
Util.UIntsToLong((uint) ((central_region.regionLocX + x)*256),
|
||||
(uint) (central_region.regionLocY + y)*256));
|
||||
Util.UIntsToLong((uint)((central_region.regionLocX + x) * Constants.RegionSize),
|
||||
(uint)(central_region.regionLocY + y) * Constants.RegionSize));
|
||||
response += "<neighbour>";
|
||||
response += "<sim_ip>" + neighbour.serverIP + "</sim_ip>";
|
||||
response += "<sim_port>" + neighbour.serverPort.ToString() + "</sim_port>";
|
||||
@@ -303,7 +303,7 @@ namespace OpenSim.Grid.GridServer
|
||||
}
|
||||
catch (KeyNotFoundException) { }
|
||||
|
||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * 256), (TheSim.regionLocY * 256));
|
||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
|
||||
TheSim.serverURI = "http://" + TheSim.serverIP + ":" + TheSim.serverPort + "/";
|
||||
|
||||
TheSim.httpServerURI = "http://" + TheSim.serverIP + ":" + TheSim.httpPort + "/";
|
||||
@@ -416,13 +416,13 @@ namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
if (
|
||||
getRegion(
|
||||
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256),
|
||||
(uint)(TheSim.regionLocY + y) * 256)) != null)
|
||||
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * Constants.RegionSize),
|
||||
(uint)(TheSim.regionLocY + y) * Constants.RegionSize)) != null)
|
||||
{
|
||||
neighbour =
|
||||
getRegion(
|
||||
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * 256),
|
||||
(uint)(TheSim.regionLocY + y) * 256));
|
||||
Helpers.UIntsToLong((uint)((TheSim.regionLocX + x) * Constants.RegionSize),
|
||||
(uint)(TheSim.regionLocY + y) * Constants.RegionSize));
|
||||
|
||||
NeighbourBlock = new Hashtable();
|
||||
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(neighbour.serverIP).ToString();
|
||||
@@ -604,7 +604,7 @@ namespace OpenSim.Grid.GridServer
|
||||
{
|
||||
for (int y = ymin; y < ymax + 1; y++)
|
||||
{
|
||||
ulong regHandle = Helpers.UIntsToLong((uint) (x*256), (uint) (y*256));
|
||||
ulong regHandle = Helpers.UIntsToLong((uint)(x * Constants.RegionSize), (uint)(y * Constants.RegionSize));
|
||||
simProfile = getRegion(regHandle);
|
||||
if (simProfile != null)
|
||||
{
|
||||
@@ -764,12 +764,12 @@ namespace OpenSim.Grid.GridServer
|
||||
|
||||
case "region_locx":
|
||||
TheSim.regionLocX = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
|
||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
|
||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
|
||||
break;
|
||||
|
||||
case "region_locy":
|
||||
TheSim.regionLocY = Convert.ToUInt32((string) simnode.ChildNodes[i].InnerText);
|
||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX*256), (TheSim.regionLocY*256));
|
||||
TheSim.regionHandle = Helpers.UIntsToLong((TheSim.regionLocX * Constants.RegionSize), (TheSim.regionLocY * Constants.RegionSize));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -787,9 +787,9 @@ namespace OpenSim.Grid.GridServer
|
||||
return "ERROR! Servers must register with public addresses.";
|
||||
}
|
||||
|
||||
if (requireValid && (TheSim.serverIP.StartsWith("0.")))
|
||||
if (requireValid && (TheSim.serverIP.StartsWith("0.") || TheSim.serverIP.StartsWith("255.")))
|
||||
{
|
||||
return "ERROR! 0.*.*.* Addresses are invalid, please check your server config and try again";
|
||||
return "ERROR! 0.*.*.* / 255.*.*.* Addresses are invalid, please check your server config and try again";
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -451,7 +451,7 @@ namespace OpenSim.Grid.MessagingServer
|
||||
regionProfile = new RegionProfileData();
|
||||
regionProfile.httpPort = (uint)Convert.ToInt32((string)responseData["http_port"]);
|
||||
regionProfile.httpServerURI = "http://" + internalIpStr + ":" + regionProfile.httpPort + "/";
|
||||
regionProfile.regionHandle = Helpers.UIntsToLong((regX * 256), (regY * 256));
|
||||
regionProfile.regionHandle = Helpers.UIntsToLong((regX * Constants.RegionSize), (regY * Constants.RegionSize));
|
||||
regionProfile.regionLocX = regX;
|
||||
regionProfile.regionLocY = regY;
|
||||
|
||||
|
||||
@@ -82,8 +82,8 @@ namespace OpenSim.Grid.UserServer
|
||||
// Customise the response
|
||||
//CFK: This is redundant and the next message should always appear.
|
||||
//CFK: m_log.Info("[LOGIN]: Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY*256).ToString() + "], " +
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
|
||||
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
|
||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
@@ -144,7 +144,7 @@ namespace OpenSim.Grid.UserServer
|
||||
// Send him to default region instead
|
||||
// Load information from the gridserver
|
||||
|
||||
ulong defaultHandle = (((ulong) m_config.DefaultX*256) << 32) | ((ulong) m_config.DefaultY*256);
|
||||
ulong defaultHandle = (((ulong)m_config.DefaultX * Constants.RegionSize) << 32) | ((ulong)m_config.DefaultY * Constants.RegionSize);
|
||||
|
||||
m_log.Warn(
|
||||
"[LOGIN]: Home region not available: sending to default " + defaultHandle.ToString());
|
||||
@@ -158,8 +158,8 @@ namespace OpenSim.Grid.UserServer
|
||||
|
||||
// Customise the response
|
||||
m_log.Info("[LOGIN]: Home Location");
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX*256).ToString() + ",r" +
|
||||
(SimInfo.regionLocY*256).ToString() + "], " +
|
||||
response.Home = "{'region_handle':[r" + (SimInfo.regionLocX * Constants.RegionSize).ToString() + ",r" +
|
||||
(SimInfo.regionLocY * Constants.RegionSize).ToString() + "], " +
|
||||
"'position':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
theUser.homeLocation.Y.ToString() + ",r" + theUser.homeLocation.Z.ToString() + "], " +
|
||||
"'look_at':[r" + theUser.homeLocation.X.ToString() + ",r" +
|
||||
|
||||
Reference in New Issue
Block a user