DayZ 1.30
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено

◆ ProcessCargo()

map< ECachedEquipmentItemCategory, ref array< ref CachedEquipmentItemAttribute > > CachedEquipmentStorage::ProcessCargo ( CachedEquipmentStorageInventoryEntry params)
inlineprivate

Processes cargo of item given through params.

Аргументы
paramsinventory item setting defined by CachedEquipmentStorageInventoryEntry
Возвращает
map containing ECachedEquipmentItemCategory and array of CachedEquipmentItemAttribute for further processing (cache insert/removal)

См. определение в файле CachedEquipmentStorage.c строка 225

226 {
227 CachedItemAttributesPerCategory cargoAttributesPerCategory = new CachedItemAttributesPerCategory();
228 if (params.m_GameInventory.GetCargo())
229 {
230 int cargoCount = params.m_GameInventory.GetCargo().GetItemCount();
231 for (int cargoIndex = 0; cargoIndex < cargoCount; ++cargoIndex)
232 {
233 EntityAI cargo = params.m_GameInventory.GetCargo().GetItem(cargoIndex);
234 ECachedEquipmentItemCategory category = cargo.GetCachedEquipmentCategory();
235 if (category == ECachedEquipmentItemCategory.NONE)
236 continue;
237
238 if (params.m_OperationMode == ECachedEquipmentOperationMode.INSERT && IsStored(cargo, category))
239 continue;
240
241 InventoryLocation parentInventoryLocation = new InventoryLocation();
242 params.m_GameInventory.GetCurrentInventoryLocation(parentInventoryLocation);
243
244 CachedEquipmentItemAttribute newItemAttributes = new CachedEquipmentItemAttribute();
245
246 newItemAttributes.m_Entity = cargo;
247 newItemAttributes.m_Parent = cargo.GetHierarchyParent();
248 newItemAttributes.m_ParentInventoryPlacement = parentInventoryLocation.GetSlot();
249 newItemAttributes.m_InventoryDepth = cargo.GetHierarchyLevel();
250 newItemAttributes.m_InventoryPlacement = ECachedEquipmentPlacement.CARGO;
251
252
253 array<ref CachedEquipmentItemAttribute> arr;
254 if (!cargoAttributesPerCategory.Find(category, arr))
255 {
256 arr = new array<ref CachedEquipmentItemAttribute>();
257 cargoAttributesPerCategory.Set(category, arr);
258 }
259
260 #ifdef ENABLE_LOGGING
261 LogMessage(string.Format("parent:%1 entity:%2", newItemAttributes.m_Parent, cargo), string.Format("%1:ProcessCargo", params.m_CallerMethod));
262 #endif
263
264 arr.Insert(newItemAttributes);
265 }
266 }
267
268 return cargoAttributesPerCategory;
269 }
class LogManager EntityAI
map CachedItemAttributesPerCategory
ECachedEquipmentItemCategory
Определения ECachedEquipmentItemCategory.c:2
ECachedEquipmentOperationMode
Определения ECachedEquipmentOperationMode.c:2
ECachedEquipmentPlacement
Определения ECachedEquipmentPlacement.c:2
bool IsStored(Entity entity, ECachedEquipmentItemCategory category)
Определения CachedEquipmentStorageBase.c:129
proto native int GetSlot()
returns slot id if current type is Attachment

Перекрестные ссылки InventoryLocation::GetSlot() и CachedEquipmentStorageBase::IsStored().

Используется в ProcessItemInventory().