diff options
-rw-r--r-- | OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs index 101a44b..35ccad9 100644 --- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs +++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs | |||
@@ -3196,12 +3196,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3196 | if (!IsActive) return; // We don't need to update inactive clients. | 3196 | if (!IsActive) return; // We don't need to update inactive clients. |
3197 | 3197 | ||
3198 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); | 3198 | CoarseLocationUpdatePacket loc = (CoarseLocationUpdatePacket)PacketPool.Instance.GetPacket(PacketType.CoarseLocationUpdate); |
3199 | // TODO: don't create new blocks if recycling an old packet | 3199 | loc.Header.Reliable = false; |
3200 | int total = CoarseLocations.Count; | 3200 | |
3201 | CoarseLocationUpdatePacket.IndexBlock ib = | 3201 | // Each packet can only hold around 62 avatar positions and the client clears the mini-map each time |
3202 | new CoarseLocationUpdatePacket.IndexBlock(); | 3202 | // a CoarseLocationUpdate packet is received. Oh well. |
3203 | int total = Math.Min(CoarseLocations.Count, 60); | ||
3204 | |||
3205 | CoarseLocationUpdatePacket.IndexBlock ib = new CoarseLocationUpdatePacket.IndexBlock(); | ||
3206 | |||
3203 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; | 3207 | loc.Location = new CoarseLocationUpdatePacket.LocationBlock[total]; |
3204 | loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; | 3208 | loc.AgentData = new CoarseLocationUpdatePacket.AgentDataBlock[total]; |
3209 | |||
3205 | int selfindex = -1; | 3210 | int selfindex = -1; |
3206 | for (int i = 0; i < total; i++) | 3211 | for (int i = 0; i < total; i++) |
3207 | { | 3212 | { |
@@ -3211,18 +3216,17 @@ namespace OpenSim.Region.ClientStack.LindenUDP | |||
3211 | lb.X = (byte)CoarseLocations[i].X; | 3216 | lb.X = (byte)CoarseLocations[i].X; |
3212 | lb.Y = (byte)CoarseLocations[i].Y; | 3217 | lb.Y = (byte)CoarseLocations[i].Y; |
3213 | 3218 | ||
3214 | lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25); | 3219 | lb.Z = CoarseLocations[i].Z > 1024 ? (byte)0 : (byte)(CoarseLocations[i].Z * 0.25f); |
3215 | loc.Location[i] = lb; | 3220 | loc.Location[i] = lb; |
3216 | loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); | 3221 | loc.AgentData[i] = new CoarseLocationUpdatePacket.AgentDataBlock(); |
3217 | loc.AgentData[i].AgentID = users[i]; | 3222 | loc.AgentData[i].AgentID = users[i]; |
3218 | if (users[i] == AgentId) | 3223 | if (users[i] == AgentId) |
3219 | selfindex = i; | 3224 | selfindex = i; |
3220 | } | 3225 | } |
3226 | |||
3221 | ib.You = (short)selfindex; | 3227 | ib.You = (short)selfindex; |
3222 | ib.Prey = -1; | 3228 | ib.Prey = -1; |
3223 | loc.Index = ib; | 3229 | loc.Index = ib; |
3224 | loc.Header.Reliable = false; | ||
3225 | loc.Header.Zerocoded = true; | ||
3226 | 3230 | ||
3227 | OutPacket(loc, ThrottleOutPacketType.Task); | 3231 | OutPacket(loc, ThrottleOutPacketType.Task); |
3228 | } | 3232 | } |