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

◆ GetNearestSlotIDByState()

int ItemBase::GetNearestSlotIDByState ( vector position,
int slot_state )
inlineprivate

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

785 {
786 float nearest_distance = 1000.0;
787 int nearest_slot_index = -1;
788 int slots_count = GetGardenSlotsCount();
789 for (int i = 0; i < slots_count; i++)
790 {
791 Slot slot = m_Slots.Get(i); // Move this line by a scope higher in this function after debugging
792 vector slot_pos = GetSlotPosition(i);
793 float current_distance = vector.Distance(position, slot_pos);
794
795 if (current_distance < nearest_distance)
796 {
797 if (slot != NULL && slot.GetState() == slot_state)
798 {
799 nearest_distance = current_distance;
800 nearest_slot_index = i;
801 }
802 }
803 }
804
805 return nearest_slot_index;
806 }
vector GetSlotPosition(int index)
Определения GardenBase.c:808
ref array< ref Slot > m_Slots
Определения GardenBase.c:26
int GetGardenSlotsCount()
Определения GardenBase.c:351

Перекрестные ссылки vector::Distance(), GardenBase::GetGardenSlotsCount(), GetSlotPosition() и m_Slots.