Ignore:
Timestamp:
Jan 7, 2024, 10:24:51 PM (10 months ago)
Author:
chronos
Message:
  • Modified: Code cleanup.
  • Added: High DPI aware SetWindowPos function.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.