rename variables for better code-readability and fix indentation
authorsheepluva
Sat, 15 Oct 2016 13:28:13 +0200
changeset 11871 9e0b20330d05
parent 11870 b801ff99e52c
child 11872 992d7701cbd0
rename variables for better code-readability and fix indentation
hedgewars/uLandObjects.pas
--- a/hedgewars/uLandObjects.pas	Sat Oct 15 13:10:16 2016 +0200
+++ b/hedgewars/uLandObjects.pas	Sat Oct 15 13:28:13 2016 +0200
@@ -48,8 +48,8 @@
                      Surf, Mask: PSDL_Surface;
                      inland: array[0..Pred(MAXOBJECTRECTS)] of TSDL_Rect;
                      outland: array[0..Pred(MAXOBJECTRECTS)] of TSDL_Rect;
-                     rectcnt: Longword;
-                     rectcnt2: Longword;
+                     inrectcnt: Longword;
+                     outrectcnt: Longword;
                      Width, Height: Longword;
                      Maxcnt: Longword;
                      end;
@@ -359,14 +359,14 @@
     with Obj do begin
         bRes:= true;
         i:= 1;
-        while bRes and (i <= rectcnt2) do
+        while bRes and (i <= inrectcnt) do
             begin
             bRes:= CheckLand(inland[i], x, y, lfBasic);
             inc(i)
             end;
 
         i:= 1;
-        while bRes and (i <= rectcnt) do
+        while bRes and (i <= outrectcnt) do
             begin
             bRes:= CheckLand(outland[i], x, y, 0);
             inc(i)
@@ -668,41 +668,43 @@
             Delete(s, 1, i);
             if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then
                 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true);
-        rectcnt2 := 0;
+
+            inrectcnt := 0;
+
             for ii := 1 to Length(S) do
               if S[ii] = ',' then
-                inc(rectcnt2);
+                inc(inrectcnt);
 
-            if rectcnt2 mod 2 = 0 then
-              rectcnt2 := 1
+            if inrectcnt mod 2 = 0 then
+              inrectcnt := 1
             else begin
               i:= Pos(',', s);
-              rectcnt2:= StrToInt(Trim(Copy(s, 1, Pred(i))));
+              inrectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i))));
               Delete(s, 1, i);
             end;
 
-            for ii:= 1 to rectcnt2 do
-            with inland[ii] do
-            begin
-            i:= Pos(',', s);
-            x:= StrToInt(Trim(Copy(s, 1, Pred(i))));
-            Delete(s, 1, i);
-            i:= Pos(',', s);
-            y:= StrToInt(Trim(Copy(s, 1, Pred(i))));
-            Delete(s, 1, i);
-            i:= Pos(',', s);
-            w:= StrToInt(Trim(Copy(s, 1, Pred(i))));
-            Delete(s, 1, i);
-            i:= Pos(',', s);
-            h:= StrToInt(Trim(Copy(s, 1, Pred(i))));
-            Delete(s, 1, i);
-            CheckRect(Width, Height, x, y, w, h)
-        end;
+            for ii:= 1 to inrectcnt do
+                with inland[ii] do
+                    begin
+                    i:= Pos(',', s);
+                    x:= StrToInt(Trim(Copy(s, 1, Pred(i))));
+                    Delete(s, 1, i);
+                    i:= Pos(',', s);
+                    y:= StrToInt(Trim(Copy(s, 1, Pred(i))));
+                    Delete(s, 1, i);
+                    i:= Pos(',', s);
+                    w:= StrToInt(Trim(Copy(s, 1, Pred(i))));
+                    Delete(s, 1, i);
+                    i:= Pos(',', s);
+                    h:= StrToInt(Trim(Copy(s, 1, Pred(i))));
+                    Delete(s, 1, i);
+                    CheckRect(Width, Height, x, y, w, h)
+                    end;
 
             i:= Pos(',', s);
-            rectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i))));
+            outrectcnt:= StrToInt(Trim(Copy(s, 1, Pred(i))));
             Delete(s, 1, i);
-            for ii:= 1 to rectcnt do
+            for ii:= 1 to outrectcnt do
                 with outland[ii] do
                     begin
                     i:= Pos(',', s);
@@ -714,7 +716,7 @@
                     i:= Pos(',', s);
                     w:= StrToInt(Trim(Copy(s, 1, Pred(i))));
                     Delete(s, 1, i);
-                    if ii = rectcnt then
+                    if ii = outrectcnt then
                         h:= StrToInt(Trim(s))
                     else
                         begin
@@ -724,6 +726,7 @@
                         end;
                     CheckRect(Width, Height, x, y, w, h)
                     end;
+
             end;
         end
     else if key = 'spray' then