MapItems/Green Dots
* Fixes 1 too large count in region you're in (Region no longer reports the green dot about yourself to you) * For all local requests, the region will check itself instead of going to it's web service. (optimization)0.6.0-stable
parent
b55c9761b4
commit
78073fa440
|
@ -248,7 +248,50 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
|
|||
public virtual void HandleMapItemRequest(IClientAPI remoteClient, uint flags,
|
||||
uint EstateID, bool godlike, uint itemtype, ulong regionhandle)
|
||||
{
|
||||
uint xstart = 0;
|
||||
uint ystart = 0;
|
||||
Helpers.LongToUInts(m_scene.RegionInfo.RegionHandle, out xstart, out ystart);
|
||||
if (itemtype == 6) // we only sevice 6 right now (avatar green dots)
|
||||
{
|
||||
if (regionhandle == 0 || regionhandle == m_scene.RegionInfo.RegionHandle)
|
||||
{
|
||||
List<ScenePresence> avatars = m_scene.GetAvatars();
|
||||
int tc = System.Environment.TickCount;
|
||||
List<mapItemReply> mapitems = new List<mapItemReply>();
|
||||
mapItemReply mapitem = new mapItemReply();
|
||||
if (avatars.Count == 0 || avatars.Count == 1)
|
||||
{
|
||||
mapitem = new mapItemReply();
|
||||
mapitem.x = (uint)(xstart + 1);
|
||||
mapitem.y = (uint)(ystart + 1);
|
||||
mapitem.id = UUID.Zero;
|
||||
mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
|
||||
mapitem.Extra = 0;
|
||||
mapitem.Extra2 = 0;
|
||||
mapitems.Add(mapitem);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
foreach (ScenePresence av in avatars)
|
||||
{
|
||||
// Don't send a green dot for yourself
|
||||
if (av.UUID != remoteClient.AgentId)
|
||||
{
|
||||
mapitem = new mapItemReply();
|
||||
mapitem.x = (uint)(xstart + av.AbsolutePosition.X);
|
||||
mapitem.y = (uint)(ystart + av.AbsolutePosition.Y);
|
||||
mapitem.id = UUID.Zero;
|
||||
mapitem.name = Util.Md5Hash(m_scene.RegionInfo.RegionName + tc.ToString());
|
||||
mapitem.Extra = 1;
|
||||
mapitem.Extra2 = 0;
|
||||
mapitems.Add(mapitem);
|
||||
}
|
||||
}
|
||||
}
|
||||
remoteClient.SendMapItemReply(mapitems.ToArray(), itemtype, flags);
|
||||
}
|
||||
else
|
||||
{
|
||||
RegionInfo mreg = m_scene.SceneGridService.RequestNeighbouringRegionInfo(regionhandle);
|
||||
if (mreg != null)
|
||||
|
@ -276,6 +319,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
|
|||
remoteClient.SendMapItemReply(returnitems.ToArray(), itemtype, flags);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue