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

◆ GetSlotIndexBySelection()

int ItemBase::GetSlotIndexBySelection ( string selection_component)
inlineprivate

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

663 {
664 int slot_index = -1;
665
666 if ( m_Slots != NULL )
667 {
668 string selection_component_lower = selection_component;
669 selection_component_lower.ToLower();
670
671 int start = selection_component_lower.IndexOf( SLOT_MEMORY_POINT_PREFIX );
672
673 if ( start > -1 )
674 {
675 start += SLOT_MEMORY_POINT_PREFIX.Length();
676 int end = start + 2;
677 int length = selection_component.Length();
678
679 if ( length >= end )
680 {
681 int length_add = length - end; // Hack-fix for inconsistent component names in p3d
682 int length_from_end = 2 + length_add;
683 string num_str = selection_component.Substring( start, length_from_end );
684 slot_index = num_str.ToInt();
685
686 slot_index = slot_index - 1;
687 }
688 }
689 }
690
691 return slot_index;
692 }
ref array< ref Slot > m_Slots
Определения GardenBase.c:25
static const string SLOT_MEMORY_POINT_PREFIX
Определения GardenBase.c:19
proto native int Length()
Returns length of string.
proto native int ToInt()
Converts string to integer.
proto string Substring(int start, int len)
Substring of 'str' from 'start' position 'len' number of characters.
proto native int IndexOf(string sample)
Finds 'sample' in 'str'. Returns -1 when not found.
proto int ToLower()
Changes string to lowercase. Returns length.

Перекрестные ссылки string::IndexOf(), string::Length(), m_Slots, SLOT_MEMORY_POINT_PREFIX, string::Substring(), string::ToInt() и string::ToLower().

Используется в GetSlotBySelection() и PlantSeed().