Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; ALPHABETIZE WEAPON LISTS
- ; loop vars
- int iIdx
- int iCnt
- ref rItm
- ; sort vars
- int iIdx1
- int iCnt1
- int iIdx2
- int iCnt2
- int iFlg
- int iTmp
- ref rLst
- ref rItm1
- ref rItm2
- ref rTemp
- set iIdx to 0
- set iCnt to ListGetCount VMMWeaponListsOrderedList
- ; printc "%g lists to sort" iCnt
- Label 5
- if (iIdx < iCnt)
- set rLst to ListGetNthForm VMMWeaponListsOrderedList iIdx
- ; printc "Sorting %i" rLst
- set iIdx1 to 0
- set iCnt1 to ListGetCount rLst
- Label 10
- if (iIdx1 < iCnt1)
- set iIdx2 to iIdx1
- Label 20
- if (iIdx2 > 0)
- set iTmp to iIdx2 - 1
- set rItm1 to ListGetNthForm rLst iTmp
- set rItm2 to ListGetNthForm rLst iIdx2
- if (IsFormValid rItm1) && (IsFormValid rItm2)
- if (CompareNames rItm1 rItm2 == -1)
- set rTemp to ListGetNthForm rLst iTmp
- ListReplaceNthForm rLst rItm1 iIdx2
- ListReplaceNthForm rLst rItm2 iTmp
- endif
- set iIdx2 to iIdx2 - 1
- Goto 20
- endif
- endif
- set iIdx1 to iIdx1 + 1
- Goto 10
- endif
- ; Output the contents of the sorted list to console for testing
- ; printc "Sorted %i" rLst
- ; set iIdx1 to 0
- ; set iCnt1 to ListGetCount NVAllWeapons
- ; Label 1
- ; if iIdx1 < iCnt1
- ; set rItm1 to ListGetNthForm NVAllWeapons iIdx1
- ; printc "%n" rItm1
- ; set iIdx1 to iIdx1 + 1
- ; Goto 1
- ; endif
- ; printc "End sorted %i" rLst
- set iIdx to iIdx + 1
- Goto 5
- endif
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement