put back the hack to make viewers display map tags (now and then at least) that i had removed and do it also on the local region. Make parcel overlay a bit less transparent than i did before.

avinationmerge
UbitUmarov 2015-09-19 21:30:09 +01:00
parent ba4d0c1c6f
commit 56a4b5ba7a
1 changed files with 242 additions and 133 deletions

View File

@ -89,7 +89,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
private volatile bool threadrunning = false; private volatile bool threadrunning = false;
// expire time for the blacklists in seconds // expire time for the blacklists in seconds
private double expireBlackListTime = 600.0; // 10 minutes private double expireBlackListTime = 600.0; // 10 minutes
// expire mapItems responses time in seconds. If too high disturbs the green dots updates // expire mapItems responses time in seconds. Throttles requests to regions that do answer
private const double expireResponsesTime = 120.0; // 2 minutes ? private const double expireResponsesTime = 120.0; // 2 minutes ?
//private int CacheRegionsDistance = 256; //private int CacheRegionsDistance = 256;
@ -465,8 +465,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
List<mapItemReply> mapitems = new List<mapItemReply>(); List<mapItemReply> mapitems = new List<mapItemReply>();
mapItemReply mapitem = new mapItemReply(); mapItemReply mapitem = new mapItemReply();
bool adultRegion; // viewers only ask for green dots to each region now
// except at login with regionhandle 0
// possible on some other rare ocasions
// use previus hack of sending all items with the green dots
bool adultRegion;
if (regionhandle == 0)
{
switch (itemtype) switch (itemtype)
{ {
case (int)GridItemType.AgentLocations: case (int)GridItemType.AgentLocations:
@ -501,13 +507,31 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
}); });
} }
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
break;
case (int)GridItemType.Telehub:
// Service 1 (MAP_ITEM_TELEHUB)
SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
if (sog != null)
{
mapitem = new mapItemReply(
xstart + (uint)sog.AbsolutePosition.X,
ystart + (uint)sog.AbsolutePosition.Y,
UUID.Zero,
sog.Name,
0, // color (not used)
0 // 0 = telehub / 1 = infohub
);
mapitems.Add(mapitem);
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
}
break; break;
case (int)GridItemType.AdultLandForSale: case (int)GridItemType.AdultLandForSale:
case (int)GridItemType.LandForSale: case (int)GridItemType.LandForSale:
// Service 7 (MAP_ITEM_LAND_FOR_SALE)
// Service 7 (MAP_ITEM_LAND_FOR_SALE)
adultRegion = m_scene.RegionInfo.RegionSettings.Maturity == 2; adultRegion = m_scene.RegionInfo.RegionSettings.Maturity == 2;
if (adultRegion) if (adultRegion)
{ {
@ -557,7 +581,58 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
break; break;
case (int)GridItemType.Telehub: case (uint)GridItemType.PgEvent:
case (uint)GridItemType.MatureEvent:
case (uint)GridItemType.AdultEvent:
case (uint)GridItemType.Classified:
case (uint)GridItemType.Popular:
// TODO
// just dont not cry about them
break;
default:
// unkown map item type
m_log.DebugFormat("[WORLD MAP]: Unknown MapItem type {1}", itemtype);
break;
}
}
else
{
// send all items till we get a better fix
// Service 6 right now (MAP_ITEM_AGENTS_LOCATION; green dots)
int tc = Environment.TickCount;
if (m_scene.GetRootAgentCount() <= 1)
{
mapitem = new mapItemReply(
xstart + 1,
ystart + 1,
UUID.Zero,
Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
0, 0);
mapitems.Add(mapitem);
}
else
{
m_scene.ForEachRootScenePresence(delegate (ScenePresence sp)
{
// Don't send a green dot for yourself
if (sp.UUID != remoteClient.AgentId)
{
mapitem = new mapItemReply(
xstart + (uint)sp.AbsolutePosition.X,
ystart + (uint)sp.AbsolutePosition.Y,
UUID.Zero,
Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString()),
1, 0);
mapitems.Add(mapitem);
}
});
}
remoteClient.SendMapItemReply(mapitems.ToArray(), 6, flags);
mapitems.Clear();
// Service 1 (MAP_ITEM_TELEHUB) // Service 1 (MAP_ITEM_TELEHUB)
SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject); SceneObjectGroup sog = m_scene.GetSceneObjectGroup(m_scene.RegionInfo.RegionSettings.TelehubObject);
@ -572,24 +647,53 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
0 // 0 = telehub / 1 = infohub 0 // 0 = telehub / 1 = infohub
); );
mapitems.Add(mapitem); mapitems.Add(mapitem);
remoteClient.SendMapItemReply(mapitems.ToArray(), 1, flags);
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags); mapitems.Clear();
} }
break;
case (uint)GridItemType.PgEvent: // Service 7 (MAP_ITEM_LAND_FOR_SALE)
case (uint)GridItemType.MatureEvent:
case (uint)GridItemType.AdultEvent:
case (uint)GridItemType.Classified:
case (uint)GridItemType.Popular:
// TODO
// just dont not cry about them
break;
default: uint its = 7;
// unkown map item type if (m_scene.RegionInfo.RegionSettings.Maturity == 2)
m_log.DebugFormat("[WORLD MAP]: Unknown MapItem type {1}", itemtype); its = 10;
break;
// Parcels
ILandChannel landChannel = m_scene.LandChannel;
List<ILandObject> parcels = landChannel.AllParcels();
if ((parcels != null) && (parcels.Count >= 1))
{
foreach (ILandObject parcel_interface in parcels)
{
// Play it safe
if (!(parcel_interface is LandObject))
continue;
LandObject land = (LandObject)parcel_interface;
LandData parcel = land.LandData;
// Show land for sale
if ((parcel.Flags & (uint)ParcelFlags.ForSale) == (uint)ParcelFlags.ForSale)
{
Vector3 min = parcel.AABBMin;
Vector3 max = parcel.AABBMax;
float x = (min.X + max.X) / 2;
float y = (min.Y + max.Y) / 2;
mapitem = new mapItemReply(
xstart + (uint)x,
ystart + (uint)y,
parcel.GlobalID,
parcel.Name,
parcel.Area,
parcel.SalePrice
);
mapitems.Add(mapitem);
}
}
if(mapitems.Count >0)
remoteClient.SendMapItemReply(mapitems.ToArray(), its, flags);
mapitems.Clear();
}
} }
} }
@ -663,6 +767,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
if(av!=null) if(av!=null)
{ {
// this will mainly only send green dots now
if (responseMap.ContainsKey(st.itemtype.ToString())) if (responseMap.ContainsKey(st.itemtype.ToString()))
{ {
List<mapItemReply> returnitems = new List<mapItemReply>(); List<mapItemReply> returnitems = new List<mapItemReply>();
@ -733,6 +838,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
requests.Enqueue(st); requests.Enqueue(st);
} }
uint[] itemTypesForcedSend = new uint[] { 6, 1, 7, 10 }; // green dots, infohub, land sells
/// <summary> /// <summary>
/// Does the actual remote mapitem request /// Does the actual remote mapitem request
/// This should be called from an asynchronous thread /// This should be called from an asynchronous thread
@ -906,7 +1013,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
lock (m_cachedRegionMapItemsResponses) lock (m_cachedRegionMapItemsResponses)
m_cachedRegionMapItemsResponses.AddOrUpdate(regionhandle, responseMap, expireResponsesTime); m_cachedRegionMapItemsResponses.AddOrUpdate(regionhandle, responseMap, expireResponsesTime);
// send answer for this item and client
flags &= 0xffff; flags &= 0xffff;
if (id != UUID.Zero) if (id != UUID.Zero)
@ -915,10 +1021,14 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
m_scene.TryGetScenePresence(id, out av); m_scene.TryGetScenePresence(id, out av);
if (av != null && !av.IsChildAgent && !av.IsDeleted && !av.IsInTransit) if (av != null && !av.IsChildAgent && !av.IsDeleted && !av.IsInTransit)
{ {
if (responseMap.ContainsKey(itemtype.ToString())) // send all the items or viewers will never ask for them, except green dots
foreach (uint itfs in itemTypesForcedSend)
{
if (responseMap.ContainsKey(itfs.ToString()))
{ {
List<mapItemReply> returnitems = new List<mapItemReply>(); List<mapItemReply> returnitems = new List<mapItemReply>();
OSDArray itemarray = (OSDArray)responseMap[itemtype.ToString()]; // OSDArray itemarray = (OSDArray)responseMap[itemtype.ToString()];
OSDArray itemarray = (OSDArray)responseMap[itfs.ToString()];
for (int i = 0; i < itemarray.Count; i++) for (int i = 0; i < itemarray.Count; i++)
{ {
OSDMap mapitem = (OSDMap)itemarray[i]; OSDMap mapitem = (OSDMap)itemarray[i];
@ -931,7 +1041,9 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
mi.name = mapitem["Name"].AsString(); mi.name = mapitem["Name"].AsString();
returnitems.Add(mi); returnitems.Add(mi);
} }
av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags); // av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags);
av.ControllingClient.SendMapItemReply(returnitems.ToArray(), itfs, flags);
}
} }
} }
} }
@ -1064,7 +1176,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
{ {
if (r == null) if (r == null)
{ {
// block.Access = (byte)SimAccess.Down; // we should not get here ??
// block.Access = (byte)SimAccess.Down; this is for a grid reply on r
block.Access = (byte)SimAccess.NonExistent; block.Access = (byte)SimAccess.NonExistent;
block.MapImageId = UUID.Zero; block.MapImageId = UUID.Zero;
return; return;
@ -1282,10 +1395,6 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
uint xstart = 0; uint xstart = 0;
uint ystart = 0; uint ystart = 0;
// create and send back answers about all items active
// so call region can cache them and answer to the several
// individual item viewer requests
Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart); Util.RegionHandleToWorldLoc(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
// Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots) // Service 6 (MAP_ITEM_AGENTS_LOCATION; green dots)
@ -1435,7 +1544,7 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
needRegionSave = true; needRegionSave = true;
} }
// bypass terrain image for large regions since only V2 viewers work with them // bypass terrain image for large regions
if (m_scene.RegionInfo.RegionSizeX <= Constants.RegionSize && if (m_scene.RegionInfo.RegionSizeX <= Constants.RegionSize &&
m_scene.RegionInfo.RegionSizeY <= Constants.RegionSize m_scene.RegionInfo.RegionSizeY <= Constants.RegionSize
&& mapbmp != null) && mapbmp != null)
@ -1601,8 +1710,8 @@ namespace OpenSim.Region.CoreModules.World.WorldMap
using (SolidBrush transparent = new SolidBrush(background)) using (SolidBrush transparent = new SolidBrush(background))
g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY); g.FillRectangle(transparent, 0, 0, regionSizeX, regionSizeY);
// make it a half transparent // make it a bit transparent
using (SolidBrush yellow = new SolidBrush(Color.FromArgb(100, 249, 223, 9))) using (SolidBrush yellow = new SolidBrush(Color.FromArgb(192, 249, 223, 9)))
{ {
for (int x = 0; x < regionLandTilesX; x++) for (int x = 0; x < regionLandTilesX; x++)
{ {