Changeset 522 for trunk/LocalPlayer


Ignore:
Timestamp:
Jan 7, 2024, 10:24:51 PM (12 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
  • Added: High DPI aware SetWindowPos function.
Location:
trunk/LocalPlayer
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/ClientTools.pas

    r486 r522  
    100100  Inc(Loc0, G.lx * 1024);
    101101  Inc(Loc1, G.lx * 1024);
    102   dx := abs(((Loc1 mod G.lx * 2 + Loc1 div G.lx and 1) -
     102  dx := Abs(((Loc1 mod G.lx * 2 + Loc1 div G.lx and 1) -
    103103    (Loc0 mod G.lx * 2 + Loc0 div G.lx and 1) + 3 * G.lx) mod (2 * G.lx) - G.lx);
    104   dy := abs(Loc1 div G.lx - Loc0 div G.lx);
    105   Result := dx + dy + abs(dx - dy) shr 1;
     104  dy := Abs(Loc1 div G.lx - Loc0 div G.lx);
     105  Result := dx + dy + Abs(dx - dy) shr 1;
    106106end;
    107107
     
    371371      for dx := -2 to 2 do
    372372        for dy := -2 to 2 do
    373           if abs(dx) + abs(dy) = 2 then
     373          if Abs(dx) + Abs(dy) = 2 then
    374374            if Server(sMoveUnit - sExecute + dx and 7 shl 4 + dy and
    375375              7 shl 7, Me, uix, nil^) >= rExecuted then
  • trunk/LocalPlayer/Diagram.pas

    r468 r522  
    219219        MoveTo(X, Border);
    220220        LineTo(X, InnerHeight - Border);
    221         S := IntToStr(abs(TurnToYear(T * LineStep)));
     221        S := IntToStr(Abs(TurnToYear(T * LineStep)));
    222222        Textout(X - TextWidth(S) div 2, Border - 16, S);
    223223      end;
  • trunk/LocalPlayer/IsoEngine.pas

    r506 r522  
    13721372  I: Integer;
    13731373begin
    1374   FOutput.Canvas.pen.Color := $000000; // $FF shl (8*random(3));
     1374  FOutput.Canvas.pen.Color := $000000; // $FF shl (8 * Random(3));
    13751375  for I := 0 to nx div 2 do
    13761376    ClippedLine(I * 2, 0, False);
     
    14301430  for Y := 0 to ScaleToNative(Height) - 1 do begin
    14311431    y_n := (ScaleFromNative(Y) + y0 - ym) / yyt;
    1432     if abs(y_n) < rShade then begin
     1432    if Abs(y_n) < rShade then begin
    14331433      // Darken left and right parts of elipsis
    14341434      w_n := sqrt(sqr(rShade) - sqr(y_n));
  • trunk/LocalPlayer/Nego.pas

    r496 r522  
    746746          if InputDlg.ModalResult <> mrOK then
    747747            Exit;
    748           val(InputDlg.EditInput.Text, A, I);
     748          Val(InputDlg.EditInput.Text, A, I);
    749749          if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then
    750750            Exit;
     
    776776          if InputDlg.ModalResult <> mrOK then
    777777            Exit;
    778           val(InputDlg.EditInput.Text, A, I);
     778          Val(InputDlg.EditInput.Text, A, I);
    779779          if (I <> 0) or (A <= 0) then
    780780            Exit;
     
    858858          if InputDlg.ModalResult <> mrOK then
    859859            Exit;
    860           val(InputDlg.EditInput.Text, A, I);
     860          Val(InputDlg.EditInput.Text, A, I);
    861861          if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then
    862862            Exit;
     
    878878          if InputDlg.ModalResult <> mrOK then
    879879            Exit;
    880           val(InputDlg.EditInput.Text, A, I);
     880          Val(InputDlg.EditInput.Text, A, I);
    881881          if (I <> 0) or (A <= 0) then
    882882            Exit;
  • trunk/LocalPlayer/Select.pas

    r518 r522  
    88  SysUtils, Classes, ButtonB, ButtonBase, Types,
    99  {$IFDEF DPI}Dpi.Graphics, Dpi.Controls, Dpi.Forms, Dpi.ExtCtrls, Dpi.Menus,
    10   System.UITypes{$ELSE}
     10  Dpi.Common, System.UITypes{$ELSE}
    1111  Graphics, Controls, Forms, ExtCtrls, Menus{$ENDIF};
    1212
     
    11151115            for dx := -2 to 2 do
    11161116              for dy := -2 to 2 do
    1117                 if abs(dx) + abs(dy) = 2 then
     1117                if Abs(dx) + Abs(dy) = 2 then
    11181118                begin
    11191119                  Loc1 := dLoc(MyCity[cixProject].Loc, dx, dy);
  • trunk/LocalPlayer/Term.pas

    r517 r522  
    15731573      if Tribe[I] <> nil then
    15741574      begin
    1575         TestColorDistance := abs(Integer(UnusedTribeFiles.Objects[J])
     1575        TestColorDistance := Abs(Integer(UnusedTribeFiles.Objects[J])
    15761576          shr 16 and $FF - Tribe[I].Color shr 16 and $FF) +
    15771577          Abs(Integer(UnusedTribeFiles.Objects[J]) shr 8 and
     
    16581658      for I := 0 to nShipPart - 1 do
    16591659      begin
    1660         TestCost := abs(Ship1Change[I]) * Imp[imShipComp + I].Cost;
     1660        TestCost := Abs(Ship1Change[I]) * Imp[imShipComp + I].Cost;
    16611661        if TestCost > MostCost then
    16621662        begin
     
    35343534          (TButtonC(Components[I]).ButtonIndex <> 1) then
    35353535          TButtonC(Components[I]).ButtonIndex :=
    3536             Integer(MapOptionChecked) shr (Components[I].Tag shr 8) and 1 + 2
     3536            Integer(MapOptionChecked) shr (Components[I].Tag shr 8) and 1 + 2;
    35373537      end;
    35383538
     
    45854585    xs := (x0 - xw) * (xxt * 2) + y0 and 1 * xxt - G.lx * (xxt * 2);
    45864586    // |xs+xl/2-MapWidth/2| -> min
    4587     while abs(2 * (xs + G.lx * (xxt * 2)) + xl - MapWidth) <
    4588       abs(2 * xs + xl - MapWidth) do
     4587    while Abs(2 * (xs + G.lx * (xxt * 2)) + xl - MapWidth) <
     4588      Abs(2 * xs + xl - MapWidth) do
    45894589        Inc(xs, G.lx * (xxt * 2));
    45904590    ys := (y0 - yw) * yyt - yyt;
     
    46324632    xMap := (x0 - xw) * (xxt * 2) + y0 and 1 * xxt - G.lx * (xxt * 2);
    46334633    // |xMap+xxt-MapWidth/2| -> min
    4634     while abs(2 * (xMap + G.lx * (xxt * 2)) + 2 * xxt - MapWidth) <
    4635       abs(2 * xMap + 2 * xxt - MapWidth) do
     4634    while Abs(2 * (xMap + G.lx * (xxt * 2)) + 2 * xxt - MapWidth) <
     4635      Abs(2 * xMap + 2 * xxt - MapWidth) do
    46364636      Inc(xMap, G.lx * (xxt * 2));
    46374637    yMap := (y0 - yw) * yyt - yyt;
     
    59545954          mod (2 * G.lx) - G.lx;
    59555955        dy := MouseLoc div G.lx - Loc div G.lx;
    5956         if abs(dx) + abs(dy) < 3 then
     5956        if Abs(dx) + Abs(dy) < 3 then
    59575957        begin
    59585958          DestinationMarkON := False;
     
    66216621    // ((xFromLoc-xw1)*2+yFromLoc and 1+1)*xxt+dx*xxt/2-MapWidth/2 -> min
    66226622    with MainMap do begin
    6623       while abs(((xFromLoc - xw1 + G.lx) * 2 + yFromLoc and 1 + 1) * xxt * 2 + dx
    6624         * xxt - MapWidth) < abs(((xFromLoc - xw1) * 2 + yFromLoc and 1 + 1) * xxt
     6623      while Abs(((xFromLoc - xw1 + G.lx) * 2 + yFromLoc and 1 + 1) * xxt * 2 + dx
     6624        * xxt - MapWidth) < Abs(((xFromLoc - xw1) * 2 + yFromLoc and 1 + 1) * xxt
    66256625        * 2 + dx * xxt - MapWidth) do
    66266626        Dec(xw1, G.lx);
     
    66516651    NoMap.SetOutput(Buffer);
    66526652    NoMap.SetPaintBounds(0, 0, xRange, yRange);
    6653     for Step := 0 to abs(Step1 - Step0) do
     6653    for Step := 0 to Abs(Step1 - Step0) do
    66546654    begin
    66556655      BitBltCanvas(Buffer.Canvas, 0, 0, xRange, yRange,
     
    66586658      begin
    66596659        xMoving := xFrom +
    6660           Round((Step0 + Step * (Step1 - Step0) div abs(Step1 - Step0)) *
     6660          Round((Step0 + Step * (Step1 - Step0) div Abs(Step1 - Step0)) *
    66616661          (xTo - xFrom) / nStep);
    66626662        yMoving := yFrom +
    6663           Round((Step0 + Step * (Step1 - Step0) div abs(Step1 - Step0)) *
     6663          Round((Step0 + Step * (Step1 - Step0) div Abs(Step1 - Step0)) *
    66646664          (yTo - yFrom) / nStep);
    66656665      end
     
    69816981  x0:=(Loc+(y0 and 1+G.lx*1024) div 2) mod G.lx;
    69826982  xs:=(x0-xw)*66+y0 and 1*33-G.lx*66;
    6983   while abs(2*(xs+G.lx*66)-MapWidth)<abs(2*xs-MapWidth) do
     6983  while Abs(2*(xs+G.lx*66)-MapWidth)<Abs(2*xs-MapWidth) do
    69846984  Inc(xs,G.lx*66);
    69856985  ys:=(y0-yw)*16;
Note: See TracChangeset for help on using the changeset viewer.