Skip to content

Commit

Permalink
Update LSL support for LinksetData to use string.Empty where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
mdickson committed Nov 15, 2023
1 parent eb27523 commit 21f9ce2
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18801,34 +18801,43 @@ public LSL_String llReplaceSubString(LSL_String src, LSL_String pattern, LSL_Str

public LSL_Integer llLinksetDataWrite(LSL_String name, LSL_String value)
{
return llLinksetDataWriteProtected(name, value, "");
return llLinksetDataWriteProtected(name, value, string.Empty);
}

public LSL_Integer llLinksetDataWriteProtected(LSL_String name, LSL_String value, LSL_String pass)
{
if (name == "") return ScriptBaseClass.LINKSETDATA_ENOKEY;
if (name == "")
return ScriptBaseClass.LINKSETDATA_ENOKEY;

var rootPrim = m_host.ParentGroup.RootPart;

int ret = rootPrim.AddOrUpdateLinksetDataKey(name, value, pass);
object[] parameters = new object[]
{
new LSL_Integer(ScriptBaseClass.LINKSETDATA_UPDATE), name, ""
new LSL_Integer(ScriptBaseClass.LINKSETDATA_UPDATE), name, string.Empty
};

if (ret == 0)
{
m_ScriptEngine.PostObjectEvent(rootPrim.LocalId,
new EventParams("linkset_data", parameters, Array.Empty<DetectParams>()));

return ScriptBaseClass.LINKSETDATA_OK;
}
else
{
if (ret == 1)
{
return ScriptBaseClass.LINKSETDATA_EMEMORY;
}else if (ret == 2)
}
else if (ret == 2)
{
return ScriptBaseClass.LINKSETDATA_NOUPDATE;
else return ScriptBaseClass.LINKSETDATA_EPROTECTED;
}
else
{
return ScriptBaseClass.LINKSETDATA_EPROTECTED;
}
}
}

Expand All @@ -18837,9 +18846,10 @@ public void llLinksetDataReset()
var rootPrim = m_host.ParentGroup.RootPart;

rootPrim.ResetLinksetData();

object[] parameters = new object[]
{
new LSL_Integer(ScriptBaseClass.LINKSETDATA_RESET), new LSL_String(""), new LSL_String("")
new LSL_Integer(ScriptBaseClass.LINKSETDATA_RESET), new LSL_String(string.Empty), new LSL_String(string.Empty)
};

EventParams linksetdata_params = new EventParams("linkset_data", parameters, Array.Empty<DetectParams>());
Expand All @@ -18860,7 +18870,7 @@ public LSL_Integer llLinksetDataCountKeys()

public LSL_Integer llLinksetDataDelete(LSL_String name)
{
return llLinksetDataDeleteProtected(name, "");
return llLinksetDataDeleteProtected(name, string.Empty);
}

public LSL_List llLinksetDataDeleteFound(LSL_String pattern, LSL_String pass)
Expand All @@ -18874,7 +18884,7 @@ public LSL_List llLinksetDataDeleteFound(LSL_String pattern, LSL_String pass)

object[] parameters = new object[]
{
new LSL_Integer(ScriptBaseClass.LINKSETDATA_MULTIDELETE), new LSL_String(removed_keys), new LSL_String("")
new LSL_Integer(ScriptBaseClass.LINKSETDATA_MULTIDELETE), new LSL_String(removed_keys), new LSL_String(string.Empty)
};

if (deleted > 0)
Expand Down Expand Up @@ -18904,7 +18914,7 @@ public LSL_Integer llLinksetDataDeleteProtected(LSL_String name, LSL_String pass
{
parameters = new object[]
{
new LSL_Integer(ScriptBaseClass.LINKSETDATA_OK), name, new LSL_String("")
new LSL_Integer(ScriptBaseClass.LINKSETDATA_OK), name, new LSL_String(string.Empty)
};
}
else if (ret == 1)
Expand Down Expand Up @@ -18934,7 +18944,7 @@ public LSL_List llLinksetDataListKeys(LSL_Integer start, LSL_Integer count)

public LSL_String llLinksetDataRead(LSL_String name)
{
return llLinksetDataReadProtected(name, "");
return llLinksetDataReadProtected(name, string.Empty);
}

public LSL_String llLinksetDataReadProtected(LSL_String name, LSL_String pass)
Expand Down

0 comments on commit 21f9ce2

Please sign in to comment.