De-tabify source.

0.6.0-stable
Jeff Ames 2008-05-06 22:41:38 +00:00
parent 0b09966c7e
commit 0ea48cf786
9 changed files with 533 additions and 527 deletions

View File

@ -198,7 +198,6 @@ namespace OpenSim.Data.MSSQL
while (reader.Read()) while (reader.Read())
items.Add(readInventoryFolder(reader)); items.Add(readInventoryFolder(reader));
reader.Close(); reader.Close();
result.Dispose(); result.Dispose();

View File

@ -186,8 +186,6 @@ namespace OpenSim.Region.Environment.Scenes
string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid)); string.Format("[SCENE OBJECT GROUP]: Object {0} has no root part.", m_uuid));
} }
return m_rootPart.GroupPosition; return m_rootPart.GroupPosition;
} }
set set
@ -198,7 +196,6 @@ namespace OpenSim.Region.Environment.Scenes
m_scene.CrossPrimGroupIntoNewRegion(val, this); m_scene.CrossPrimGroupIntoNewRegion(val, this);
} }
lock (m_parts) lock (m_parts)
{ {
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
@ -977,9 +974,9 @@ namespace OpenSim.Region.Environment.Scenes
{ {
foreach (SceneObjectPart part in m_parts.Values) foreach (SceneObjectPart part in m_parts.Values)
{ {
if(part == null) if (part == null)
continue; continue;
if(part != RootPart) if (part != RootPart)
part.ObjectFlags = objectflagupdate; part.ObjectFlags = objectflagupdate;
aggregateScriptEvents |= part.m_aggregateScriptEvents; aggregateScriptEvents |= part.m_aggregateScriptEvents;
} }

View File

@ -213,8 +213,8 @@ namespace OpenSim.Region.Environment.Scenes
public uint GetEffectiveObjectFlags() public uint GetEffectiveObjectFlags()
{ {
LLObject.ObjectFlags f=Flags; LLObject.ObjectFlags f = Flags;
if(m_parentGroup == null || m_parentGroup.RootPart == this) if (m_parentGroup == null || m_parentGroup.RootPart == this)
f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money); f &= ~(LLObject.ObjectFlags.Touch | LLObject.ObjectFlags.Money);
return (uint)Flags | (uint)LocalFlags; return (uint)Flags | (uint)LocalFlags;
@ -2158,14 +2158,14 @@ namespace OpenSim.Region.Environment.Scenes
} }
} }
if(soundID == LLUUID.Zero) if (soundID == LLUUID.Zero)
return; return;
List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars(); List<ScenePresence> avatarts = m_parentGroup.Scene.GetAvatars();
foreach (ScenePresence p in avatarts) foreach (ScenePresence p in avatarts)
{ {
double dis=Util.GetDistanceTo(p.AbsolutePosition, position); double dis=Util.GetDistanceTo(p.AbsolutePosition, position);
if(dis > 100.0) // Max audio distance if (dis > 100.0) // Max audio distance
continue; continue;
// Scale by distance // Scale by distance
@ -2712,14 +2712,13 @@ namespace OpenSim.Region.Environment.Scenes
LocalFlags=(LLObject.ObjectFlags)objectflagupdate; LocalFlags=(LLObject.ObjectFlags)objectflagupdate;
if(m_parentGroup != null && m_parentGroup.RootPart == this) if (m_parentGroup != null && m_parentGroup.RootPart == this)
m_parentGroup.aggregateScriptEvents(); m_parentGroup.aggregateScriptEvents();
else else
ScheduleFullUpdate(); ScheduleFullUpdate();
} }
public void PhysicsCollision(EventArgs e) public void PhysicsCollision(EventArgs e)
{ {
return; return;
// //
@ -2733,7 +2732,6 @@ namespace OpenSim.Region.Environment.Scenes
//{ //{
// m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString()); // m_log.Debug("[OBJECT]: Collided with:" + localid.ToString() + " at depth of: " + collissionswith[localid].ToString());
//} //}
} }
public void SetDieAtEdge(bool p) public void SetDieAtEdge(bool p)
@ -2755,5 +2753,4 @@ namespace OpenSim.Region.Environment.Scenes
return m_parentGroup.RootPart.DIE_AT_EDGE; return m_parentGroup.RootPart.DIE_AT_EDGE;
} }
} }
} }

View File

@ -490,7 +490,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public void llRegionSay(int channelID, string text) public void llRegionSay(int channelID, string text)
{ {
if(channelID == 0) if (channelID == 0)
{ {
LSLError("Cannot use llRegionSay() on channel 0"); LSLError("Cannot use llRegionSay() on channel 0");
return; return;
@ -1087,12 +1087,12 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
LLUUID textureID=new LLUUID(); LLUUID textureID=new LLUUID();
if(!LLUUID.TryParse(texture, out textureID)) if (!LLUUID.TryParse(texture, out textureID))
{ {
textureID=InventoryKey(texture, (int)AssetType.Texture); textureID=InventoryKey(texture, (int)AssetType.Texture);
} }
if(textureID == LLUUID.Zero) if (textureID == LLUUID.Zero)
return; return;
LLObject.TextureEntry tex = part.Shape.Textures; LLObject.TextureEntry tex = part.Shape.Textures;
@ -1569,7 +1569,7 @@ namespace OpenSim.Region.ScriptEngine.Common
if (start <= end) if (start <= end)
{ {
// Implies both bounds are out-of-range. // Implies both bounds are out-of-range.
if(end < 0 || start >= src.Length) if (end < 0 || start >= src.Length)
{ {
return String.Empty; return String.Empty;
} }
@ -1577,12 +1577,12 @@ namespace OpenSim.Region.ScriptEngine.Common
// corresponds to the lengt of the substring // corresponds to the lengt of the substring
// needed (plus one of course). BUT, it // needed (plus one of course). BUT, it
// must be within bounds. // must be within bounds.
if(end >= src.Length) if (end >= src.Length)
{ {
end = src.Length-1; end = src.Length-1;
} }
if(start < 0) if (start < 0)
{ {
return src.Substring(0,end+1); return src.Substring(0,end+1);
} }
@ -1597,21 +1597,21 @@ namespace OpenSim.Region.ScriptEngine.Common
// lower bound. In the inverted case, that // lower bound. In the inverted case, that
// means the entire string will be returned // means the entire string will be returned
// unchanged. // unchanged.
if(start < 0) if (start < 0)
{ {
return src; return src;
} }
// If both indices are greater than the upper // If both indices are greater than the upper
// bound the result may seem initially counter // bound the result may seem initially counter
// intuitive. // intuitive.
if(end >= src.Length) if (end >= src.Length)
{ {
return src; return src;
} }
if(end < 0) if (end < 0)
{ {
if(start < src.Length) if (start < src.Length)
{ {
return src.Substring(start); return src.Substring(start);
} }
@ -1622,7 +1622,7 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
else else
{ {
if(start < src.Length) if (start < src.Length)
{ {
return src.Substring(0,end+1) + src.Substring(start); return src.Substring(0,end+1) + src.Substring(start);
} }
@ -1664,18 +1664,18 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
// If both bounds are outside of the existing // If both bounds are outside of the existing
// string, then return unchanges. // string, then return unchanges.
if(end < 0 || start >= src.Length) if (end < 0 || start >= src.Length)
{ {
return src; return src;
} }
// At least one bound is in-range, so we // At least one bound is in-range, so we
// need to clip the out-of-bound argument. // need to clip the out-of-bound argument.
if(start < 0) if (start < 0)
{ {
start = 0; start = 0;
} }
if(end >= src.Length) if (end >= src.Length)
{ {
end = src.Length-1; end = src.Length-1;
} }
@ -1687,14 +1687,14 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
// In this case, out of bounds means that // In this case, out of bounds means that
// the existing string is part of the cut. // the existing string is part of the cut.
if(start < 0 || end >= src.Length) if (start < 0 || end >= src.Length)
{ {
return String.Empty; return String.Empty;
} }
if(end > 0) if (end > 0)
{ {
if(start < src.Length) if (start < src.Length)
{ {
return src.Remove(start).Remove(0,end+1); return src.Remove(start).Remove(0,end+1);
} }
@ -1705,7 +1705,7 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
else else
{ {
if(start < src.Length) if (start < src.Length)
{ {
return src.Remove(start); return src.Remove(start);
} }
@ -1741,14 +1741,14 @@ namespace OpenSim.Region.ScriptEngine.Common
// Negative now means it is less than the lower // Negative now means it is less than the lower
// bound of the string. // bound of the string.
if(index < 0) if (index < 0)
{ {
return src+dest; return src+dest;
} }
} }
if(index >= dest.Length) if (index >= dest.Length)
{ {
return dest+src; return dest+src;
} }
@ -1777,15 +1777,15 @@ namespace OpenSim.Region.ScriptEngine.Common
public int llGiveMoney(string destination, int amount) public int llGiveMoney(string destination, int amount)
{ {
LLUUID invItemID=InventorySelf(); LLUUID invItemID=InventorySelf();
if(invItemID == LLUUID.Zero) if (invItemID == LLUUID.Zero)
return 0; return 0;
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
return 0; return 0;
if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0) if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_DEBIT) == 0)
{ {
LSLError("No permissions to give money"); LSLError("No permissions to give money");
return 0; return 0;
@ -1793,7 +1793,7 @@ namespace OpenSim.Region.ScriptEngine.Common
LLUUID toID=new LLUUID(); LLUUID toID=new LLUUID();
if(!LLUUID.TryParse(destination, out toID)) if (!LLUUID.TryParse(destination, out toID))
{ {
LSLError("Bad key in llGiveMoney"); LSLError("Bad key in llGiveMoney");
return 0; return 0;
@ -1801,7 +1801,7 @@ namespace OpenSim.Region.ScriptEngine.Common
IMoneyModule money=World.RequestModuleInterface<IMoneyModule>(); IMoneyModule money=World.RequestModuleInterface<IMoneyModule>();
if(money == null) if (money == null)
{ {
NotImplemented("llGiveMoney"); NotImplemented("llGiveMoney");
return 0; return 0;
@ -1809,7 +1809,7 @@ namespace OpenSim.Region.ScriptEngine.Common
bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount); bool result=money.ObjectGiveMoney(m_host.ParentGroup.RootPart.UUID, m_host.ParentGroup.RootPart.OwnerID, toID, amount);
if(result) if (result)
return 1; return 1;
return 0; return 0;
@ -2113,17 +2113,17 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LLUUID invItemID=InventorySelf(); LLUUID invItemID=InventorySelf();
if(invItemID == LLUUID.Zero) if (invItemID == LLUUID.Zero)
return; return;
if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
return; return;
if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
{ {
// Do NOT try to parse LLUUID, animations cannot be triggered by ID // Do NOT try to parse LLUUID, animations cannot be triggered by ID
LLUUID animID=InventoryKey(anim, (int)AssetType.Animation); LLUUID animID=InventoryKey(anim, (int)AssetType.Animation);
if(animID == LLUUID.Zero) if (animID == LLUUID.Zero)
return; return;
if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
@ -2139,22 +2139,22 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LLUUID invItemID=InventorySelf(); LLUUID invItemID=InventorySelf();
if(invItemID == LLUUID.Zero) if (invItemID == LLUUID.Zero)
return; return;
if(m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero) if (m_host.TaskInventory[invItemID].PermsGranter == LLUUID.Zero)
return; return;
if((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0) if ((m_host.TaskInventory[invItemID].PermsMask & BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION) != 0)
{ {
LLUUID animID = new LLUUID(); LLUUID animID = new LLUUID();
if(!LLUUID.TryParse(anim, out animID)) if (!LLUUID.TryParse(anim, out animID))
{ {
animID=InventoryKey(anim); animID=InventoryKey(anim);
} }
if(animID == LLUUID.Zero) if (animID == LLUUID.Zero)
return; return;
if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter)) if (World.m_innerScene.ScenePresences.ContainsKey(m_host.TaskInventory[invItemID].PermsGranter))
@ -2203,15 +2203,15 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
LLUUID agentID=new LLUUID(); LLUUID agentID=new LLUUID();
if(!LLUUID.TryParse(agent, out agentID)) if (!LLUUID.TryParse(agent, out agentID))
return; return;
LLUUID invItemID=InventorySelf(); LLUUID invItemID=InventorySelf();
if(invItemID == LLUUID.Zero) if (invItemID == LLUUID.Zero)
return; // Not in a prim? How?? return; // Not in a prim? How??
if(agentID == LLUUID.Zero || perm == 0) // Releasing permissions if (agentID == LLUUID.Zero || perm == 0) // Releasing permissions
{ {
m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero; m_host.TaskInventory[invItemID].PermsGranter=LLUUID.Zero;
m_host.TaskInventory[invItemID].PermsMask=0; m_host.TaskInventory[invItemID].PermsMask=0;
@ -2226,14 +2226,14 @@ namespace OpenSim.Region.ScriptEngine.Common
bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state bool attachment=false; // Attachments not implemented yet. TODO: reflect real attachemnt state
if(m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar) if (m_host.ParentGroup.RootPart.m_IsAttachment && agent == m_host.ParentGroup.RootPart.m_attachedAvatar)
{ {
// When attached, certain permissions are implicit if requested from owner // When attached, certain permissions are implicit if requested from owner
int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS | int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TAKE_CONTROLS |
BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION |
BuiltIn_Commands_BaseClass.PERMISSION_ATTACH; BuiltIn_Commands_BaseClass.PERMISSION_ATTACH;
if((perm & (~implicitPerms)) == 0) // Requested only implicit perms if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{ {
m_host.TaskInventory[invItemID].PermsGranter=agentID; m_host.TaskInventory[invItemID].PermsGranter=agentID;
m_host.TaskInventory[invItemID].PermsMask=perm; m_host.TaskInventory[invItemID].PermsMask=perm;
@ -2244,13 +2244,13 @@ namespace OpenSim.Region.ScriptEngine.Common
return; return;
} }
} }
else if(m_host.m_sitTargetAvatar == agentID) // Sitting avatar else if (m_host.m_sitTargetAvatar == agentID) // Sitting avatar
{ {
// When agent is sitting, certain permissions are implicit if requested from sitting agent // When agent is sitting, certain permissions are implicit if requested from sitting agent
int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION | int implicitPerms = BuiltIn_Commands_BaseClass.PERMISSION_TRIGGER_ANIMATION |
BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA; BuiltIn_Commands_BaseClass.PERMISSION_TRACK_CAMERA;
if((perm & (~implicitPerms)) == 0) // Requested only implicit perms if ((perm & (~implicitPerms)) == 0) // Requested only implicit perms
{ {
m_host.TaskInventory[invItemID].PermsGranter=agentID; m_host.TaskInventory[invItemID].PermsGranter=agentID;
m_host.TaskInventory[invItemID].PermsMask=perm; m_host.TaskInventory[invItemID].PermsMask=perm;
@ -2265,11 +2265,11 @@ namespace OpenSim.Region.ScriptEngine.Common
if (World.m_innerScene.ScenePresences.ContainsKey(agentID)) if (World.m_innerScene.ScenePresences.ContainsKey(agentID))
{ {
string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID); string ownerName=resolveName(m_host.ParentGroup.RootPart.OwnerID);
if(ownerName == String.Empty) if (ownerName == String.Empty)
ownerName="(hippos)"; ownerName="(hippos)";
ScenePresence presence = World.m_innerScene.ScenePresences[agentID]; ScenePresence presence = World.m_innerScene.ScenePresences[agentID];
if(!m_waitingForScriptAnswer) if (!m_waitingForScriptAnswer)
{ {
m_host.TaskInventory[invItemID].PermsGranter=agentID; m_host.TaskInventory[invItemID].PermsGranter=agentID;
m_host.TaskInventory[invItemID].PermsMask=0; m_host.TaskInventory[invItemID].PermsMask=0;
@ -2288,12 +2288,12 @@ namespace OpenSim.Region.ScriptEngine.Common
void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer) void handleScriptAnswer(IClientAPI client, LLUUID taskID, LLUUID itemID, int answer)
{ {
if(taskID != m_host.UUID) if (taskID != m_host.UUID)
return; return;
LLUUID invItemID=InventorySelf(); LLUUID invItemID=InventorySelf();
if(invItemID == LLUUID.Zero) if (invItemID == LLUUID.Zero)
return; return;
client.OnScriptAnswer-=handleScriptAnswer; client.OnScriptAnswer-=handleScriptAnswer;
@ -2310,7 +2310,7 @@ namespace OpenSim.Region.ScriptEngine.Common
foreach (TaskInventoryItem item in m_host.TaskInventory.Values) foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{ {
if(item.Type == 10 && item.ItemID == m_itemID) if (item.Type == 10 && item.ItemID == m_itemID)
{ {
return item.PermsGranter.ToString(); return item.PermsGranter.ToString();
} }
@ -2325,7 +2325,7 @@ namespace OpenSim.Region.ScriptEngine.Common
foreach (TaskInventoryItem item in m_host.TaskInventory.Values) foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{ {
if(item.Type == 10 && item.ItemID == m_itemID) if (item.Type == 10 && item.ItemID == m_itemID)
{ {
return item.PermsMask; return item.PermsMask;
} }
@ -2541,16 +2541,23 @@ namespace OpenSim.Region.ScriptEngine.Common
// These functions are supposed to be robust, // These functions are supposed to be robust,
// so get the state one step at a time. // so get the state one step at a time.
if((item = ScriptByName(name)) != LLUUID.Zero) if ((item = ScriptByName(name)) != LLUUID.Zero)
if((sm = m_ScriptEngine.m_ScriptManager) != null) {
if(sm.Scripts.ContainsKey(m_localID)) if ((sm = m_ScriptEngine.m_ScriptManager) != null)
if((script = sm.GetScript(m_localID, item)) != null) {
if (sm.Scripts.ContainsKey(m_localID))
{
if ((script = sm.GetScript(m_localID, item)) != null)
{
script.Exec.Running = (run==0) ? false : true; script.Exec.Running = (run==0) ? false : true;
}
}
}
}
// Required by SL // Required by SL
if(script == null) if (script == null)
ShoutError("llSetScriptState: script "+name+" not found"); ShoutError("llSetScriptState: script "+name+" not found");
// If we didn;t find it, then it's safe to // If we didn;t find it, then it's safe to
@ -2858,7 +2865,7 @@ namespace OpenSim.Region.ScriptEngine.Common
foreach (TaskInventoryItem item in m_host.TaskInventory.Values) foreach (TaskInventoryItem item in m_host.TaskInventory.Values)
{ {
if(item.Type == 10 && item.ItemID == m_itemID) if (item.Type == 10 && item.ItemID == m_itemID)
{ {
result = item.Name!=null?item.Name:String.Empty; result = item.Name!=null?item.Name:String.Empty;
break; break;
@ -3013,9 +3020,9 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory) foreach (KeyValuePair<LLUUID, TaskInventoryItem> inv in m_host.TaskInventory)
{ {
if(inv.Value.Name == name) if (inv.Value.Name == name)
{ {
if((inv.Value.OwnerMask & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) if ((inv.Value.OwnerMask & (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify)) == (uint)(PermissionMask.Copy | PermissionMask.Transfer | PermissionMask.Modify))
{ {
return inv.Value.AssetID.ToString(); return inv.Value.AssetID.ToString();
} }
@ -3321,7 +3328,7 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(src.Data.Length > 0) if (src.Data.Length > 0)
{ {
ret = src.Data[x++].ToString(); ret = src.Data[x++].ToString();
for(;x<src.Data.Length;x++) for(;x<src.Data.Length;x++)
@ -3361,12 +3368,12 @@ namespace OpenSim.Region.ScriptEngine.Common
length++; length++;
break; break;
case '>' : case '>' :
if(parens > 0) if (parens > 0)
parens--; parens--;
length++; length++;
break; break;
case ',' : case ',' :
if(parens == 0) if (parens == 0)
{ {
result.Add(src.Substring(start,length).Trim()); result.Add(src.Substring(start,length).Trim());
start += length+1; start += length+1;
@ -3411,14 +3418,14 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(stride == 0) if (stride == 0)
stride = 1; stride = 1;
// Stride MUST be a factor of the list length // Stride MUST be a factor of the list length
// If not, then return the src list. This also // If not, then return the src list. This also
// traps those cases where stride > length. // traps those cases where stride > length.
if(src.Length != stride && src.Length%stride == 0) if (src.Length != stride && src.Length%stride == 0)
{ {
chunkk = src.Length/stride; chunkk = src.Length/stride;
@ -3481,26 +3488,26 @@ namespace OpenSim.Region.ScriptEngine.Common
// First step is always to deal with negative indices // First step is always to deal with negative indices
if(start < 0) if (start < 0)
start = src.Length+start; start = src.Length+start;
if(end < 0) if (end < 0)
end = src.Length+end; end = src.Length+end;
// Out of bounds indices are OK, just trim them // Out of bounds indices are OK, just trim them
// accordingly // accordingly
if(start > src.Length) if (start > src.Length)
start = src.Length; start = src.Length;
if(end > src.Length) if (end > src.Length)
end = src.Length; end = src.Length;
// There may be one or two ranges to be considered // There may be one or two ranges to be considered
if(start != end) if (start != end)
{ {
if(start <= end) if (start <= end)
{ {
si[0] = start; si[0] = start;
ei[0] = end; ei[0] = end;
@ -3521,23 +3528,23 @@ namespace OpenSim.Region.ScriptEngine.Common
// A negative stride reverses the direction of the // A negative stride reverses the direction of the
// scan producing an inverted list as a result. // scan producing an inverted list as a result.
if(stride == 0) if (stride == 0)
stride = 1; stride = 1;
if(stride > 0) if (stride > 0)
for(int i=0;i<src.Length;i+=stride) for(int i=0;i<src.Length;i+=stride)
{ {
if(i<=ei[0] && i>=si[0]) if (i<=ei[0] && i>=si[0])
result.Add(src.Data[i]); result.Add(src.Data[i]);
if(twopass && i>=si[1] && i<=ei[1]) if (twopass && i>=si[1] && i<=ei[1])
result.Add(src.Data[i]); result.Add(src.Data[i]);
} }
else if(stride < 0) else if (stride < 0)
for(int i=src.Length-1;i>=0;i+=stride) for(int i=src.Length-1;i>=0;i+=stride)
{ {
if(i<=ei[0] && i>=si[0]) if (i<=ei[0] && i>=si[0])
result.Add(src.Data[i]); result.Add(src.Data[i]);
if(twopass && i>=si[1] && i<=ei[1]) if (twopass && i>=si[1] && i<=ei[1])
result.Add(src.Data[i]); result.Add(src.Data[i]);
} }
} }
@ -3566,19 +3573,19 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(index < 0) if (index < 0)
{ {
index = index+dest.Length; index = index+dest.Length;
if(index < 0) if (index < 0)
{ {
index = 0; index = 0;
} }
} }
if(index != 0) if (index != 0)
{ {
pref = dest.GetSublist(0,index-1); pref = dest.GetSublist(0,index-1);
if(index < dest.Length) if (index < dest.Length)
{ {
suff = dest.GetSublist(index,-1); suff = dest.GetSublist(index,-1);
return pref + src + suff; return pref + src + suff;
@ -3590,7 +3597,7 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
else else
{ {
if(index < dest.Length) if (index < dest.Length)
{ {
suff = dest.GetSublist(index,-1); suff = dest.GetSublist(index,-1);
return src + suff; return src + suff;
@ -3618,17 +3625,17 @@ namespace OpenSim.Region.ScriptEngine.Common
// If either list is empty, do not match // If either list is empty, do not match
if(src.Length != 0 && test.Length != 0) if (src.Length != 0 && test.Length != 0)
{ {
for(int i=0; i< length; i++) for(int i=0; i< length; i++)
{ {
if(src.Data[i].Equals(test.Data[0])) if (src.Data[i].Equals(test.Data[0]))
{ {
int j; int j;
for(j=1;j<test.Length;j++) for(j=1;j<test.Length;j++)
if(!src.Data[i+j].Equals(test.Data[j])) if (!src.Data[i+j].Equals(test.Data[j]))
break; break;
if(j == test.Length) if (j == test.Length)
{ {
index = i; index = i;
break; break;
@ -4292,7 +4299,7 @@ namespace OpenSim.Region.ScriptEngine.Common
LSLError("First parameter to llDialog needs to be a key"); LSLError("First parameter to llDialog needs to be a key");
return; return;
} }
if(buttons.Length > 12) if (buttons.Length > 12)
{ {
LSLError("No more than 12 buttons can be shown"); LSLError("No more than 12 buttons can be shown");
return; return;
@ -4300,12 +4307,12 @@ namespace OpenSim.Region.ScriptEngine.Common
string[] buts = new string[buttons.Length]; string[] buts = new string[buttons.Length];
for(int i = 0; i < buttons.Length; i++) for(int i = 0; i < buttons.Length; i++)
{ {
if(buttons.Data[i].ToString() == String.Empty) if (buttons.Data[i].ToString() == String.Empty)
{ {
LSLError("button label cannot be blank"); LSLError("button label cannot be blank");
return; return;
} }
if(buttons.Data[i].ToString().Length > 24) if (buttons.Data[i].ToString().Length > 24)
{ {
LSLError("button label cannot be longer than 24 characters"); LSLError("button label cannot be longer than 24 characters");
return; return;
@ -4338,13 +4345,13 @@ namespace OpenSim.Region.ScriptEngine.Common
// These functions are supposed to be robust, // These functions are supposed to be robust,
// so get the state one step at a time. // so get the state one step at a time.
if((item = ScriptByName(name)) != LLUUID.Zero) if ((item = ScriptByName(name)) != LLUUID.Zero)
if((sm = m_ScriptEngine.m_ScriptManager) != null) if ((sm = m_ScriptEngine.m_ScriptManager) != null)
sm.ResetScript(m_localID, item); sm.ResetScript(m_localID, item);
// Required by SL // Required by SL
if(script == null) if (script == null)
ShoutError("llResetOtherScript: script "+name+" not found"); ShoutError("llResetOtherScript: script "+name+" not found");
// If we didn;t find it, then it's safe to // If we didn;t find it, then it's safe to
@ -4366,14 +4373,20 @@ namespace OpenSim.Region.ScriptEngine.Common
// These functions are supposed to be robust, // These functions are supposed to be robust,
// so get the state one step at a time. // so get the state one step at a time.
if((item = ScriptByName(name)) != LLUUID.Zero) if ((item = ScriptByName(name)) != LLUUID.Zero)
if((sm = m_ScriptEngine.m_ScriptManager) != null) {
if((script = sm.GetScript(m_localID, item)) != null) if ((sm = m_ScriptEngine.m_ScriptManager) != null)
{
if ((script = sm.GetScript(m_localID, item)) != null)
{
return script.Exec.Running?1:0; return script.Exec.Running?1:0;
}
}
}
// Required by SL // Required by SL
if(script == null) if (script == null)
ShoutError("llGetScriptState: script "+name+" not found"); ShoutError("llGetScriptState: script "+name+" not found");
// If we didn;t find it, then it's safe to // If we didn;t find it, then it's safe to
@ -4456,7 +4469,7 @@ namespace OpenSim.Region.ScriptEngine.Common
SceneObjectPart part=null; SceneObjectPart part=null;
if(m_host.LinkNum+1 != linknumber) if (m_host.LinkNum+1 != linknumber)
{ {
foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts()) foreach (SceneObjectPart partInst in m_host.ParentGroup.GetParts())
{ {
@ -4472,7 +4485,7 @@ namespace OpenSim.Region.ScriptEngine.Common
part=m_host; part=m_host;
} }
if(part == null) if (part == null)
return; return;
@ -4490,7 +4503,7 @@ namespace OpenSim.Region.ScriptEngine.Common
switch(code) switch(code)
{ {
case 6: // PRIM_POSITION case 6: // PRIM_POSITION
if(remain < 1) if (remain < 1)
return; return;
v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
@ -4499,7 +4512,7 @@ namespace OpenSim.Region.ScriptEngine.Common
break; break;
case 8: // PRIM_ROTATION case 8: // PRIM_ROTATION
if(remain < 1) if (remain < 1)
return; return;
LSL_Types.Quaternion q = new LSL_Types.Quaternion(rules.Data[idx++].ToString()); LSL_Types.Quaternion q = new LSL_Types.Quaternion(rules.Data[idx++].ToString());
@ -4508,7 +4521,7 @@ namespace OpenSim.Region.ScriptEngine.Common
break; break;
case 17: // PRIM_TEXTURE case 17: // PRIM_TEXTURE
if(remain < 5) if (remain < 5)
return; return;
face=Convert.ToInt32(rules.Data[idx++]); face=Convert.ToInt32(rules.Data[idx++]);
@ -4525,7 +4538,7 @@ namespace OpenSim.Region.ScriptEngine.Common
break; break;
case 18: // PRIM_COLOR case 18: // PRIM_COLOR
if(remain < 3) if (remain < 3)
return; return;
face=Convert.ToInt32(rules.Data[idx++]); face=Convert.ToInt32(rules.Data[idx++]);
@ -4538,7 +4551,7 @@ namespace OpenSim.Region.ScriptEngine.Common
break; break;
case 7: // PRIM_SIZE case 7: // PRIM_SIZE
if(remain < 1) if (remain < 1)
return; return;
v=new LSL_Types.Vector3(rules.Data[idx++].ToString()); v=new LSL_Types.Vector3(rules.Data[idx++].ToString());
@ -4637,12 +4650,12 @@ namespace OpenSim.Region.ScriptEngine.Common
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
LLUUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y); LLUUID landowner = World.GetLandOwner(m_host.AbsolutePosition.X, m_host.AbsolutePosition.Y);
if(landowner == LLUUID.Zero) if (landowner == LLUUID.Zero)
{ {
return; return;
} }
if(landowner != m_host.ObjectOwner) if (landowner != m_host.ObjectOwner)
{ {
return; return;
} }
@ -5000,7 +5013,7 @@ namespace OpenSim.Region.ScriptEngine.Common
// Require a well-fromed base64 string // Require a well-fromed base64 string
if(str.Length > 8) if (str.Length > 8)
return 0; return 0;
// The loop is unrolled in the interests // The loop is unrolled in the interests
@ -5010,37 +5023,37 @@ namespace OpenSim.Region.ScriptEngine.Common
// -1 == invalid // -1 == invalid
// 0 == padding // 0 == padding
if((digit=c2itable[str[0]])<=0) if ((digit=c2itable[str[0]])<=0)
{ {
return digit<0?(int)0:number; return digit<0?(int)0:number;
} }
number += --digit<<26; number += --digit<<26;
if((digit=c2itable[str[1]])<=0) if ((digit=c2itable[str[1]])<=0)
{ {
return digit<0?(int)0:number; return digit<0?(int)0:number;
} }
number += --digit<<20; number += --digit<<20;
if((digit=c2itable[str[2]])<=0) if ((digit=c2itable[str[2]])<=0)
{ {
return digit<0?(int)0:number; return digit<0?(int)0:number;
} }
number += --digit<<14; number += --digit<<14;
if((digit=c2itable[str[3]])<=0) if ((digit=c2itable[str[3]])<=0)
{ {
return digit<0?(int)0:number; return digit<0?(int)0:number;
} }
number += --digit<<8; number += --digit<<8;
if((digit=c2itable[str[4]])<=0) if ((digit=c2itable[str[4]])<=0)
{ {
return digit<0?(int)0:number; return digit<0?(int)0:number;
} }
number += --digit<<2; number += --digit<<2;
if((digit=c2itable[str[5]])<=0) if ((digit=c2itable[str[5]])<=0)
{ {
return digit<0?(int)0:number; return digit<0?(int)0:number;
} }
@ -5156,21 +5169,21 @@ namespace OpenSim.Region.ScriptEngine.Common
for(j=0; j<seplen; j++) for(j=0; j<seplen; j++)
{ {
if(active[j]) if (active[j])
{ {
// scan all of the markers // scan all of the markers
if((offset[j] = src.IndexOf((string)separray[j],beginning)) == -1) if ((offset[j] = src.IndexOf((string)separray[j],beginning)) == -1)
{ {
// not present at all // not present at all
active[j] = false; active[j] = false;
} else } else
{ {
// present and correct // present and correct
if(offset[j] < offset[best]) if (offset[j] < offset[best])
{ {
// closest so far // closest so far
best = j; best = j;
if(offset[best] == beginning) if (offset[best] == beginning)
break; break;
} }
} }
@ -5179,21 +5192,21 @@ namespace OpenSim.Region.ScriptEngine.Common
// Scan for spacers // Scan for spacers
if(offset[best] != beginning) if (offset[best] != beginning)
{ {
for(j=seplen; (j<mlen) && (offset[best] > beginning); j++) for(j=seplen; (j<mlen) && (offset[best] > beginning); j++)
{ {
if(active[j]) if (active[j])
{ {
// scan all of the markers // scan all of the markers
if((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1) if ((offset[j] = src.IndexOf((string)spcarray[j-seplen],beginning)) == -1)
{ {
// not present at all // not present at all
active[j] = false; active[j] = false;
} else } else
{ {
// present and correct // present and correct
if(offset[j] < offset[best]) if (offset[j] < offset[best])
{ {
// closest so far // closest so far
best = j; best = j;
@ -5205,7 +5218,7 @@ namespace OpenSim.Region.ScriptEngine.Common
// This is the normal exit from the scanning loop // This is the normal exit from the scanning loop
if(best == mlen) if (best == mlen)
{ {
// no markers were found on this pass // no markers were found on this pass
// so we're pretty much done // so we're pretty much done
@ -5218,7 +5231,7 @@ namespace OpenSim.Region.ScriptEngine.Common
tokens.Add(src.Substring(beginning,offset[best]-beginning)); tokens.Add(src.Substring(beginning,offset[best]-beginning));
if(best<seplen) if (best<seplen)
{ {
beginning = offset[best]+((string)separray[best]).Length; beginning = offset[best]+((string)separray[best]).Length;
} else } else
@ -5235,9 +5248,9 @@ namespace OpenSim.Region.ScriptEngine.Common
// arduous. Alternatively the 'break' could be replced with a return // arduous. Alternatively the 'break' could be replced with a return
// but that's shabby programming. // but that's shabby programming.
if(beginning == srclen) if (beginning == srclen)
{ {
if(srclen != 0) if (srclen != 0)
tokens.Add(""); tokens.Add("");
} }
@ -5418,30 +5431,30 @@ namespace OpenSim.Region.ScriptEngine.Common
// Note that although we have normalized, both // Note that although we have normalized, both
// indices could still be negative. // indices could still be negative.
if(start < 0) if (start < 0)
{ {
start = start+dest.Length; start = start+dest.Length;
} }
if(end < 0) if (end < 0)
{ {
end = end+dest.Length; end = end+dest.Length;
} }
// The comventional case, remove a sequence starting with // The comventional case, remove a sequence starting with
// start and ending with end. And then insert the source // start and ending with end. And then insert the source
// list. // list.
if(start <= end) if (start <= end)
{ {
// If greater than zero, then there is going to be a // If greater than zero, then there is going to be a
// surviving prefix. Otherwise the inclusive nature // surviving prefix. Otherwise the inclusive nature
// of the indices mean that we're going to add the // of the indices mean that we're going to add the
// source list as a prefix. // source list as a prefix.
if(start > 0) if (start > 0)
{ {
pref = dest.GetSublist(0,start-1); pref = dest.GetSublist(0,start-1);
// Only add a suffix if there is something // Only add a suffix if there is something
// beyond the end index (it's inclusive too). // beyond the end index (it's inclusive too).
if(end+1 < dest.Length) if (end+1 < dest.Length)
{ {
return pref + src + dest.GetSublist(end+1,-1); return pref + src + dest.GetSublist(end+1,-1);
} }
@ -5458,7 +5471,7 @@ namespace OpenSim.Region.ScriptEngine.Common
// is removed. // is removed.
else else
{ {
if(end+1 < dest.Length) if (end+1 < dest.Length)
{ {
return src + dest.GetSublist(end+1,-1); return src + dest.GetSublist(end+1,-1);
} }
@ -5525,7 +5538,7 @@ namespace OpenSim.Region.ScriptEngine.Common
{ {
m_host.AddScriptLPS(1); m_host.AddScriptLPS(1);
if(quick_pay_buttons.Data.Length != 4) if (quick_pay_buttons.Data.Length != 4)
{ {
LSLError("List must have 4 elements"); LSLError("List must have 4 elements");
return; return;
@ -5798,14 +5811,14 @@ namespace OpenSim.Region.ScriptEngine.Common
LandData land = World.GetLandData((float)pos.x, (float)pos.y); LandData land = World.GetLandData((float)pos.x, (float)pos.y);
if(land == null) if (land == null)
{ {
return 0; return 0;
} }
else else
{ {
if(sim_wide == 1) if (sim_wide == 1)
{ {
if (category == 0) if (category == 0)
{ {
@ -5821,32 +5834,32 @@ namespace OpenSim.Region.ScriptEngine.Common
else else
{ {
if(category == 0)//Total Prims if (category == 0)//Total Prims
{ {
return 0;//land. return 0;//land.
} }
else if(category == 1)//Owner Prims else if (category == 1)//Owner Prims
{ {
return land.ownerPrims; return land.ownerPrims;
} }
else if(category == 2)//Group Prims else if (category == 2)//Group Prims
{ {
return land.groupPrims; return land.groupPrims;
} }
else if(category == 3)//Other Prims else if (category == 3)//Other Prims
{ {
return land.otherPrims; return land.otherPrims;
} }
else if(category == 4)//Selected else if (category == 4)//Selected
{ {
return land.selectedPrims; return land.selectedPrims;
} }
else if(category == 5)//Temp else if (category == 5)//Temp
{ {
return 0;//land. return 0;//land.
} }

View File

@ -64,7 +64,7 @@ namespace OpenSim.Region.ScriptEngine.Common
str = str.Replace('<', ' '); str = str.Replace('<', ' ');
str = str.Replace('>', ' '); str = str.Replace('>', ' ');
string[] tmps = str.Split(new Char[] { ',', '<', '>' }); string[] tmps = str.Split(new Char[] { ',', '<', '>' });
if(tmps.Length < 3) if (tmps.Length < 3)
{ {
x=y=z=0; x=y=z=0;
return; return;
@ -296,7 +296,7 @@ namespace OpenSim.Region.ScriptEngine.Common
str = str.Replace('<', ' '); str = str.Replace('<', ' ');
str = str.Replace('>', ' '); str = str.Replace('>', ' ');
string[] tmps = str.Split(new Char[] { ',', '<', '>' }); string[] tmps = str.Split(new Char[] { ',', '<', '>' });
if(tmps.Length < 4) if (tmps.Length < 4)
{ {
x=y=z=s=0; x=y=z=s=0;
return; return;
@ -406,7 +406,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public int Length public int Length
{ {
get { get {
if(m_data == null) if (m_data == null)
m_data=new Object[0]; m_data=new Object[0];
return m_data.Length; return m_data.Length;
} }
@ -415,7 +415,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public object[] Data public object[] Data
{ {
get { get {
if(m_data == null) if (m_data == null)
m_data=new Object[0]; m_data=new Object[0];
return m_data; return m_data;
} }
@ -462,30 +462,30 @@ namespace OpenSim.Region.ScriptEngine.Common
Object[] ret; Object[] ret;
if(start < 0) if (start < 0)
start=m_data.Length-start; start=m_data.Length-start;
if(start < 0) if (start < 0)
start=0; start=0;
if(end < 0) if (end < 0)
end=m_data.Length-end; end=m_data.Length-end;
if(end < 0) if (end < 0)
end=0; end=0;
if(start > end) if (start > end)
{ {
if(end >= m_data.Length) if (end >= m_data.Length)
return new list(new Object[0]); return new list(new Object[0]);
if(start >= m_data.Length) if (start >= m_data.Length)
start=m_data.Length-1; start=m_data.Length-1;
return GetSublist(end, start); return GetSublist(end, start);
} }
// start >= 0 && end >= 0 here // start >= 0 && end >= 0 here
if(start >= m_data.Length) if (start >= m_data.Length)
{ {
ret=new Object[m_data.Length]; ret=new Object[m_data.Length];
Array.Copy(m_data, 0, ret, 0, m_data.Length); Array.Copy(m_data, 0, ret, 0, m_data.Length);
@ -493,14 +493,14 @@ namespace OpenSim.Region.ScriptEngine.Common
return new list(ret); return new list(ret);
} }
if(end >= m_data.Length) if (end >= m_data.Length)
end=m_data.Length-1; end=m_data.Length-1;
// now, this makes the math easier // now, this makes the math easier
int remove=end+1-start; int remove=end+1-start;
ret=new Object[m_data.Length-remove]; ret=new Object[m_data.Length-remove];
if(ret.Length == 0) if (ret.Length == 0)
return new list(ret); return new list(ret);
int src; int src;
@ -508,7 +508,7 @@ namespace OpenSim.Region.ScriptEngine.Common
for(src = 0 ; src < m_data.Length ; src++) for(src = 0 ; src < m_data.Length ; src++)
{ {
if(src < start || src > end) if (src < start || src > end)
ret[dest++]=m_data[src]; ret[dest++]=m_data[src];
} }
@ -581,13 +581,13 @@ namespace OpenSim.Region.ScriptEngine.Common
list result = null; list result = null;
// If end is negative, then prefix list is empty // If end is negative, then prefix list is empty
if(end < 0) if (end < 0)
{ {
result = new list(); result = new list();
// If start is still negative, then the whole of // If start is still negative, then the whole of
// the existing list is returned. This case is // the existing list is returned. This case is
// only admitted if end is also still negative. // only admitted if end is also still negative.
if(start < 0) if (start < 0)
{ {
return this; return this;
} }
@ -600,7 +600,7 @@ namespace OpenSim.Region.ScriptEngine.Common
// If start is outside of list, then just return // If start is outside of list, then just return
// the prefix, whatever it is. // the prefix, whatever it is.
if(start >= m_data.Length) if (start >= m_data.Length)
{ {
return result; return result;
} }
@ -612,12 +612,12 @@ namespace OpenSim.Region.ScriptEngine.Common
public list Sort(int stride, int ascending) public list Sort(int stride, int ascending)
{ {
if(Data.Length == 0) if (Data.Length == 0)
return new list(); // Don't even bother return new list(); // Don't even bother
string[] keys; string[] keys;
if(stride == 1) // The simple case if (stride == 1) // The simple case
{ {
Object[] ret=new Object[Data.Length]; Object[] ret=new Object[Data.Length];
@ -630,7 +630,7 @@ namespace OpenSim.Region.ScriptEngine.Common
Array.Sort(keys, ret); Array.Sort(keys, ret);
if(ascending == 0) if (ascending == 0)
Array.Reverse(ret); Array.Reverse(ret);
return new list(ret); return new list(ret);
} }
@ -650,7 +650,7 @@ namespace OpenSim.Region.ScriptEngine.Common
for(i=0;i<stride;i++) for(i=0;i<stride;i++)
{ {
if(src < Data.Length) if (src < Data.Length)
o[i]=Data[src++]; o[i]=Data[src++];
else else
{ {
@ -665,7 +665,7 @@ namespace OpenSim.Region.ScriptEngine.Common
} }
Array.Sort(keys, vals); Array.Sort(keys, vals);
if(ascending == 0) if (ascending == 0)
{ {
Array.Reverse(vals); Array.Reverse(vals);
} }
@ -693,7 +693,7 @@ namespace OpenSim.Region.ScriptEngine.Common
string ret = ""; string ret = "";
foreach(object o in this.Data) foreach(object o in this.Data)
{ {
if(ret == "") if (ret == "")
{ {
ret = o.ToString(); ret = o.ToString();
} }