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.
0.6.5-rc1
Melanie Thielker 2009-04-22 01:43:07 +00:00
parent 6aa5d3904d
commit 338655e9d5
1 changed files with 21 additions and 49 deletions

View File

@ -9190,16 +9190,16 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
{ {
// => complain loudly, as specified by the LSL docs // => complain loudly, as specified by the LSL docs
ShoutError("Notecard '" + name + "' could not be found."); ShoutError("Notecard '" + name + "' could not be found.");
return UUID.Zero.ToString();
} }
UUID tid = UUID.Zero; UUID tid = tid = AsyncCommands.
if (NotecardCache.IsCached(assetID))
{
tid = AsyncCommands.
DataserverPlugin.RegisterRequest(m_localID, DataserverPlugin.RegisterRequest(m_localID,
m_itemID, assetID.ToString()); m_itemID, assetID.ToString());
if (NotecardCache.IsCached(assetID))
{
AsyncCommands. AsyncCommands.
DataserverPlugin.DataserverReply(assetID.ToString(), DataserverPlugin.DataserverReply(assetID.ToString(),
NotecardCache.GetLines(assetID).ToString()); NotecardCache.GetLines(assetID).ToString());
@ -9209,15 +9209,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
WithNotecard(assetID, delegate (UUID id, AssetBase a) WithNotecard(assetID, delegate (UUID id, AssetBase a)
{ {
if (a == null) if (a == null || a.Type != 7)
{
ShoutError("Notecard '" + name + "' could not be found.");
return; return;
}
if (a.Type != 7)
return;
tid = AsyncCommands.
DataserverPlugin.RegisterRequest(m_localID,
m_itemID, assetID.ToString());
System.Text.ASCIIEncoding enc = System.Text.ASCIIEncoding enc =
new System.Text.ASCIIEncoding(); new System.Text.ASCIIEncoding();
@ -9229,18 +9225,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotecardCache.GetLines(id).ToString()); 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); // ScriptSleep(100);
return UUID.Zero.ToString(); return tid.ToString();
} }
public LSL_String llGetNotecardLine(string name, int line) 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 // => complain loudly, as specified by the LSL docs
ShoutError("Notecard '" + name + "' could not be found."); 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)) if (NotecardCache.IsCached(assetID))
{ {
tid = AsyncCommands.
DataserverPlugin.RegisterRequest(m_localID,
m_itemID, assetID.ToString());
AsyncCommands. AsyncCommands.
DataserverPlugin.DataserverReply(assetID.ToString(), DataserverPlugin.DataserverReply(assetID.ToString(),
NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax)); NotecardCache.GetLine(assetID, line, m_notecardLineReadCharsMax));
@ -9286,15 +9272,11 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
WithNotecard(assetID, delegate (UUID id, AssetBase a) WithNotecard(assetID, delegate (UUID id, AssetBase a)
{ {
if (a == null) if (a == null || a.Type != 7)
{
ShoutError("Notecard '" + name + "' could not be found.");
return; return;
}
if (a.Type != 7)
return;
tid = AsyncCommands.
DataserverPlugin.RegisterRequest(m_localID,
m_itemID, assetID.ToString());
System.Text.ASCIIEncoding enc = System.Text.ASCIIEncoding enc =
new System.Text.ASCIIEncoding(); new System.Text.ASCIIEncoding();
@ -9306,18 +9288,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
NotecardCache.GetLine(id, line, m_notecardLineReadCharsMax)); 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); // ScriptSleep(100);
return UUID.Zero.ToString(); return tid.ToString();
} }
} }