Some plumbing for map overlays

iar_mods
Melanie 2012-01-30 19:46:55 +00:00
parent 00d1c88c59
commit df9c35bc0f
1 changed files with 20 additions and 15 deletions

View File

@ -955,8 +955,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
List<MapBlockData> response = new List<MapBlockData>(); List<MapBlockData> response = new List<MapBlockData>();
// this should return one mapblock at most. // this should return one mapblock at most. It is triggered by a click
// (diva note: why?? in that case we should GetRegionByPosition) // on an unloaded square.
// But make sure: Look whether the one we requested is in there // But make sure: Look whether the one we requested is in there
List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID, List<GridRegion> regions = m_scene.GridService.GetRegionRange(m_scene.RegionInfo.ScopeID,
minX * (int)Constants.RegionSize, minX * (int)Constants.RegionSize,
@ -973,7 +973,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
// found it => add it to response // found it => add it to response
MapBlockData block = new MapBlockData(); MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r); MapBlockFromGridRegion(block, r, flag);
response.Add(block); response.Add(block);
break; break;
} }
@ -989,10 +989,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
block.Access = 254; // means 'simulator is offline' block.Access = 254; // means 'simulator is offline'
response.Add(block); response.Add(block);
} }
if ((flag & 2) == 2) // V2 !!! // The lower 16 bits are an unsigned int16
remoteClient.SendMapBlock(response, 2); remoteClient.SendMapBlock(response, flags & 0xffff);
else
remoteClient.SendMapBlock(response, 0);
} }
else else
{ {
@ -1012,21 +1010,28 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
foreach (GridRegion r in regions) foreach (GridRegion r in regions)
{ {
MapBlockData block = new MapBlockData(); MapBlockData block = new MapBlockData();
MapBlockFromGridRegion(block, r); MapBlockFromGridRegion(block, r, flag);
mapBlocks.Add(block); mapBlocks.Add(block);
} }
if ((flag & 2) == 2) // V2 !!! remoteClient.SendMapBlock(mapBlocks, flag & 0xffff);
remoteClient.SendMapBlock(mapBlocks, 2);
else
remoteClient.SendMapBlock(mapBlocks, 0);
return mapBlocks; return mapBlocks;
} }
protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r) protected void MapBlockFromGridRegion(MapBlockData block, GridRegion r, uint flag)
{ {
block.Access = r.Access; block.Access = r.Access;
block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID; switch (flag & 0xffff)
{
case 0:
block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID;
break;
case 2:
block.MapImageId = m_scene.RegionInfo.RegionSettings.ParcelImageID;
break;
default:
block.MapImageId = UUID.Zero;
}
block.Name = r.RegionName; block.Name = r.RegionName;
block.X = (ushort)(r.RegionLocX / Constants.RegionSize); block.X = (ushort)(r.RegionLocX / Constants.RegionSize);
block.Y = (ushort)(r.RegionLocY / Constants.RegionSize); block.Y = (ushort)(r.RegionLocY / Constants.RegionSize);
@ -1160,7 +1165,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
foreach (GridRegion r in regions) foreach (GridRegion r in regions)
{ {
MapBlockData mapBlock = new MapBlockData(); MapBlockData mapBlock = new MapBlockData();
MapBlockFromGridRegion(mapBlock, r); MapBlockFromGridRegion(mapBlock, r, 0);
AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString()); AssetBase texAsset = m_scene.AssetService.Get(mapBlock.MapImageId.ToString());
if (texAsset != null) if (texAsset != null)