MapBlockFromGridRegion and Map2BlockFromGridRegion are the same thing

avinationmerge
UbitUmarov 2015-09-18 02:00:10 +01:00
parent 4798cce390
commit 87ad573ec2
3 changed files with 16 additions and 63 deletions

View File

@ -201,23 +201,12 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
data = new MapBlockData(); data = new MapBlockData();
data.Agents = 0; data.Agents = 0;
data.Access = info.Access; data.Access = info.Access;
if (flags == 2) // V2 sends this MapBlockData block = new MapBlockData();
{ WorldMap.MapBlockFromGridRegion(block, info, flags);
List<MapBlockData> datas = WorldMap.Map2BlockFromGridRegion(info, flags);
// ugh! V2-3 is very sensitive about the result being
// exactly the same as the requested name
if (regionInfos.Count == 1 && needOriginalName) if (flags == 2 && regionInfos.Count == 1 && needOriginalName)
datas.ForEach(d => d.Name = mapNameOrig); block.Name = mapNameOrig;
blocks.Add(block);
blocks.AddRange(datas);
}
else
{
MapBlockData block = new MapBlockData();
WorldMap.MapBlockFromGridRegion(block,info, flags);
blocks.Add(block);
}
} }
} }

View File

@ -1100,18 +1100,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (r == null) if (r == null)
continue; continue;
MapBlockData block = new MapBlockData(); MapBlockData block = new MapBlockData();
if ((flag & 2) == 2) MapBlockFromGridRegion(block, r, flag);
{ mapBlocks.Add(block);
List<MapBlockData> blocks = Map2BlockFromGridRegion(r, flag); allBlocks.Add(block);
mapBlocks.AddRange(blocks);
allBlocks.AddRange(blocks);
}
else
{
MapBlockFromGridRegion(block, r, flag);
mapBlocks.Add(block);
allBlocks.Add(block);
}
if (mapBlocks.Count >= 10) if (mapBlocks.Count >= 10)
{ {
@ -1128,6 +1119,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag) public void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
{ {
if (r == null)
{
// block.Access = (byte)SimAccess.Down;
block.Access = (byte)SimAccess.NonExistent;
block.MapImageId = UUID.Zero;
return;
}
block.Access = r.Access; block.Access = r.Access;
switch (flag) switch (flag)
{ {
@ -1146,41 +1145,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
block.SizeX = (ushort)r.RegionSizeX; block.SizeX = (ushort)r.RegionSizeX;
block.SizeY = (ushort)r.RegionSizeY; block.SizeY = (ushort)r.RegionSizeY;
}
public List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag)
{
List<MapBlockData> blocks = new List<MapBlockData>();
MapBlockData block = new MapBlockData();
if (r == null)
{
block.Access = (byte)SimAccess.Down;
block.MapImageId = UUID.Zero;
blocks.Add(block);
}
else
{
block.Access = r.Access;
switch (flag & 0xffff)
{
case 0:
block.MapImageId = r.TerrainImage;
break;
case 2:
block.MapImageId = r.ParcelImage;
break;
default:
block.MapImageId = UUID.Zero;
break;
}
block.Name = r.RegionName;
block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
block.SizeX = (ushort)r.RegionSizeX;
block.SizeY = (ushort)r.RegionSizeY;
blocks.Add(block);
}
return blocks;
} }
public Hashtable OnHTTPThrottled(Hashtable keysvals) public Hashtable OnHTTPThrottled(Hashtable keysvals)

View File

@ -36,7 +36,6 @@ namespace OpenSim.Region.Framework.Interfaces
/// Generate a map tile for the scene. a terrain texture for this scene /// Generate a map tile for the scene. a terrain texture for this scene
/// </summary> /// </summary>
void GenerateMaptile(); void GenerateMaptile();
List<MapBlockData> Map2BlockFromGridRegion(GridRegion r, uint flag);
void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag); void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag);
} }
} }