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

◆ GetSlotIndexBySelection()

int ItemBase::GetSlotIndexBySelection ( string selection_component)
inlineprivate

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

721 {
722 int slot_index = -1;
723
724 if ( m_Slots != NULL )
725 {
726 string selection_component_lower = selection_component;
727 selection_component_lower.ToLower();
728
729 int start = selection_component_lower.IndexOf( SLOT_MEMORY_POINT_PREFIX );
730
731 if ( start > -1 )
732 {
733 start += SLOT_MEMORY_POINT_PREFIX.Length();
734 int end = start + 2;
735 int length = selection_component.Length();
736
737 if ( length >= end )
738 {
739 int length_add = length - end; // Hack-fix for inconsistent component names in p3d
740 int length_from_end = 2 + length_add;
741 string num_str = selection_component.Substring( start, length_from_end );
742 slot_index = num_str.ToInt();
743
744 slot_index = slot_index - 1;
745 }
746 }
747 }
748
749 return slot_index;
750 }
ref array< ref Slot > m_Slots
Определения GardenBase.c:26
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().