From 4b5a3308ad34e16ef254dd26acbb46fc79373370 Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Fri, 8 Nov 2019 17:43:22 +0000 Subject: [PATCH] cosmetics --- .../ClientStack/Linden/UDP/LLClientView.cs | 67 ++++++++++++------- 1 file changed, 44 insertions(+), 23 deletions(-) diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 80ca67bce0..4b6b6ac526 100755 --- a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs @@ -1254,9 +1254,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP ++pos; 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; if (pos + len >= LLUDPServer.MAXPAYLOAD) @@ -1325,9 +1325,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP int countpos = pos; ++pos; + byte[] val; int count = 0; - foreach (byte[] val in message) + for (int indx = 0; indx < message.Count; ++indx) { + val = message[indx]; len = val.Length; if(len > 255) len = 255; @@ -2036,8 +2038,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP // check if we will need sizes block and get them aside int count = 0; ushort ut; - foreach (MapBlockData md in mapBlocks) + MapBlockData md; + for (int indx = 0; indx < mapBlocks.Count; ++indx) { + md = mapBlocks[indx]; ut = md.SizeX; sizes[count++] = ut; if (ut > 256) @@ -2065,8 +2069,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP count = 0; - foreach (MapBlockData md in mapBlocks) + for (int indx = 0; indx < mapBlocks.Count; ++indx) { + md = mapBlocks[indx]; lastpos = pos; Utils.UInt16ToBytes(md.X, data, pos); pos += 2; @@ -2633,9 +2638,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP } List 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 { 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.AddElem("GroupPowers", m.GroupPowers, sb); LLSDxmlEncode.AddElem("GroupTitle", m.GroupTitle, sb); @@ -4075,7 +4082,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP // use UDP if no caps AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); 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(); Group.AcceptNotices = data[i].AcceptNotices; @@ -4506,30 +4513,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP { List withobjects = new List(animations.Length); List noobjects = new List(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) - noobjects.Add(i); + if (objectIDs[indx] == sourceAgentId || objectIDs[indx] == UUID.Zero) + noobjects.Add(indx); else - withobjects.Add(i); + withobjects.Add(indx); } + int i; // 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; Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; } // 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; Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; } // object ids block 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; } } @@ -4931,9 +4942,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP // doesn't seem to be attached, skip List atts = sp.GetAttachments(); 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; break; @@ -5141,8 +5152,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP int lastzc = 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; lastzc = zc.ZeroCount; if (eu.Entity is ScenePresence) @@ -5301,8 +5314,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP int lastzc = 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; if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) continue; @@ -5386,8 +5401,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP int pos = 18; 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; if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) continue; @@ -5448,8 +5465,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP int lastpos = 0; int count = 0; - foreach (EntityUpdate eu in terseUpdates) + EntityUpdate eu; + for (int indx = 0; indx < terseUpdates.Count; ++indx) { + eu = terseUpdates[indx]; lastpos = pos; CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, (eu.Flags & PrimUpdateFlags.Textures) != 0); if (pos < LLUDPServer.MAXPAYLOAD) @@ -5497,8 +5516,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP 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) continue;