Page 1 of 1

SAIL - SortBySkill

Posted: Thu Oct 10, 2019 1:12 pm
by Serpent
Funkcja sortująca jednostki malejąco wg. zadanej umiejętności. Dozwolone są tylko umiejętności od 1 do 4.

Code: Select all

Export Function SortBySkill(units, class);
var i, tmp;
begin
if not units or not class in [1, 2, 3, 4] then
   exit;

tmp := [];

for i in units do
    tmp := Insert(tmp, tmp+1, GetSkill(i, class));

if not tmp then
   exit;

result := SortListByListDesc(units, tmp);
End;