SAIL - Compare

Gotowe kody SAIL'a, informacje na temat moddingu, itd.

Moderator: zoNE

Post Reply
User avatar
zoNE
The Great Uniter & Site Administrator
The Great Uniter & Site Administrator
Posts: 2059
Joined: Fri Feb 17, 2006 3:44 pm
Location: Poland
Contact:

SAIL - Compare

Post by zoNE »

Serpent wrote:Poniżej zamieszczam dwie nowe funkcje.

Compare - porównuje dwie wartości.

Code: Select all

Export Function Compare(val1, val2);
begin
if val1 = val2 then
   result := true
    else
     result := false;
End;
Funkcja ta umożliwia porównanie na przykład dwóch elementów tablic gdyż normalny zapis: tablica[1] = tabliczka[2] jest niedozwolony.

CompareArray - porównuje dwie tablice pod kątem wielkości i zawartości.

Code: Select all

Export Function CompareArray(array1, array2);
var i;
begin
result := true;

     if array1 = array2 then
        begin
        for i = 1 to array1 do
            if not Compare(array1[i], array2[i]) then
               begin
               result := false;
               break;
               end;
        end
         else
          result := false;
End;
Author: Serpent
Topic: https://forum.original-war.net/viewtopi ... =42&t=4856
Post Reply