Changeset 171 for trunk/UGame.pas


Ignore:
Timestamp:
Nov 23, 2017, 7:05:37 PM (7 years ago)
Author:
chronos
Message:
  • Modified: Use specialized TPointF type from generic class.
  • Modified: Part of fixes for Voronoi map generation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r170 r171  
    3030  TMapArea = class;
    3131  TClient = class;
    32 
    33   TFloatPoint = record
    34     X, Y: Double;
    35   end;
    3632
    3733  TTerrainType = (ttVoid, ttNormal, ttCity);
     
    525521
    526522procedure InitStrings;
    527 function FloatPoint(AX, AY: Double): TFloatPoint;
    528523
    529524resourcestring
     
    554549  PlayerModeText[pmHuman] := SHuman;
    555550  PlayerModeText[pmComputer] := SComputer;
    556 end;
    557 
    558 function FloatPoint(AX, AY: Double): TFloatPoint;
    559 begin
    560   Result.X := AX;
    561   Result.Y := AY;
    562551end;
    563552
     
    13931382var
    13941383  Points: array of Classes.TPoint;
    1395   FPoints: array of TFloatPoint;
     1384  FPoints: array of TPointF;
    13961385  I: Integer;
    13971386  ArrowSize: TPoint;
     
    14031392  ArrowSize := TPoint.Create(Trunc(DefaultCellSize.X / 3 * View.Zoom),
    14041393    Trunc(DefaultCellSize.Y / 3 * View.Zoom));
    1405   FPoints[0] := FloatPoint(+0.5 * ArrowSize.X, +0 * ArrowSize.Y);
    1406   FPoints[1] := FloatPoint(+0 * ArrowSize.X, +0.5 * ArrowSize.Y);
    1407   FPoints[2] := FloatPoint(+0 * ArrowSize.X, +0.25 * ArrowSize.Y);
    1408   FPoints[3] := FloatPoint(-0.5 * ArrowSize.X, +0.25 * ArrowSize.Y);
    1409   FPoints[4] := FloatPoint(-0.5 * ArrowSize.X, -0.25 * ArrowSize.Y);
    1410   FPoints[5] := FloatPoint(+0 * ArrowSize.X, -0.25 * ArrowSize.Y);
    1411   FPoints[6] := FloatPoint(+0 * ArrowSize.X, -0.5 * ArrowSize.Y);
    1412   FPoints[7] := FloatPoint(+0.5 * ArrowSize.X, 0 * ArrowSize.Y);
     1394  FPoints[0] := TPointF.Create(+0.5 * ArrowSize.X, +0 * ArrowSize.Y);
     1395  FPoints[1] := TPointF.Create(+0 * ArrowSize.X, +0.5 * ArrowSize.Y);
     1396  FPoints[2] := TPointF.Create(+0 * ArrowSize.X, +0.25 * ArrowSize.Y);
     1397  FPoints[3] := TPointF.Create(-0.5 * ArrowSize.X, +0.25 * ArrowSize.Y);
     1398  FPoints[4] := TPointF.Create(-0.5 * ArrowSize.X, -0.25 * ArrowSize.Y);
     1399  FPoints[5] := TPointF.Create(+0 * ArrowSize.X, -0.25 * ArrowSize.Y);
     1400  FPoints[6] := TPointF.Create(+0 * ArrowSize.X, -0.5 * ArrowSize.Y);
     1401  FPoints[7] := TPointF.Create(+0.5 * ArrowSize.X, 0 * ArrowSize.Y);
    14131402  // Rotate
    14141403  for I := 0 to Length(Points) - 1 do
    1415     FPoints[I] := FloatPoint(FPoints[I].X * Cos(Angle) - FPoints[I].Y * Sin(Angle),
     1404    FPoints[I] := TPointF.Create(FPoints[I].X * Cos(Angle) - FPoints[I].Y * Sin(Angle),
    14161405      FPoints[I].X * Sin(Angle) + FPoints[I].Y * Cos(Angle));
    14171406  // Shift
Note: See TracChangeset for help on using the changeset viewer.