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

◆ RecomputeContainers()

void ClosableContainer::RecomputeContainers ( )
inlineprotected

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

43 {
44 int currentIndex = -1;
45 map<int, int> bodyAttachmentSortIndex = new map<int, int>;
46
47 m_Body.Clear();
48
49 if(m_Atts)
50 {
51 currentIndex = m_Body.Insert(m_Atts.GetWrapper());
52 }
53
54 if(m_CargoGrid)
55 {
56 currentIndex = m_Body.Insert(m_CargoGrid);
57 }
58
59 GameInventory inv = m_Entity.GetInventory();
60 for (int i = 0; i < inv.AttachmentCount(); i++)
61 {
62 int slotIndex = -1;
63 int sortIndex = -1;
65 if(ent)
66 {
67 AttachmentsWrapper att = m_AttachmentAttachmentsContainers.Get(ent);
68 if(att)
69 {
70 if(m_Atts && m_Atts.GetSlotsSorted().Count())
71 {
72 sortIndex = m_Atts.GetSlotsSorted().Find(att.m_Attachments.GetAttachmentSlotID());
73 }
74
75 if(bodyAttachmentSortIndex.Find(currentIndex, slotIndex))
76 {
77 if(slotIndex > sortIndex)
78 {
79 m_Body.InsertAt(att, currentIndex);
80 bodyAttachmentSortIndex.Set(currentIndex, sortIndex);
81 }
82 else
83 {
84 currentIndex = m_Body.Insert(att);
85 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
86 }
87 }
88 else
89 {
90 currentIndex = m_Body.Insert(att);
91 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
92 }
93 }
94
95 CargoContainer cargo = m_AttachmentCargos.Get(ent);
96 if(cargo)
97 {
98 if(m_Atts && m_Atts.GetSlotsSorted().Count())
99 {
100 sortIndex = m_Atts.GetSlotsSorted().Find(cargo.GetAttachmentSlotID());
101 }
102
103 if (bodyAttachmentSortIndex.Find(currentIndex, slotIndex))
104 {
105 if(slotIndex > sortIndex)
106 {
107 m_Body.InsertAt(cargo, currentIndex);
108 bodyAttachmentSortIndex.Set(currentIndex, sortIndex);
109 }
110 else
111 {
112 currentIndex = m_Body.Insert(cargo);
113 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
114 }
115 }
116 else
117 {
118 currentIndex = m_Body.Insert(cargo);
119 bodyAttachmentSortIndex.Insert(currentIndex, sortIndex);
120 }
121 }
122 }
123 }
124
125 bodyAttachmentSortIndex.Clear();
126 }
class LogManager EntityAI
EntityAI m_Entity
Определения ActionDebug.c:11
map
Определения ControlsXboxNew.c:4
int GetAttachmentSlotID()
Определения Attachments.c:616
Attachments m_Attachments
Определения AttachmentsWrapper.c:3
ref map< EntityAI, ref CargoContainer > m_AttachmentCargos
ref map< EntityAI, ref AttachmentsWrapper > m_AttachmentAttachmentsContainers
ref CargoContainer m_CargoGrid
Определения ContainerWithCargo.c:3
ref Attachments m_Atts
proto native EntityAI GetAttachmentFromIndex(int index)
proto native int AttachmentCount()
Returns count of attachments attached to this item.

Перекрестные ссылки GameInventory::AttachmentCount(), GameInventory::GetAttachmentFromIndex(), Attachments::GetAttachmentSlotID(), m_AttachmentAttachmentsContainers, m_AttachmentCargos, AttachmentsWrapper::m_Attachments, m_Atts, m_CargoGrid и m_Entity.

Используется в AttachmentAddedEx(), AttachmentRemoved() и SetEntity().