add explicit osMakeNotecard(string notecardName, LSL_String contents) so it does not depend on implicit cast from string to list, as before

This commit is contained in:
UbitUmarov
2022-01-06 20:42:50 +00:00
parent ce5dca5c56
commit e78caeeac8
4 changed files with 40 additions and 29 deletions

View File

@@ -27,6 +27,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Concurrent;
using System.Net;
using System.Reflection;
using System.Runtime;
@@ -4966,7 +4967,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
}
// Someone else's HUD, why are we getting these?
if (grp.OwnerID != AgentId && grp.HasPrivateAttachmentPoint)
if (grp.HasPrivateAttachmentPoint && grp.OwnerID != AgentId)
{
update.Free();
continue;
@@ -8828,10 +8829,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
private class DeRezObjectInfo
{
public int count;
public List<uint> objectids;
public HashSet<int> rcvedpackets;
}
private Dictionary<UUID, DeRezObjectInfo> m_DeRezObjectDelayed = new Dictionary<UUID, DeRezObjectInfo>();
private ConcurrentDictionary<UUID, DeRezObjectInfo> m_DeRezObjectDelayed;
private void HandlerDeRezObject(Packet Pack)
{
@@ -8851,17 +8852,22 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (numberPackets > 1)
{
DeRezObjectInfo info;
if (!m_DeRezObjectDelayed.TryGetValue(id, out info))
if(m_DeRezObjectDelayed == null)
m_DeRezObjectDelayed = new ConcurrentDictionary<UUID, DeRezObjectInfo>();
if (!m_DeRezObjectDelayed.TryGetValue(id, out DeRezObjectInfo info))
{
deRezIDs = new List<uint>();
deRezIDs = new List<uint>(DeRezPacket.ObjectData.Length);
info = new DeRezObjectInfo();
info.count = 0;
info.rcvedpackets = new HashSet<int>() { curPacket };
info.objectids = deRezIDs;
m_DeRezObjectDelayed[id] = info;
}
else
{
if(info.rcvedpackets.Contains(curPacket))
return;
info.rcvedpackets.Add(curPacket);
deRezIDs = info.objectids;
}
@@ -8870,16 +8876,16 @@ namespace OpenSim.Region.ClientStack.LindenUDP
deRezIDs.Add(data.ObjectLocalID);
}
info.count++;
if (info.count < numberPackets)
if (info.rcvedpackets.Count < numberPackets)
return;
m_DeRezObjectDelayed.Remove(id);
m_DeRezObjectDelayed.TryRemove(id, out info);
info.objectids = null;
info.rcvedpackets = null;
}
else
{
deRezIDs = new List<uint>();
deRezIDs = new List<uint>(DeRezPacket.ObjectData.Length);
foreach (DeRezObjectPacket.ObjectDataBlock data in DeRezPacket.ObjectData)
{
deRezIDs.Add(data.ObjectLocalID);

View File

@@ -2220,7 +2220,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
/// </remarks>
/// <param name="notecardName">The name of the notecard to write.</param>
/// <param name="contents">The contents of the notecard.</param>
public void osMakeNotecard(string notecardName, LSL_Types.list contents)
public void osMakeNotecard(string notecardName, LSL_String contents)
{
CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
SaveNotecard(notecardName, "Script generated notecard", contents + "\n", false);
}
public void osMakeNotecard(string notecardName, LSL_List contents)
{
CheckThreatLevel(ThreatLevel.High, "osMakeNotecard");
@@ -2250,23 +2256,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{
Description = description
};
byte[] a;
byte[] b;
byte[] c;
b = Util.UTF8.GetBytes(data);
osUTF8 contents = new osUTF8(data);
osUTF8Slice utf = new osUTF8Slice(contents.Length + 128);
utf.AppendASCII("Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length ");
utf.AppendASCII(contents.Length.ToString());
utf.AppendASCII("\n");
utf.Append(contents);
utf.AppendASCII("}");
a = Util.UTF8.GetBytes(
"Linden text version 2\n{\nLLEmbeddedItems version 1\n{\ncount 0\n}\nText length " + b.Length.ToString() + "\n");
c = Util.UTF8.GetBytes("}");
byte[] d = new byte[a.Length + b.Length + c.Length];
Buffer.BlockCopy(a, 0, d, 0, a.Length);
Buffer.BlockCopy(b, 0, d, a.Length, b.Length);
Buffer.BlockCopy(c, 0, d, a.Length + b.Length, c.Length);
asset.Data = d;
asset.Data = utf.ToArray();
World.AssetService.Store(asset);
// Create Task Entry

View File

@@ -277,7 +277,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api.Interfaces
void osMessageObject(key objectUUID,string message);
void osMakeNotecard(string notecardName, LSL_Types.list contents);
void osMakeNotecard(string notecardName, LSL_String contents);
void osMakeNotecard(string notecardName, LSL_List contents);
string osGetNotecardLine(string name, int line);
string osGetNotecard(string name);

View File

@@ -493,7 +493,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.ScriptBase
m_OSSL_Functions.osMessageObject(objectUUID,message);
}
public void osMakeNotecard(string notecardName, LSL_Types.list contents)
public void osMakeNotecard(string notecardName, LSL_String contents)
{
m_OSSL_Functions.osMakeNotecard(notecardName, contents);
}
public void osMakeNotecard(string notecardName, LSL_List contents)
{
m_OSSL_Functions.osMakeNotecard(notecardName, contents);
}