From 338655e9d59d85556cbc4b8ebcd8542bb818d81d Mon Sep 17 00:00:00 2001 From: Melanie Thielker Date: Wed, 22 Apr 2009 01:43:07 +0000 Subject: Fix loading notecards from LSL. The first time a notecard was accessed, the ID returned from the call would differ from the one later sent via dataserver(), causing AOs to fail. --- .../Shared/Api/Implementation/LSL_Api.cs | 70 +++++++--------------- 1 file changed, 21 insertions(+), 49 deletions(-) (limited to 'OpenSim') diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index ae4fcbc..deb4dae 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -9190,16 +9190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // => complain loudly, as specified by the LSL docs ShoutError("Notecard '" + name + "' could not be found."); + + return UUID.Zero.ToString(); } - UUID tid = UUID.Zero; + UUID tid = tid = AsyncCommands. + DataserverPlugin.RegisterRequest(m_localID, + m_itemID, assetID.ToString()); if (NotecardCache.IsCached(assetID)) { - tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, - m_itemID, assetID.ToString()); - AsyncCommands. DataserverPlugin.DataserverReply(assetID.ToString(), NotecardCache.GetLines(assetID).ToString()); @@ -9209,16 +9209,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api WithNotecard(assetID, delegate (UUID id, AssetBase a) { - if (a == null) - return; - - if (a.Type != 7) + if (a == null || a.Type != 7) + { + ShoutError("Notecard '" + name + "' could not be found."); return; + } - tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, - m_itemID, assetID.ToString()); - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string data = enc.GetString(a.Data); @@ -9229,18 +9225,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api NotecardCache.GetLines(id).ToString()); }); - if (tid != UUID.Zero) - { - // ScriptSleep(100); - return tid.ToString(); - } - - // if we got to here, we didn't find the notecard the script was asking for - // => complain loudly, as specified by the LSL docs - ShoutError("Notecard '" + name + "' could not be found."); - // ScriptSleep(100); - return UUID.Zero.ToString(); + return tid.ToString(); } public LSL_String llGetNotecardLine(string name, int line) @@ -9267,16 +9253,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api { // => complain loudly, as specified by the LSL docs ShoutError("Notecard '" + name + "' could not be found."); - } - UUID tid = UUID.Zero; + return UUID.Zero.ToString(); + } + UUID tid = tid = AsyncCommands. + DataserverPlugin.RegisterRequest(m_localID, + m_itemID, assetID.ToString()); + if (NotecardCache.IsCached(assetID)) { - tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, - m_itemID, assetID.ToString()); - AsyncCommands. DataserverPlugin.DataserverReply(assetID.ToString(), NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); @@ -9286,16 +9272,12 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api WithNotecard(assetID, delegate (UUID id, AssetBase a) { - if (a == null) - return; - - if (a.Type != 7) + if (a == null || a.Type != 7) + { + ShoutError("Notecard '" + name + "' could not be found."); return; + } - tid = AsyncCommands. - DataserverPlugin.RegisterRequest(m_localID, - m_itemID, assetID.ToString()); - System.Text.ASCIIEncoding enc = new System.Text.ASCIIEncoding(); string data = enc.GetString(a.Data); @@ -9306,18 +9288,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); }); - if (tid != UUID.Zero) - { - // ScriptSleep(100); - return tid.ToString(); - } - - // if we got to here, we didn't find the notecard the script was asking for - // => complain loudly, as specified by the LSL docs - ShoutError("Notecard '" + name + "' could not be found."); - // ScriptSleep(100); - return UUID.Zero.ToString(); + return tid.ToString(); } } -- cgit v1.1