mirror of
https://github.com/opensim/opensim.git
synced 2026-05-15 03:15:41 +08:00
fix osSetParcelDetails, plus more cosmetics
This commit is contained in:
@@ -1816,15 +1816,17 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
bool changedoverlay = false;
|
||||
bool changedneedupdate = false;
|
||||
|
||||
string arg;
|
||||
int iarg;
|
||||
// Process the rules, not sure what the impact would be of changing owner or group
|
||||
for (int idx = 0; idx < rules.Length;)
|
||||
{
|
||||
int code = rules.GetIntegerItem(idx++);
|
||||
string arg = rules.GetStrictStringItem(idx++);
|
||||
switch (code)
|
||||
{
|
||||
case ScriptBaseClass.PARCEL_DETAILS_NAME:
|
||||
if(newLand.Name != arg)
|
||||
arg = rules.GetStrictStringItem(idx++);
|
||||
if (newLand.Name != arg)
|
||||
{
|
||||
newLand.Name = arg;
|
||||
changed = true;
|
||||
@@ -1832,7 +1834,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_DESC:
|
||||
if(newLand.Description != arg)
|
||||
arg = rules.GetStrictStringItem(idx++);
|
||||
if (newLand.Description != arg)
|
||||
{
|
||||
newLand.Description = arg;
|
||||
changed = true;
|
||||
@@ -1840,7 +1843,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_OWNER:
|
||||
if(es is not null && !es.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
arg = rules.GetStrictStringItem(idx++);
|
||||
if (es is not null && !es.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
OSSLShoutError("script owner does not have permission to modify the parcel owner");
|
||||
}
|
||||
@@ -1859,7 +1863,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_GROUP:
|
||||
if(m_host.OwnerID.Equals(newLand.OwnerID) || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
arg = rules.GetStrictStringItem(idx++);
|
||||
if (m_host.OwnerID.Equals(newLand.OwnerID) || es == null || es.IsEstateManagerOrOwner(m_host.OwnerID))
|
||||
{
|
||||
if (UUID.TryParse(arg, out uuid))
|
||||
{
|
||||
@@ -1899,7 +1904,7 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
}
|
||||
else
|
||||
{
|
||||
int date = Convert.ToInt32(arg);
|
||||
int date = rules.GetIntegerItem(idx++);
|
||||
if (date == 0)
|
||||
date = Util.UnixTimeSinceEpoch();
|
||||
if(newLand.ClaimDate != date)
|
||||
@@ -1911,7 +1916,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_SEE_AVATARS:
|
||||
bool newavs = (Convert.ToInt32(arg) != 0);
|
||||
iarg = rules.GetIntegerItem(idx++);
|
||||
bool newavs = iarg != 0;
|
||||
if(newLand.SeeAVs != newavs)
|
||||
{
|
||||
changed = true;
|
||||
@@ -1923,7 +1929,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_ANY_AVATAR_SOUNDS:
|
||||
bool newavsounds = (Convert.ToInt32(arg) != 0);
|
||||
iarg = rules.GetIntegerItem(idx++);
|
||||
bool newavsounds = iarg != 0;
|
||||
if(newLand.AnyAVSounds != newavsounds)
|
||||
{
|
||||
changed = true;
|
||||
@@ -1932,7 +1939,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api
|
||||
break;
|
||||
|
||||
case ScriptBaseClass.PARCEL_DETAILS_GROUP_SOUNDS:
|
||||
bool newgrpsounds = (Convert.ToInt32(arg) != 0);
|
||||
iarg = rules.GetIntegerItem(idx++);
|
||||
bool newgrpsounds = iarg != 0;
|
||||
if(newLand.GroupAVSounds != newgrpsounds)
|
||||
{
|
||||
changed = true;
|
||||
|
||||
@@ -370,9 +370,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
// <name>$get() and <name>$set(<type>) methods are in the table and they each get a slot.
|
||||
foreach(TokenDeclSDType sdType in tokenScript.sdSrcTypesValues)
|
||||
{
|
||||
if(sdType is not TokenDeclSDTypeInterface)
|
||||
if(sdType is not TokenDeclSDTypeInterface sdtIFace)
|
||||
continue;
|
||||
TokenDeclSDTypeInterface sdtIFace = (TokenDeclSDTypeInterface)sdType;
|
||||
|
||||
int vti = 0;
|
||||
foreach(TokenDeclVar im in sdtIFace.methsNProps)
|
||||
{
|
||||
@@ -391,9 +391,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
didOne = false;
|
||||
foreach(TokenDeclSDType sdType in tokenScript.sdSrcTypesValues)
|
||||
{
|
||||
if(sdType is not TokenDeclSDTypeClass)
|
||||
if(sdType is not TokenDeclSDTypeClass sdtClass)
|
||||
continue;
|
||||
TokenDeclSDTypeClass sdtClass = (TokenDeclSDTypeClass)sdType;
|
||||
if(sdtClass.slotsAssigned)
|
||||
continue;
|
||||
|
||||
@@ -669,9 +668,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
}
|
||||
foreach(TokenDeclSDType sdType in tokenScript.sdSrcTypesValues)
|
||||
{
|
||||
if(sdType is not TokenDeclSDTypeClass)
|
||||
if(sdType is not TokenDeclSDTypeClass TokenDeclSDTypeClasssdType)
|
||||
continue;
|
||||
currentSDTClass = (TokenDeclSDTypeClass)sdType;
|
||||
currentSDTClass = TokenDeclSDTypeClasssdType;
|
||||
foreach(TokenDeclVar tdv in currentSDTClass.members)
|
||||
{
|
||||
if(tdv.constant && tdv.init is not TokenRValConst)
|
||||
@@ -701,9 +700,9 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
}
|
||||
foreach(TokenDeclSDType sdType in tokenScript.sdSrcTypesValues)
|
||||
{
|
||||
if(sdType is not TokenDeclSDTypeClass)
|
||||
if(sdType is not TokenDeclSDTypeClass TokenDeclSDTypeClasssdType)
|
||||
continue;
|
||||
currentSDTClass = (TokenDeclSDTypeClass)sdType;
|
||||
currentSDTClass = TokenDeclSDTypeClasssdType;
|
||||
foreach(TokenDeclVar tdv in currentSDTClass.members)
|
||||
{
|
||||
if(tdv.constant)
|
||||
@@ -727,9 +726,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
// class to be instantiated via the new operator.
|
||||
foreach(TokenDeclSDType sdType in tokenScript.sdSrcTypesValues)
|
||||
{
|
||||
if(sdType is not TokenDeclSDTypeClass)
|
||||
if(sdType is not TokenDeclSDTypeClass sdtClass)
|
||||
continue;
|
||||
TokenDeclSDTypeClass sdtClass = (TokenDeclSDTypeClass)sdType;
|
||||
|
||||
// See if the class as it stands would be able to fill every slot of its vtable.
|
||||
bool[] filled = new bool[sdtClass.numVirtFuncs];
|
||||
@@ -792,9 +790,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
}
|
||||
foreach(TokenDeclSDType sdType in tokenScript.sdSrcTypesValues)
|
||||
{
|
||||
if(sdType is not TokenDeclSDTypeClass)
|
||||
if(sdType is not TokenDeclSDTypeClass sdtClass)
|
||||
continue;
|
||||
TokenDeclSDTypeClass sdtClass = (TokenDeclSDTypeClass)sdType;
|
||||
foreach(TokenDeclVar declVar in sdtClass.members)
|
||||
{
|
||||
if((declVar.sdtFlags & ScriptReduce.SDT_STATIC) != 0)
|
||||
@@ -858,15 +855,14 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
// Output default state event handler functions.
|
||||
// Each event handler is a private static method named 'default <eventname>'.
|
||||
// Splice in a default state_entry() handler if none defined so we can init global vars.
|
||||
TokenDeclVar defaultStateEntry = null;
|
||||
for(defaultStateEntry = tokenScript.defaultState.body.eventFuncs;
|
||||
defaultStateEntry != null;
|
||||
defaultStateEntry = (TokenDeclVar)defaultStateEntry.nextToken)
|
||||
TokenDeclVar defaultStateEntry = tokenScript.defaultState.body.eventFuncs;
|
||||
while(defaultStateEntry != null)
|
||||
{
|
||||
if(defaultStateEntry.funcNameSig.val == "state_entry()")
|
||||
if("state_entry()".Equals(defaultStateEntry.funcNameSig.val))
|
||||
break;
|
||||
defaultStateEntry = (TokenDeclVar)defaultStateEntry.nextToken;
|
||||
}
|
||||
if(defaultStateEntry == null)
|
||||
if (defaultStateEntry == null)
|
||||
{
|
||||
defaultStateEntry = new TokenDeclVar(tokenScript.defaultState.body, null, tokenScript)
|
||||
{
|
||||
@@ -6225,9 +6221,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
|
||||
public static string ArgSigString(TokenType[] argsig)
|
||||
{
|
||||
if(argsig == null)
|
||||
return "";
|
||||
StringBuilder sb = new ('(');
|
||||
for(int i = 0; i < argsig.Length; i++)
|
||||
return string.Empty;
|
||||
if(argsig.Length == 0)
|
||||
return "()";
|
||||
|
||||
StringBuilder sb = new ();
|
||||
sb.Append('(');
|
||||
for (int i = 0; i < argsig.Length; i++)
|
||||
{
|
||||
if(i > 0)
|
||||
sb.Append(',');
|
||||
|
||||
Reference in New Issue
Block a user