* Clamp the CoarseLocationUpdate packet at a maximum of 60 positions per packet. This is a limitation of LLUDP, nothing we can really do about it

* Marking CoarseLocationUpdate as *not* zerocoded. Zerocoding can only save space when a packet contains three or more contiguous zeroes, and will use more space if it contains single zeroes randomly scattered through the packet (which is what you see when you send a long list of UUIDs)
0.6.8-post-fixes
John Hurliman 2009-11-05 23:50:17 -08:00
parent afef1ac191
commit 6ed57814c1
1 changed files with 11 additions and 7 deletions

View File

@ -3196,12 +3196,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
if (!IsActive) return; // We don't need to update inactive clients. if (!IsActive) return; // We don't need to update inactive clients.
CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate);
// TODO: don't create new blocks if recycling an old packet loc.Header.Reliable = false;
int total = CoarseLocations.Count;
CoarseLocationUpdatePacket.IndexBlock ib = // Each packet can only hold around 62 avatar positions and the client clears the mini-map each time
new CoarseLocationUpdatePacket.IndexBlock(); // a CoarseLocationUpdate packet is received. Oh well.
int total = Math.Min(CoarseLocations.Count, 60);
CoarseLocationUpdatePacket.IndexBlock ib = new CoarseLocationUpdatePacket.IndexBlock();
loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total];
loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total];
int selfindex = -1; int selfindex = -1;
for (int i = 0; i < total; i++) for (int i = 0; i < total; i++)
{ {
@ -3211,18 +3216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP
lb.X = (byte)CoarseLocations[i].X; lb.X = (byte)CoarseLocations[i].X;
lb.Y = (byte)CoarseLocations[i].Y; lb.Y = (byte)CoarseLocations[i].Y;
lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25); lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25f);
loc.Location[i] = lb; loc.Location[i] = lb;
loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock();
loc.AgentData[i].AgentID = users[i]; loc.AgentData[i].AgentID = users[i];
if (users[i] == AgentId) if (users[i] == AgentId)
selfindex = i; selfindex = i;
} }
ib.You = (short)selfindex; ib.You = (short)selfindex;
ib.Prey = -1; ib.Prey = -1;
loc.Index = ib; loc.Index = ib;
loc.Header.Reliable = false;
loc.Header.Zerocoded = true;
OutPacket(loc, ThrottleOutPacketType.Task); OutPacket(loc, ThrottleOutPacketType.Task);
} }