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,25 +201,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
data = new MapBlockData();
data.Agents = 0;
data.Access = info.Access;
if (flags == 2) // V2 sends this
{
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)
datas.ForEach(d => d.Name = mapNameOrig);
blocks.AddRange(datas);
}
else
{
MapBlockData block = new MapBlockData();
WorldMap.MapBlockFromGridRegion(block, info, flags);
if (flags == 2 && regionInfos.Count == 1 && needOriginalName)
block.Name = mapNameOrig;
blocks.Add(block);
}
}
}
// final block, closing the search result
if(blocks.Count == 0)

View File

@ -1100,18 +1100,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
if (r == null)
continue;
MapBlockData block = new MapBlockData();
if ((flag & 2) == 2)
{
List<MapBlockData> blocks = Map2BlockFromGridRegion(r, flag);
mapBlocks.AddRange(blocks);
allBlocks.AddRange(blocks);
}
else
{
MapBlockFromGridRegion(block, r, flag);
mapBlocks.Add(block);
allBlocks.Add(block);
}
if (mapBlocks.Count >= 10)
{
@ -1128,6 +1119,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
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;
switch (flag)
{
@ -1146,41 +1145,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
block.SizeX = (ushort)r.RegionSizeX;
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)

View File

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