From 818ed2032aa4e6c0a9ede3598d64f0c7960135c4 Mon Sep 17 00:00:00 2001
From: Melanie
Date: Sat, 30 Oct 2010 00:41:36 +0100
Subject: READ CAREFULLY!!! This is a BROKEN commit. It is UNTESTED and
 INCOMPLETE. It contains a major interface version bump and will NOT work with
 earlier grid services. This is preliminary work that will lead to layers
 support. Rest appearance services are commented out completely, they will
 have to be adapted by someone who actually uses them. Remote admin is
 working, but has no layers support. There is no layers support in the
 database. Login likely won't work. You have been warned.

---
 .../Region/ClientStack/LindenUDP/LLClientView.cs    | 21 +++++++++++++++------
 .../Avatar/AvatarFactory/AvatarFactoryModule.cs     | 15 +++++----------
 2 files changed, 20 insertions(+), 16 deletions(-)

(limited to 'OpenSim/Region')

diff --git a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
index 14f923d..d7458b7 100644
--- a/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
+++ b/OpenSim/Region/ClientStack/LindenUDP/LLClientView.cs
@@ -3387,20 +3387,29 @@ namespace OpenSim.Region.ClientStack.LindenUDP
             aw.AgentData.SerialNum = (uint)serial;
             aw.AgentData.SessionID = m_sessionId;
 
+            int count = 0;
+            for (int i = 0; i < wearables.Length; i++)
+                count += wearables[i].Count;
+
             // TODO: don't create new blocks if recycling an old packet
-            aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[13];
+            aw.WearableData = new AgentWearablesUpdatePacket.WearableDataBlock[count];
             AgentWearablesUpdatePacket.WearableDataBlock awb;
+            int idx = 0;
             for (int i = 0; i < wearables.Length; i++)
             {
-                awb = new AgentWearablesUpdatePacket.WearableDataBlock();
-                awb.WearableType = (byte)i;
-                awb.AssetID = wearables[i].AssetID;
-                awb.ItemID = wearables[i].ItemID;
-                aw.WearableData[i] = awb;
+                for (int j = 0; j < wearables[i].Count; j++)
+                {
+                    awb = new AgentWearablesUpdatePacket.WearableDataBlock();
+                    awb.WearableType = (byte)i;
+                    awb.AssetID = wearables[i][j].AssetID;
+                    awb.ItemID = wearables[i][j].ItemID;
+                    aw.WearableData[idx] = awb;
+                    idx++;
 
 //                                m_log.DebugFormat(
 //                                    "[APPEARANCE]: Sending wearable item/asset {0} {1} (index {2}) for {3}",
 //                                    awb.ItemID, awb.AssetID, i, Name);
+                }
             }
 
             OutPacket(aw, ThrottleOutPacketType.Task);
diff --git a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
index bfbbcf8..4d27ea4 100644
--- a/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
+++ b/OpenSim/Region/CoreModules/Avatar/AvatarFactory/AvatarFactoryModule.cs
@@ -393,27 +393,22 @@ namespace OpenSim.Region.CoreModules.Avatar.AvatarFactory
             {
                 for (int i = 0; i < AvatarWearable.MAX_WEARABLES; i++)
                 {
-                    if (appearance.Wearables[i].ItemID == UUID.Zero)
+                    for (int j = 0 ; j < appearance.Wearables[j].Count ; j ++ )
                     {
-                        appearance.Wearables[i].AssetID = UUID.Zero;
-                    }
-                    else
-                    {
-                        InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i].ItemID, userID);
+                        InventoryItemBase baseItem = new InventoryItemBase(appearance.Wearables[i][j].ItemID, userID);
                         baseItem = invService.GetItem(baseItem);
 
                         if (baseItem != null)
                         {
-                            appearance.Wearables[i].AssetID = baseItem.AssetID;
+                            appearance.Wearables[i].Add(appearance.Wearables[i][j].ItemID, baseItem.AssetID);
                         }
                         else
                         {
                             m_log.ErrorFormat(
                                 "[AVFACTORY]: Can't find inventory item {0} for {1}, setting to default", 
-                                appearance.Wearables[i].ItemID, (WearableType)i);
+                                appearance.Wearables[i][j].ItemID, (WearableType)i);
                             
-                            appearance.Wearables[i].ItemID = UUID.Zero;
-                            appearance.Wearables[i].AssetID = UUID.Zero;
+                            appearance.Wearables[i].RemoveItem(appearance.Wearables[i][j].ItemID);
                         }
                     }
                 }
-- 
cgit v1.1