GridManager.GetRegions() now returns a List, not a Dictionary. Also removed some trailing whitespace.

0.6.0-stable
Mike Mazur 2008-10-29 02:27:39 +00:00
parent f9eb3712ed
commit 3fd35f9fbe
1 changed files with 34 additions and 39 deletions

View File

@ -165,19 +165,15 @@ namespace OpenSim.Grid.GridServer
return null; return null;
} }
public Dictionary<ulong, RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax) public List<RegionProfileData> GetRegions(uint xmin, uint ymin, uint xmax, uint ymax)
{ {
Dictionary<ulong, RegionProfileData> regions = new Dictionary<ulong, RegionProfileData>(); List<RegionProfileData> regions = new List<RegionProfileData>();
foreach (IGridDataPlugin plugin in _plugins) foreach (IGridDataPlugin plugin in _plugins)
{ {
try try
{ {
RegionProfileData[] neighbours = plugin.GetProfilesInRange(xmin, ymin, xmax, ymax); regions.AddRange(plugin.GetProfilesInRange(xmin, ymin, xmax, ymax));
foreach (RegionProfileData neighbour in neighbours)
{
regions[neighbour.regionHandle] = neighbour;
}
} }
catch catch
{ {
@ -530,21 +526,21 @@ namespace OpenSim.Grid.GridServer
Hashtable NeighbourBlock; Hashtable NeighbourBlock;
//First use the fast method. (not implemented in SQLLite) //First use the fast method. (not implemented in SQLLite)
Dictionary<ulong, RegionProfileData> neighbours = GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1); List<RegionProfileData> neighbours = GetRegions(sim.regionLocX - 1, sim.regionLocY - 1, sim.regionLocX + 1, sim.regionLocY + 1);
if (neighbours.Count > 0) if (neighbours.Count > 0)
{ {
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) foreach (RegionProfileData aSim in neighbours)
{ {
NeighbourBlock = new Hashtable(); NeighbourBlock = new Hashtable();
NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.Value.serverIP.ToString()).ToString(); NeighbourBlock["sim_ip"] = Util.GetHostFromDNS(aSim.serverIP.ToString()).ToString();
NeighbourBlock["sim_port"] = aSim.Value.serverPort.ToString(); NeighbourBlock["sim_port"] = aSim.serverPort.ToString();
NeighbourBlock["region_locx"] = aSim.Value.regionLocX.ToString(); NeighbourBlock["region_locx"] = aSim.regionLocX.ToString();
NeighbourBlock["region_locy"] = aSim.Value.regionLocY.ToString(); NeighbourBlock["region_locy"] = aSim.regionLocY.ToString();
NeighbourBlock["UUID"] = aSim.Value.ToString(); NeighbourBlock["UUID"] = aSim.ToString();
NeighbourBlock["regionHandle"] = aSim.Value.regionHandle.ToString(); NeighbourBlock["regionHandle"] = aSim.regionHandle.ToString();
if (aSim.Value.UUID != sim.UUID) if (aSim.UUID != sim.UUID)
{ {
SimNeighboursData.Add(NeighbourBlock); SimNeighboursData.Add(NeighbourBlock);
} }
@ -835,29 +831,28 @@ namespace OpenSim.Grid.GridServer
if (fastMode) if (fastMode)
{ {
Dictionary<ulong, RegionProfileData> neighbours = List<RegionProfileData> neighbours = GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
GetRegions((uint)xmin, (uint)ymin, (uint)xmax, (uint)ymax);
foreach (KeyValuePair<ulong, RegionProfileData> aSim in neighbours) foreach (RegionProfileData aSim in neighbours)
{ {
Hashtable simProfileBlock = new Hashtable(); Hashtable simProfileBlock = new Hashtable();
simProfileBlock["x"] = aSim.Value.regionLocX.ToString(); simProfileBlock["x"] = aSim.regionLocX.ToString();
simProfileBlock["y"] = aSim.Value.regionLocY.ToString(); simProfileBlock["y"] = aSim.regionLocY.ToString();
//m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.Value.regionLocX, aSim.Value.regionLocY); //m_log.DebugFormat("[MAP]: Sending neighbour info for {0},{1}", aSim.regionLocX, aSim.regionLocY);
simProfileBlock["name"] = aSim.Value.regionName; simProfileBlock["name"] = aSim.regionName;
simProfileBlock["access"] = 21; simProfileBlock["access"] = 21;
simProfileBlock["region-flags"] = 512; simProfileBlock["region-flags"] = 512;
simProfileBlock["water-height"] = 0; simProfileBlock["water-height"] = 0;
simProfileBlock["agents"] = 1; simProfileBlock["agents"] = 1;
simProfileBlock["map-image-id"] = aSim.Value.regionMapTextureID.ToString(); simProfileBlock["map-image-id"] = aSim.regionMapTextureID.ToString();
// For Sugilite compatibility // For Sugilite compatibility
simProfileBlock["regionhandle"] = aSim.Value.regionHandle.ToString(); simProfileBlock["regionhandle"] = aSim.regionHandle.ToString();
simProfileBlock["sim_ip"] = aSim.Value.serverIP.ToString(); simProfileBlock["sim_ip"] = aSim.serverIP.ToString();
simProfileBlock["sim_port"] = aSim.Value.serverPort.ToString(); simProfileBlock["sim_port"] = aSim.serverPort.ToString();
simProfileBlock["sim_uri"] = aSim.Value.serverURI.ToString(); simProfileBlock["sim_uri"] = aSim.serverURI.ToString();
simProfileBlock["uuid"] = aSim.Value.UUID.ToString(); simProfileBlock["uuid"] = aSim.UUID.ToString();
simProfileBlock["remoting_port"] = aSim.Value.remotingPort; simProfileBlock["remoting_port"] = aSim.remotingPort;
simProfileList.Add(simProfileBlock); simProfileList.Add(simProfileBlock);
} }