cosmetics

0.9.1.1
UbitUmarov 2019-11-08 17:43:22 +00:00
parent ca4bb8c492
commit 4b5a3308ad
1 changed files with 44 additions and 23 deletions

View File

@ -1254,9 +1254,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
++pos; ++pos;
int count = 0; int count = 0;
foreach (string val in message) for(int indx = 0; indx < message.Count; ++indx)
{ {
tmp = Util.StringToBytes256(val); tmp = Util.StringToBytes256(message[indx]);
len = tmp.Length; len = tmp.Length;
if (pos + len >= LLUDPServer.MAXPAYLOAD) if (pos + len >= LLUDPServer.MAXPAYLOAD)
@ -1325,9 +1325,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int countpos = pos; int countpos = pos;
++pos; ++pos;
byte[] val;
int count = 0; int count = 0;
foreach (byte[] val in message) for (int indx = 0; indx < message.Count; ++indx)
{ {
val = message[indx];
len = val.Length; len = val.Length;
if(len > 255) if(len > 255)
len = 255; len = 255;
@ -2036,8 +2038,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// check if we will need sizes block and get them aside // check if we will need sizes block and get them aside
int count = 0; int count = 0;
ushort ut; ushort ut;
foreach (MapBlockData md in mapBlocks) MapBlockData md;
for (int indx = 0; indx < mapBlocks.Count; ++indx)
{ {
md = mapBlocks[indx];
ut = md.SizeX; ut = md.SizeX;
sizes[count++] = ut; sizes[count++] = ut;
if (ut > 256) if (ut > 256)
@ -2065,8 +2069,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
count = 0; count = 0;
foreach (MapBlockData md in mapBlocks) for (int indx = 0; indx < mapBlocks.Count; ++indx)
{ {
md = mapBlocks[indx];
lastpos = pos; lastpos = pos;
Utils.UInt16ToBytes(md.X, data, pos); pos += 2; Utils.UInt16ToBytes(md.X, data, pos); pos += 2;
@ -2633,9 +2638,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
} }
List<InventoryFolderBase> subFolders = contents.Folders; List<InventoryFolderBase> subFolders = contents.Folders;
foreach (InventoryFolderBase subFolder in subFolders) for (int indx = 0; indx < subFolders.Count; ++indx)
{ {
SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId); SendBulkUpdateInventoryFolderRecursive(subFolders[indx], ref folderDataBlocks, transactionId);
} }
} }
@ -4043,8 +4048,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
else else
{ {
LLSDxmlEncode.AddArray("GroupData", sb); LLSDxmlEncode.AddArray("GroupData", sb);
foreach (GroupMembershipData m in data) GroupMembershipData m;
for (int indx = 0; indx < data.Length; ++indx)
{ {
m = data[indx];
LLSDxmlEncode.AddMap(sb); LLSDxmlEncode.AddMap(sb);
LLSDxmlEncode.AddElem("GroupPowers", m.GroupPowers, sb); LLSDxmlEncode.AddElem("GroupPowers", m.GroupPowers, sb);
LLSDxmlEncode.AddElem("GroupTitle", m.GroupTitle, sb); LLSDxmlEncode.AddElem("GroupTitle", m.GroupTitle, sb);
@ -4075,7 +4082,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// use UDP if no caps // use UDP if no caps
AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket();
AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[data.Length]; AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[data.Length];
for (int i = 0; i < data.Length; i++) for (int i = 0; i < data.Length; ++i)
{ {
AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock();
Group.AcceptNotices = data[i].AcceptNotices; Group.AcceptNotices = data[i].AcceptNotices;
@ -4506,30 +4513,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP
{ {
List<int> withobjects = new List<int>(animations.Length); List<int> withobjects = new List<int>(animations.Length);
List<int> noobjects = new List<int>(animations.Length); List<int> noobjects = new List<int>(animations.Length);
for (int i = 0; i < animations.Length; ++i) for (int indx = 0; indx < animations.Length; ++indx)
{ {
if (objectIDs[i] == sourceAgentId || objectIDs[i] == UUID.Zero) if (objectIDs[indx] == sourceAgentId || objectIDs[indx] == UUID.Zero)
noobjects.Add(i); noobjects.Add(indx);
else else
withobjects.Add(i); withobjects.Add(indx);
} }
int i;
// first the ones with corresponding objects // first the ones with corresponding objects
foreach (int i in withobjects) for (int indx = 0; indx < withobjects.Count; ++indx)
{ {
i = withobjects[indx];
animations[i].ToBytes(data, pos); pos += 16; animations[i].ToBytes(data, pos); pos += 16;
Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4;
} }
// then the rest // then the rest
foreach (int i in noobjects) for (int indx = 0; indx < noobjects.Count; ++indx)
{ {
i = noobjects[indx];
animations[i].ToBytes(data, pos); pos += 16; animations[i].ToBytes(data, pos); pos += 16;
Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4;
} }
// object ids block // object ids block
data[pos++] = (byte)withobjects.Count; data[pos++] = (byte)withobjects.Count;
foreach (int i in withobjects) for (int indx = 0; indx < withobjects.Count; ++indx)
{ {
i = withobjects[indx];
objectIDs[i].ToBytes(data, pos); pos += 16; objectIDs[i].ToBytes(data, pos); pos += 16;
} }
} }
@ -4931,9 +4942,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP
// doesn't seem to be attached, skip // doesn't seem to be attached, skip
List<SceneObjectGroup> atts = sp.GetAttachments(); List<SceneObjectGroup> atts = sp.GetAttachments();
bool found = false; bool found = false;
foreach (SceneObjectGroup att in atts) for (int indx = 0; indx < atts.Count; ++indx)
{ {
if (att == grp) if (atts[indx] == grp)
{ {
found = true; found = true;
break; break;
@ -5141,8 +5152,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int lastzc = 0; int lastzc = 0;
int count = 0; int count = 0;
foreach (EntityUpdate eu in objectUpdates) EntityUpdate eu;
for(int indx = 0; indx < objectUpdates.Count;++indx)
{ {
eu = objectUpdates[indx];
lastpos = zc.Position; lastpos = zc.Position;
lastzc = zc.ZeroCount; lastzc = zc.ZeroCount;
if (eu.Entity is ScenePresence) if (eu.Entity is ScenePresence)
@ -5301,8 +5314,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int lastzc = 0; int lastzc = 0;
int count = 0; int count = 0;
foreach (EntityUpdate eu in compressedUpdates) EntityUpdate eu;
for (int indx = 0; indx < compressedUpdates.Count; ++indx)
{ {
eu = compressedUpdates[indx];
SceneObjectPart sop = (SceneObjectPart)eu.Entity; SceneObjectPart sop = (SceneObjectPart)eu.Entity;
if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted)
continue; continue;
@ -5386,8 +5401,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int pos = 18; int pos = 18;
int count = 0; int count = 0;
foreach (EntityUpdate eu in objectUpdateProbes) EntityUpdate eu;
for (int indx = 0; indx < objectUpdateProbes.Count; ++indx)
{ {
eu = objectUpdateProbes[indx];
SceneObjectPart sop = (SceneObjectPart)eu.Entity; SceneObjectPart sop = (SceneObjectPart)eu.Entity;
if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted)
continue; continue;
@ -5448,8 +5465,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
int lastpos = 0; int lastpos = 0;
int count = 0; int count = 0;
foreach (EntityUpdate eu in terseUpdates) EntityUpdate eu;
for (int indx = 0; indx < terseUpdates.Count; ++indx)
{ {
eu = terseUpdates[indx];
lastpos = pos; lastpos = pos;
CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, (eu.Flags & PrimUpdateFlags.Textures) != 0); CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, (eu.Flags & PrimUpdateFlags.Textures) != 0);
if (pos < LLUDPServer.MAXPAYLOAD) if (pos < LLUDPServer.MAXPAYLOAD)
@ -5497,8 +5516,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (ObjectAnimationUpdates != null) if (ObjectAnimationUpdates != null)
{ {
foreach (SceneObjectPart sop in ObjectAnimationUpdates) SceneObjectPart sop;
for (int indx = 0; indx < ObjectAnimationUpdates.Count; ++indx)
{ {
sop = ObjectAnimationUpdates[indx];
if (sop.Animations == null) if (sop.Animations == null)
continue; continue;