diff options
Diffstat (limited to 'OpenSim/Region/ClientStack/Linden')
-rwxr-xr-x | OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs | 67 |
1 files changed, 44 insertions, 23 deletions
diff --git a/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs b/OpenSim/Region/ClientStack/Linden/UDP/LLClientView.cs index 80ca67b..4b6b6ac 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 | |||
1254 | ++pos; | 1254 | ++pos; |
1255 | 1255 | ||
1256 | int count = 0; | 1256 | int count = 0; |
1257 | foreach (string val in message) | 1257 | for(int indx = 0; indx < message.Count; ++indx) |
1258 | { | 1258 | { |
1259 | tmp = Util.StringToBytes256(val); | 1259 | tmp = Util.StringToBytes256(message[indx]); |
1260 | len = tmp.Length; | 1260 | len = tmp.Length; |
1261 | 1261 | ||
1262 | if (pos + len >= LLUDPServer.MAXPAYLOAD) | 1262 | if (pos + len >= LLUDPServer.MAXPAYLOAD) |
@@ -1325,9 +1325,11 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
1325 | int countpos = pos; | 1325 | int countpos = pos; |
1326 | ++pos; | 1326 | ++pos; |
1327 | 1327 | ||
1328 | byte[] val; | ||
1328 | int count = 0; | 1329 | int count = 0; |
1329 | foreach (byte[] val in message) | 1330 | for (int indx = 0; indx < message.Count; ++indx) |
1330 | { | 1331 | { |
1332 | val = message[indx]; | ||
1331 | len = val.Length; | 1333 | len = val.Length; |
1332 | if(len > 255) | 1334 | if(len > 255) |
1333 | len = 255; | 1335 | len = 255; |
@@ -2036,8 +2038,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2036 | // check if we will need sizes block and get them aside | 2038 | // check if we will need sizes block and get them aside |
2037 | int count = 0; | 2039 | int count = 0; |
2038 | ushort ut; | 2040 | ushort ut; |
2039 | foreach (MapBlockData md in mapBlocks) | 2041 | MapBlockData md; |
2042 | for (int indx = 0; indx < mapBlocks.Count; ++indx) | ||
2040 | { | 2043 | { |
2044 | md = mapBlocks[indx]; | ||
2041 | ut = md.SizeX; | 2045 | ut = md.SizeX; |
2042 | sizes[count++] = ut; | 2046 | sizes[count++] = ut; |
2043 | if (ut > 256) | 2047 | if (ut > 256) |
@@ -2065,8 +2069,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2065 | 2069 | ||
2066 | count = 0; | 2070 | count = 0; |
2067 | 2071 | ||
2068 | foreach (MapBlockData md in mapBlocks) | 2072 | for (int indx = 0; indx < mapBlocks.Count; ++indx) |
2069 | { | 2073 | { |
2074 | md = mapBlocks[indx]; | ||
2070 | lastpos = pos; | 2075 | lastpos = pos; |
2071 | 2076 | ||
2072 | Utils.UInt16ToBytes(md.X, data, pos); pos += 2; | 2077 | Utils.UInt16ToBytes(md.X, data, pos); pos += 2; |
@@ -2633,9 +2638,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
2633 | } | 2638 | } |
2634 | 2639 | ||
2635 | List<InventoryFolderBase> subFolders = contents.Folders; | 2640 | List<InventoryFolderBase> subFolders = contents.Folders; |
2636 | foreach (InventoryFolderBase subFolder in subFolders) | 2641 | for (int indx = 0; indx < subFolders.Count; ++indx) |
2637 | { | 2642 | { |
2638 | SendBulkUpdateInventoryFolderRecursive(subFolder, ref folderDataBlocks, transactionId); | 2643 | SendBulkUpdateInventoryFolderRecursive(subFolders[indx], ref folderDataBlocks, transactionId); |
2639 | } | 2644 | } |
2640 | } | 2645 | } |
2641 | 2646 | ||
@@ -4043,8 +4048,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4043 | else | 4048 | else |
4044 | { | 4049 | { |
4045 | LLSDxmlEncode.AddArray("GroupData", sb); | 4050 | LLSDxmlEncode.AddArray("GroupData", sb); |
4046 | foreach (GroupMembershipData m in data) | 4051 | GroupMembershipData m; |
4052 | for (int indx = 0; indx < data.Length; ++indx) | ||
4047 | { | 4053 | { |
4054 | m = data[indx]; | ||
4048 | LLSDxmlEncode.AddMap(sb); | 4055 | LLSDxmlEncode.AddMap(sb); |
4049 | LLSDxmlEncode.AddElem("GroupPowers", m.GroupPowers, sb); | 4056 | LLSDxmlEncode.AddElem("GroupPowers", m.GroupPowers, sb); |
4050 | LLSDxmlEncode.AddElem("GroupTitle", m.GroupTitle, sb); | 4057 | LLSDxmlEncode.AddElem("GroupTitle", m.GroupTitle, sb); |
@@ -4075,7 +4082,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4075 | // use UDP if no caps | 4082 | // use UDP if no caps |
4076 | AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); | 4083 | AgentGroupDataUpdatePacket Groupupdate = new AgentGroupDataUpdatePacket(); |
4077 | AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[data.Length]; | 4084 | AgentGroupDataUpdatePacket.GroupDataBlock[] Groups = new AgentGroupDataUpdatePacket.GroupDataBlock[data.Length]; |
4078 | for (int i = 0; i < data.Length; i++) | 4085 | for (int i = 0; i < data.Length; ++i) |
4079 | { | 4086 | { |
4080 | AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); | 4087 | AgentGroupDataUpdatePacket.GroupDataBlock Group = new AgentGroupDataUpdatePacket.GroupDataBlock(); |
4081 | Group.AcceptNotices = data[i].AcceptNotices; | 4088 | Group.AcceptNotices = data[i].AcceptNotices; |
@@ -4506,30 +4513,34 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4506 | { | 4513 | { |
4507 | List<int> withobjects = new List<int>(animations.Length); | 4514 | List<int> withobjects = new List<int>(animations.Length); |
4508 | List<int> noobjects = new List<int>(animations.Length); | 4515 | List<int> noobjects = new List<int>(animations.Length); |
4509 | for (int i = 0; i < animations.Length; ++i) | 4516 | for (int indx = 0; indx < animations.Length; ++indx) |
4510 | { | 4517 | { |
4511 | if (objectIDs[i] == sourceAgentId || objectIDs[i] == UUID.Zero) | 4518 | if (objectIDs[indx] == sourceAgentId || objectIDs[indx] == UUID.Zero) |
4512 | noobjects.Add(i); | 4519 | noobjects.Add(indx); |
4513 | else | 4520 | else |
4514 | withobjects.Add(i); | 4521 | withobjects.Add(indx); |
4515 | } | 4522 | } |
4516 | 4523 | ||
4524 | int i; | ||
4517 | // first the ones with corresponding objects | 4525 | // first the ones with corresponding objects |
4518 | foreach (int i in withobjects) | 4526 | for (int indx = 0; indx < withobjects.Count; ++indx) |
4519 | { | 4527 | { |
4528 | i = withobjects[indx]; | ||
4520 | animations[i].ToBytes(data, pos); pos += 16; | 4529 | animations[i].ToBytes(data, pos); pos += 16; |
4521 | Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; | 4530 | Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; |
4522 | } | 4531 | } |
4523 | // then the rest | 4532 | // then the rest |
4524 | foreach (int i in noobjects) | 4533 | for (int indx = 0; indx < noobjects.Count; ++indx) |
4525 | { | 4534 | { |
4535 | i = noobjects[indx]; | ||
4526 | animations[i].ToBytes(data, pos); pos += 16; | 4536 | animations[i].ToBytes(data, pos); pos += 16; |
4527 | Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; | 4537 | Utils.IntToBytesSafepos(seqs[i], data, pos); pos += 4; |
4528 | } | 4538 | } |
4529 | // object ids block | 4539 | // object ids block |
4530 | data[pos++] = (byte)withobjects.Count; | 4540 | data[pos++] = (byte)withobjects.Count; |
4531 | foreach (int i in withobjects) | 4541 | for (int indx = 0; indx < withobjects.Count; ++indx) |
4532 | { | 4542 | { |
4543 | i = withobjects[indx]; | ||
4533 | objectIDs[i].ToBytes(data, pos); pos += 16; | 4544 | objectIDs[i].ToBytes(data, pos); pos += 16; |
4534 | } | 4545 | } |
4535 | } | 4546 | } |
@@ -4931,9 +4942,9 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
4931 | // doesn't seem to be attached, skip | 4942 | // doesn't seem to be attached, skip |
4932 | List<SceneObjectGroup> atts = sp.GetAttachments(); | 4943 | List<SceneObjectGroup> atts = sp.GetAttachments(); |
4933 | bool found = false; | 4944 | bool found = false; |
4934 | foreach (SceneObjectGroup att in atts) | 4945 | for (int indx = 0; indx < atts.Count; ++indx) |
4935 | { | 4946 | { |
4936 | if (att == grp) | 4947 | if (atts[indx] == grp) |
4937 | { | 4948 | { |
4938 | found = true; | 4949 | found = true; |
4939 | break; | 4950 | break; |
@@ -5141,8 +5152,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5141 | int lastzc = 0; | 5152 | int lastzc = 0; |
5142 | 5153 | ||
5143 | int count = 0; | 5154 | int count = 0; |
5144 | foreach (EntityUpdate eu in objectUpdates) | 5155 | EntityUpdate eu; |
5156 | for(int indx = 0; indx < objectUpdates.Count;++indx) | ||
5145 | { | 5157 | { |
5158 | eu = objectUpdates[indx]; | ||
5146 | lastpos = zc.Position; | 5159 | lastpos = zc.Position; |
5147 | lastzc = zc.ZeroCount; | 5160 | lastzc = zc.ZeroCount; |
5148 | if (eu.Entity is ScenePresence) | 5161 | if (eu.Entity is ScenePresence) |
@@ -5301,8 +5314,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5301 | int lastzc = 0; | 5314 | int lastzc = 0; |
5302 | 5315 | ||
5303 | int count = 0; | 5316 | int count = 0; |
5304 | foreach (EntityUpdate eu in compressedUpdates) | 5317 | EntityUpdate eu; |
5318 | for (int indx = 0; indx < compressedUpdates.Count; ++indx) | ||
5305 | { | 5319 | { |
5320 | eu = compressedUpdates[indx]; | ||
5306 | SceneObjectPart sop = (SceneObjectPart)eu.Entity; | 5321 | SceneObjectPart sop = (SceneObjectPart)eu.Entity; |
5307 | if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) | 5322 | if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) |
5308 | continue; | 5323 | continue; |
@@ -5386,8 +5401,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5386 | int pos = 18; | 5401 | int pos = 18; |
5387 | 5402 | ||
5388 | int count = 0; | 5403 | int count = 0; |
5389 | foreach (EntityUpdate eu in objectUpdateProbes) | 5404 | EntityUpdate eu; |
5405 | for (int indx = 0; indx < objectUpdateProbes.Count; ++indx) | ||
5390 | { | 5406 | { |
5407 | eu = objectUpdateProbes[indx]; | ||
5391 | SceneObjectPart sop = (SceneObjectPart)eu.Entity; | 5408 | SceneObjectPart sop = (SceneObjectPart)eu.Entity; |
5392 | if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) | 5409 | if (sop.ParentGroup == null || sop.ParentGroup.IsDeleted) |
5393 | continue; | 5410 | continue; |
@@ -5448,8 +5465,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5448 | int lastpos = 0; | 5465 | int lastpos = 0; |
5449 | 5466 | ||
5450 | int count = 0; | 5467 | int count = 0; |
5451 | foreach (EntityUpdate eu in terseUpdates) | 5468 | EntityUpdate eu; |
5469 | for (int indx = 0; indx < terseUpdates.Count; ++indx) | ||
5452 | { | 5470 | { |
5471 | eu = terseUpdates[indx]; | ||
5453 | lastpos = pos; | 5472 | lastpos = pos; |
5454 | CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, (eu.Flags & PrimUpdateFlags.Textures) != 0); | 5473 | CreateImprovedTerseBlock(eu.Entity, buf.Data, ref pos, (eu.Flags & PrimUpdateFlags.Textures) != 0); |
5455 | if (pos < LLUDPServer.MAXPAYLOAD) | 5474 | if (pos < LLUDPServer.MAXPAYLOAD) |
@@ -5497,8 +5516,10 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
5497 | 5516 | ||
5498 | if (ObjectAnimationUpdates != null) | 5517 | if (ObjectAnimationUpdates != null) |
5499 | { | 5518 | { |
5500 | foreach (SceneObjectPart sop in ObjectAnimationUpdates) | 5519 | SceneObjectPart sop; |
5520 | for (int indx = 0; indx < ObjectAnimationUpdates.Count; ++indx) | ||
5501 | { | 5521 | { |
5522 | sop = ObjectAnimationUpdates[indx]; | ||
5502 | if (sop.Animations == null) | 5523 | if (sop.Animations == null) |
5503 | continue; | 5524 | continue; |
5504 | 5525 | ||