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

◆ DialNextNumber()

void DialNextNumber ( int lockSide = FACING_OUTSIDE)
protected

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

274 {
275 bool isInsideLock = (lockSide == FACING_INSIDE);
276
277 string combinationText;
278 string dialedText;
279
280 if (!isInsideLock)
281 {
282 combinationText = m_Combination.ToString();
283 }
284 else
285 {
286 combinationText = m_CombinationInside.ToString();
287 }
288
289 //insert zeros to dials with 0 value
290 int lengthDiff = m_LockDigits - combinationText.Length();
291 for (int i = 0; i < lengthDiff; ++i)
292 {
293 combinationText = "0" + combinationText;
294 }
295 //assemble the whole combination with increased part
296 for (int j = 0; j < combinationText.Length(); ++j)
297 {
298 if (!isInsideLock && j == m_DialIndex || isInsideLock && j == m_DialIndexInside)
299 {
300 int nextDialedNumber = combinationText.Get(j).ToInt() + 1;
301 if (nextDialedNumber > 9)
302 {
303 nextDialedNumber = 0;
304 }
305
306 dialedText += nextDialedNumber.ToString();
307 }
308 else
309 {
310 dialedText += combinationText.Get(j);
311 }
312 }
313
314 //set new number
315 if (!isInsideLock)
316 {
317 SetCombination(dialedText.ToInt());
318 m_LockActionPerformed = LockAction.DIAL_INDEX_CHANGED_OUTSIDE;
319 }
320 else
321 {
322 SetCombinationInside(dialedText.ToInt());
323 m_LockActionPerformed = LockAction.DIAL_INDEX_CHANGED_INSIDE;
324 }
325
326 //synchronize
327 Synchronize();
328 }
int m_LockDigits
Определения CombinationLock.c:32
void SetCombination(int combination, bool setOtherSide=true)
Определения CombinationLock.c:233
static const int FACING_INSIDE
Определения CombinationLock.c:30
void SetCombinationInside(int combination, bool setOtherSide=true)
Определения CombinationLock.c:242
LockAction
Определения CombinationLock.c:13
void Synchronize()
Определения CombinationLock.c:205
int m_Combination
Определения CombinationLock.c:33
int m_DialIndexInside
Определения CombinationLock.c:37
int m_DialIndex
Определения CombinationLock.c:36
int m_CombinationInside
Определения CombinationLock.c:34
LockAction m_LockActionPerformed
Определения CombinationLock.c:41
proto native int Length()
Returns length of string.
proto string Get(int index)
Gets n-th character from string.
static proto string ToString(void var, bool type=false, bool name=false, bool quotes=true)
Return string representation of variable.
proto native int ToInt()
Converts string to integer.

Перекрестные ссылки FACING_INSIDE, FACING_OUTSIDE, string::Get(), string::Length(), m_Combination, m_CombinationInside, m_DialIndex, m_DialIndexInside, m_LockActionPerformed, m_LockDigits, SetCombination(), SetCombinationInside(), Synchronize(), string::ToInt() и string::ToString().