Ignore:
Timestamp:
May 19, 2022, 10:39:34 PM (2 years ago)
Author:
chronos
Message:
  • Modified: Use first capital letter in identifiers.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/TechTree.pas

    r426 r447  
    5555  yLegendPitch = 32;
    5656
    57 function min(a, b: Integer): Integer;
    58 begin
    59   if a < b then
    60     result := a
     57function Min(A, B: Integer): Integer;
     58begin
     59  if A < B then
     60    Result := A
    6161  else
    62     result := b;
    63 end;
    64 
    65 function max(a, b: Integer): Integer;
    66 begin
    67   if a > b then
    68     result := a
     62    Result := B;
     63end;
     64
     65function Max(A, B: Integer): Integer;
     66begin
     67  if A > B then
     68    Result := A
    6969  else
    70     result := b;
     70    Result := B;
    7171end;
    7272
     
    8484procedure TTechTreeDlg.FormPaint(Sender: TObject);
    8585var
    86   X, w: Integer;
     86  X, W: Integer;
    8787begin
    8888  with Canvas do begin
    8989    // black border
    90     brush.color := $000000;
    91     fillrect(rect(0, 0, BlackBorder, ClientHeight));
    92     fillrect(rect(BlackBorder, 0, ClientWidth - BlackBorder, BlackBorder));
    93     fillrect(rect(ClientWidth - BlackBorder, 0, ClientWidth, ClientHeight));
    94     fillrect(rect(BlackBorder, ClientHeight - BlackBorder,
     90    Brush.Color := $000000;
     91    FillRect(rect(0, 0, BlackBorder, ClientHeight));
     92    FillRect(rect(BlackBorder, 0, ClientWidth - BlackBorder, BlackBorder));
     93    FillRect(rect(ClientWidth - BlackBorder, 0, ClientWidth, ClientHeight));
     94    FillRect(rect(BlackBorder, ClientHeight - BlackBorder,
    9595      ClientWidth - BlackBorder, ClientHeight));
    9696
    9797    // texturize empty space
    98     brush.color := $FFFFFF;
     98    Brush.Color := $FFFFFF;
    9999    if xOffset > 0 then
    100100      FillRectSeamless(Canvas, BlackBorder, BlackBorder, BlackBorder + xOffset,
     
    105105        ClientWidth - BlackBorder, ClientHeight - BlackBorder,
    106106        -BlackBorder - xOffset, -BlackBorder - yOffset, Paper);
    107     X := max(BlackBorder, BlackBorder + xOffset);
    108     w := min(BlackBorder + xOffset + Image.width, ClientWidth - BlackBorder);
     107    X := Max(BlackBorder, BlackBorder + xOffset);
     108    W := Min(BlackBorder + xOffset + Image.width, ClientWidth - BlackBorder);
    109109    if yOffset > 0 then
    110       FillRectSeamless(Canvas, X, BlackBorder, w, BlackBorder + yOffset,
     110      FillRectSeamless(Canvas, X, BlackBorder, W, BlackBorder + yOffset,
    111111        -BlackBorder - xOffset, -BlackBorder - yOffset, Paper);
    112112    if yOffset + Image.height < ClientHeight - 2 * BlackBorder then
    113       FillRectSeamless(Canvas, X, BlackBorder + yOffset + Image.height, w,
     113      FillRectSeamless(Canvas, X, BlackBorder + yOffset + Image.height, W,
    114114        ClientHeight - BlackBorder, -BlackBorder - xOffset,
    115115        -BlackBorder - yOffset, Paper);
    116116  end;
    117   BitBltCanvas(Canvas, max(BlackBorder, BlackBorder + xOffset),
    118     max(BlackBorder, BlackBorder + yOffset),
    119     min(Image.width, min(Image.width + xOffset,
    120     min(ClientWidth - 2 * BlackBorder, ClientWidth - 2 * BlackBorder - xOffset))
    121     ), min(Image.height, min(Image.height + yOffset,
    122     min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder -
    123     yOffset))), Image.Canvas, max(0, -xOffset),
    124     max(0, -yOffset));
     117  BitBltCanvas(Canvas, Max(BlackBorder, BlackBorder + xOffset),
     118    Max(BlackBorder, BlackBorder + yOffset),
     119    Min(Image.width, Min(Image.width + xOffset,
     120    Min(ClientWidth - 2 * BlackBorder, ClientWidth - 2 * BlackBorder - xOffset))
     121    ), Min(Image.height, Min(Image.height + yOffset,
     122    Min(ClientHeight - 2 * BlackBorder, ClientHeight - 2 * BlackBorder -
     123    yOffset))), Image.Canvas, Max(0, -xOffset),
     124    Max(0, -yOffset));
    125125end;
    126126
     
    128128var
    129129  X, Y, ad: Integer;
    130   s: string;
     130  S: string;
    131131  NewWidth: Integer;
    132132  NewHeight: Integer;
     
    142142      // write advance names
    143143      Font.Assign(UniFont[ftSmall]);
    144       Font.color := clBlack;
    145       brush.Style := bsClear;
     144      Font.Color := clBlack;
     145      Brush.Style := bsClear;
    146146      for X := 0 to (Image.width - xStart) div xPitch do
    147147        for Y := 0 to (Image.height - yStart) div yPitch do
     
    150150          if ad and $FFFF00 = 0 then
    151151          begin
    152             s := Phrases.Lookup('ADVANCES', ad);
    153             while TextWidth(s) > 112 do
    154               Delete(s, Length(s), 1);
    155             TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, s);
     152            S := Phrases.Lookup('ADVANCES', ad);
     153            while TextWidth(S) > 112 do
     154              Delete(S, Length(S), 1);
     155            TextOut(xStart + X * xPitch + 2, yStart + Y * yPitch, S);
    156156            Pixels[xStart + X * xPitch + 10, yStart + Y * yPitch - 1]
    157157              := TransparentColor2;
     
    191191  if Button = mbLeft then
    192192  begin
    193     dragging := true;
     193    dragging := True;
    194194    xDown := X;
    195195    yDown := Y;
     
    200200  Shift: TShiftState; X, Y: Integer);
    201201begin
    202   dragging := false;
     202  dragging := False;
    203203end;
    204204
Note: See TracChangeset for help on using the changeset viewer.