Correct display of landmark about info. Also correct region maturity rating

in LM info. Maturity is NOT the parcel's setting, that is only for the
image and text. Parcel maturity is governed by region maturity.
0.6.9-post-fixes
Melanie Thielker 2010-08-07 05:45:52 +02:00 committed by Melanie
parent 2eeddc63d7
commit 7022c76d56
9 changed files with 36 additions and 13 deletions

View File

@ -1170,6 +1170,16 @@ namespace OpenSim.Framework
} }
public static uint ConvertAccessLevelToMaturity(byte maturity)
{
if (maturity <= 13)
return 0;
else if (maturity <= 21)
return 1;
else
return 2;
}
/// <summary> /// <summary>
/// Produces an OSDMap from its string representation on a stream /// Produces an OSDMap from its string representation on a stream
/// </summary> /// </summary>
@ -1441,4 +1451,4 @@ namespace OpenSim.Framework
return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1); return (diff >= 0) ? diff : (diff + EnvironmentTickCountMask + 1);
} }
} }
} }

View File

@ -2659,7 +2659,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// Bit 0: Mature, bit 7: on sale, other bits: no idea // Bit 0: Mature, bit 7: on sale, other bits: no idea
reply.Data.Flags = (byte)( reply.Data.Flags = (byte)(
((land.Flags & (uint)ParcelFlags.MaturePublish) != 0 ? (1 << 0) : 0) + (info.AccessLevel > 13 ? (1 << 0) : 0) +
((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0)); ((land.Flags & (uint)ParcelFlags.ForSale) != 0 ? (1 << 7) : 0));
Vector3 pos = land.UserLocation; Vector3 pos = land.UserLocation;
@ -2667,8 +2667,8 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
pos = (land.AABBMax + land.AABBMin) * 0.5f; pos = (land.AABBMax + land.AABBMin) * 0.5f;
} }
reply.Data.GlobalX = info.RegionLocX * Constants.RegionSize + x; reply.Data.GlobalX = info.RegionLocX + x;
reply.Data.GlobalY = info.RegionLocY * Constants.RegionSize + y; reply.Data.GlobalY = info.RegionLocY + y;
reply.Data.GlobalZ = pos.Z; reply.Data.GlobalZ = pos.Z;
reply.Data.SimName = Utils.StringToBytes(info.RegionName); reply.Data.SimName = Utils.StringToBytes(info.RegionName);
reply.Data.SnapshotID = land.SnapshotID; reply.Data.SnapshotID = land.SnapshotID;

View File

@ -121,7 +121,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
#region ILandService #region ILandService
public LandData GetLandData(ulong regionHandle, uint x, uint y) public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
{ {
m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}", m_log.DebugFormat("[LAND IN CONNECTOR]: GetLandData for {0}. Count = {1}",
regionHandle, m_Scenes.Count); regionHandle, m_Scenes.Count);
@ -130,10 +130,12 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsIn.Land
if (s.RegionInfo.RegionHandle == regionHandle) if (s.RegionInfo.RegionHandle == regionHandle)
{ {
m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from"); m_log.Debug("[LAND IN CONNECTOR]: Found region to GetLandData from");
regionAccess = s.RegionInfo.AccessLevel;
return s.GetLandData(x, y); return s.GetLandData(x, y);
} }
} }
m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle); m_log.DebugFormat("[LAND IN CONNECTOR]: region handle {0} not found", regionHandle);
regionAccess = 42;
return null; return null;
} }

View File

@ -116,8 +116,9 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
#region ILandService #region ILandService
public LandData GetLandData(ulong regionHandle, uint x, uint y) public LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
{ {
regionAccess = 2;
m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}", m_log.DebugFormat("[LAND CONNECTOR]: request for land data in {0} at {1}, {2}",
regionHandle, x, y); regionHandle, x, y);
@ -126,6 +127,7 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
if (s.RegionInfo.RegionHandle == regionHandle) if (s.RegionInfo.RegionHandle == regionHandle)
{ {
LandData land = s.GetLandData(x, y); LandData land = s.GetLandData(x, y);
regionAccess = s.RegionInfo.AccessLevel;
return land; return land;
} }
} }

View File

@ -109,13 +109,13 @@ namespace OpenSim.Region.CoreModules.ServiceConnectorsOut.Land
#region ILandService #region ILandService
public override LandData GetLandData(ulong regionHandle, uint x, uint y) public override LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
{ {
LandData land = m_LocalService.GetLandData(regionHandle, x, y); LandData land = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess);
if (land != null) if (land != null)
return land; return land;
return base.GetLandData(regionHandle, x, y); return base.GetLandData(regionHandle, x, y, out regionAccess);
} }
#endregion ILandService #endregion ILandService

View File

@ -50,6 +50,7 @@ namespace OpenSim.Region.CoreModules.World.Land
public LandData LandData; public LandData LandData;
public ulong RegionHandle; public ulong RegionHandle;
public uint X, Y; public uint X, Y;
public byte RegionAccess;
} }
public class LandManagementModule : INonSharedRegionModule public class LandManagementModule : INonSharedRegionModule
@ -1376,13 +1377,15 @@ namespace OpenSim.Region.CoreModules.World.Land
if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle) if (extLandData.RegionHandle == m_scene.RegionInfo.RegionHandle)
{ {
extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData; extLandData.LandData = this.GetLandObject(extLandData.X, extLandData.Y).LandData;
extLandData.RegionAccess = m_scene.RegionInfo.AccessLevel;
} }
else else
{ {
ILandService landService = m_scene.RequestModuleInterface<ILandService>(); ILandService landService = m_scene.RequestModuleInterface<ILandService>();
extLandData.LandData = landService.GetLandData(extLandData.RegionHandle, extLandData.LandData = landService.GetLandData(extLandData.RegionHandle,
extLandData.X, extLandData.X,
extLandData.Y); extLandData.Y,
out extLandData.RegionAccess);
if (extLandData.LandData == null) if (extLandData.LandData == null)
{ {
// we didn't find the region/land => don't cache // we didn't find the region/land => don't cache
@ -1414,6 +1417,7 @@ namespace OpenSim.Region.CoreModules.World.Land
r.RegionName = info.RegionName; r.RegionName = info.RegionName;
r.RegionLocX = (uint)info.RegionLocX; r.RegionLocX = (uint)info.RegionLocX;
r.RegionLocY = (uint)info.RegionLocY; r.RegionLocY = (uint)info.RegionLocY;
r.RegionSettings.Maturity = (int)Util.ConvertAccessLevelToMaturity(data.RegionAccess);
remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y); remoteClient.SendParcelInfo(r, data.LandData, parcelID, data.X, data.Y);
} }
else else

View File

@ -66,7 +66,8 @@ namespace OpenSim.Server.Handlers.Land
uint y = Convert.ToUInt32(requestData["y"]); uint y = Convert.ToUInt32(requestData["y"]);
m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle); m_log.DebugFormat("[LAND HANDLER]: Got request for land data at {0}, {1} for region {2}", x, y, regionHandle);
LandData landData = m_LocalService.GetLandData(regionHandle, x, y); byte regionAccess;
LandData landData = m_LocalService.GetLandData(regionHandle, x, y, out regionAccess);
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
if (landData != null) if (landData != null)
{ {
@ -83,6 +84,7 @@ namespace OpenSim.Server.Handlers.Land
hash["SalePrice"] = landData.SalePrice.ToString(); hash["SalePrice"] = landData.SalePrice.ToString();
hash["SnapshotID"] = landData.SnapshotID.ToString(); hash["SnapshotID"] = landData.SnapshotID.ToString();
hash["UserLocation"] = landData.UserLocation.ToString(); hash["UserLocation"] = landData.UserLocation.ToString();
hash["RegionAccess"] = regionAccess.ToString();
} }
XmlRpcResponse response = new XmlRpcResponse(); XmlRpcResponse response = new XmlRpcResponse();

View File

@ -64,7 +64,7 @@ namespace OpenSim.Services.Connectors
m_GridService = gridServices; m_GridService = gridServices;
} }
public virtual LandData GetLandData(ulong regionHandle, uint x, uint y) public virtual LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess)
{ {
LandData landData = null; LandData landData = null;
Hashtable hash = new Hashtable(); Hashtable hash = new Hashtable();
@ -74,6 +74,7 @@ namespace OpenSim.Services.Connectors
IList paramList = new ArrayList(); IList paramList = new ArrayList();
paramList.Add(hash); paramList.Add(hash);
regionAccess = 42; // Default to adult. Better safe...
try try
{ {
@ -107,6 +108,8 @@ namespace OpenSim.Services.Connectors
landData.SalePrice = Convert.ToInt32(hash["SalePrice"]); landData.SalePrice = Convert.ToInt32(hash["SalePrice"]);
landData.SnapshotID = new UUID((string)hash["SnapshotID"]); landData.SnapshotID = new UUID((string)hash["SnapshotID"]);
landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]); landData.UserLocation = Vector3.Parse((string)hash["UserLocation"]);
if (hash["RegionAccess"] != null)
regionAccess = (byte)Convert.ToInt32((string)hash["RegionAccess"]);
m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name); m_log.DebugFormat("[OGS1 GRID SERVICES] Got land data for parcel {0}", landData.Name);
} }
catch (Exception e) catch (Exception e)

View File

@ -33,6 +33,6 @@ namespace OpenSim.Services.Interfaces
{ {
public interface ILandService public interface ILandService
{ {
LandData GetLandData(ulong regionHandle, uint x, uint y); LandData GetLandData(ulong regionHandle, uint x, uint y, out byte regionAccess);
} }
} }