aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra')
-rw-r--r--linden/indra/llinventory/llinventory.cpp110
-rw-r--r--linden/indra/llinventory/llinventory.h5
2 files changed, 115 insertions, 0 deletions
diff --git a/linden/indra/llinventory/llinventory.cpp b/linden/indra/llinventory/llinventory.cpp
index 72eab74..38cb37d 100644
--- a/linden/indra/llinventory/llinventory.cpp
+++ b/linden/indra/llinventory/llinventory.cpp
@@ -70,6 +70,116 @@ const U8 TASK_INVENTORY_ASSET_KEY = 1;
70const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730"); 70const LLUUID MAGIC_ID("3c115e51-04f4-523c-9fa6-98aff1034730");
71 71
72 72
73/**
74 * @brief Return the equivalent new inventory type.
75 *
76 * Takes an inventory type, asset type, and inventory flags,
77 * and returns the equivalent LLInventory::NType.
78 *
79 * For example, an inventory type of IT_WEARABLE, asset type
80 * of AT_BODYPART, and flags indicated WT_SHAPE, would be
81 * converted to NIT_SHAPE.
82 *
83 * Returns the most specific type that can be determined,
84 * or NIT_NONE if no type could be determined.
85 *
86 */
87LLInventoryType::NType calc_ntype(
88 LLInventoryType::EType inv_type,
89 LLAssetType::EType asset_type,
90 U32 flags )
91{
92 switch( inv_type )
93 {
94
95 // WEARABLES
96 case LLInventoryType::IT_WEARABLE:
97 {
98 switch( asset_type )
99 {
100 // BODY PARTS
101 case LLAssetType::AT_BODYPART:
102 {
103 switch( flags & LLInventoryItem::II_FLAGS_WEARABLES_MASK )
104 {
105 case WT_SHAPE: return LLInventoryType::NIT_SHAPE;
106 case WT_SKIN: return LLInventoryType::NIT_SKIN;
107 case WT_HAIR: return LLInventoryType::NIT_HAIR;
108 case WT_EYES: return LLInventoryType::NIT_EYES;
109 default: return LLInventoryType::NIT_BODYPART;
110 }
111 }
112
113 // CLOTHING
114 case LLAssetType::AT_CLOTHING:
115 {
116 switch( flags & LLInventoryItem::II_FLAGS_WEARABLES_MASK )
117 {
118 case WT_SHIRT: return LLInventoryType::NIT_SHIRT;
119 case WT_PANTS: return LLInventoryType::NIT_PANTS;
120 case WT_SHOES: return LLInventoryType::NIT_SHOES;
121 case WT_SOCKS: return LLInventoryType::NIT_SOCKS;
122 case WT_JACKET: return LLInventoryType::NIT_JACKET;
123 case WT_GLOVES: return LLInventoryType::NIT_GLOVES;
124 case WT_UNDERSHIRT: return LLInventoryType::NIT_UNDERSHIRT;
125 case WT_UNDERPANTS: return LLInventoryType::NIT_UNDERPANTS;
126 case WT_SKIRT: return LLInventoryType::NIT_SKIRT;
127 default: return LLInventoryType::NIT_CLOTHING;
128 }
129 }
130 default:
131 return LLInventoryType::NIT_WEARABLE;
132 }
133 }
134
135 // TEXTURES
136 case LLInventoryType::IT_TEXTURE:
137 return LLInventoryType::NIT_TEXTURE;
138
139 // SNAPSHOTS
140 case LLInventoryType::IT_SNAPSHOT:
141 return LLInventoryType::NIT_SNAPSHOT;
142
143 // CALLING CARDS
144 case LLInventoryType::IT_CALLINGCARD:
145 return LLInventoryType::NIT_CALLCARD;
146
147 // LANDMARKS
148 case LLInventoryType::IT_LANDMARK:
149 return LLInventoryType::NIT_LANDMARK;
150
151 // SOUNDS
152 case LLInventoryType::IT_SOUND:
153 return LLInventoryType::NIT_SOUND;
154
155 // ANIMATIONS
156 case LLInventoryType::IT_ANIMATION:
157 return LLInventoryType::NIT_ANIMATION;
158
159 // GESTURES
160 case LLInventoryType::IT_GESTURE:
161 return LLInventoryType::NIT_GESTURE;
162
163 // NOTECARDS
164 case LLInventoryType::IT_NOTECARD:
165 return LLInventoryType::NIT_NOTECARD;
166
167 // SCRIPTS
168 case LLInventoryType::IT_LSL:
169 return LLInventoryType::NIT_SCRIPT_LSL2;
170
171 // OBJECTS
172 case LLInventoryType::IT_OBJECT:
173 case LLInventoryType::IT_ATTACHMENT:
174 return LLInventoryType::NIT_OBJECT;
175
176 // UNKNOWN TYPE!
177 default:
178 return LLInventoryType::NIT_NONE;
179 }
180}
181
182
73///---------------------------------------------------------------------------- 183///----------------------------------------------------------------------------
74/// Class LLInventoryObject 184/// Class LLInventoryObject
75///---------------------------------------------------------------------------- 185///----------------------------------------------------------------------------
diff --git a/linden/indra/llinventory/llinventory.h b/linden/indra/llinventory/llinventory.h
index ac4e470..247e646 100644
--- a/linden/indra/llinventory/llinventory.h
+++ b/linden/indra/llinventory/llinventory.h
@@ -42,6 +42,7 @@
42#include "llsaleinfo.h" 42#include "llsaleinfo.h"
43#include "llsd.h" 43#include "llsd.h"
44#include "lluuid.h" 44#include "lluuid.h"
45#include "llwearabletype.h"
45#include "llxmlnode.h" 46#include "llxmlnode.h"
46 47
47// consts for Key field in the task inventory update message 48// consts for Key field in the task inventory update message
@@ -56,6 +57,10 @@ enum
56}; 57};
57 58
58 59
60LLInventoryType::NType calc_ntype( LLInventoryType::EType inv_type,
61 LLAssetType::EType asset_type,
62 U32 flags );
63
59 64
60//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 65//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
61// Class LLInventoryObject 66// Class LLInventoryObject