Ignore:
Timestamp:
May 9, 2020, 4:02:07 PM (4 years ago)
Author:
chronos
Message:
  • Modified: Improved HighDPI branch. Imported new changes from trunk branch.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/GameServer.pas

    r178 r210  
    77
    88uses
    9   Protocol, Database, dynlibs, Platform, dateutils, fgl, FileUtil, Graphics,
    10   UDpiControls;
     9  UDpiControls, Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, Graphics;
    1110
    1211const
     
    117116function PreviewMap(lm: integer): pointer;
    118117
     118
    119119implementation
    120120
    121121uses
    122   Directories, CityProcessing, UnitProcessing, CmdList,
    123 
    124   LCLIntf, LCLType, LMessages, Classes, SysUtils;
     122  Directories, CityProcessing, UnitProcessing, CmdList, LCLIntf, LCLType,
     123  LMessages, Classes, SysUtils;
     124
     125resourcestring
     126  SNoAiFound = 'No AI libraries found in directory %s';
    125127
    126128var
     
    257259  BrainBeginner := nil;
    258260
    259   if FindFirst(HomeDir + 'AI' + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then
     261  if FindFirst(GetAiDir + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then
    260262  repeat
    261     BasePath := HomeDir + 'AI' + DirectorySeparator + f.Name;
     263    BasePath := GetAiDir + DirectorySeparator + f.Name;
    262264    if (f.Name <> '.') and (f.Name <> '..') and DirectoryExists(BasePath) then begin
    263265      NewBrain := Brains.AddNew;
     
    273275
    274276  if Brains.GetKindCount(btAI) = 0 then
    275     raise Exception.Create(Format('No AI libraries found in directory %s', [HomeDir + 'AI']));
     277    raise Exception.Create(Format(SNoAiFound, [GetAiDir]));
    276278end;
    277279
     
    305307  end;
    306308  CreateMap(true);
    307   result := @RealMap;
     309  Result := @RealMap;
    308310end;
    309311
     
    557559  s: string[255];
    558560begin
    559   MapFile := TFileStream.Create(DataDir + 'Maps' + DirectorySeparator + FileName,
     561  MapFile := TFileStream.Create(GetMapsDir + DirectorySeparator + FileName,
    560562    fmCreate or fmShareExclusive);
    561563  MapFile.Position := 0;
     
    580582  MapFile := nil;
    581583  try
    582     MapFile := TFileStream.Create(DataDir + 'Maps' + DirectorySeparator + FileName,
     584    MapFile := TFileStream.Create(GetMapsDir + DirectorySeparator + FileName,
    583585      fmOpenRead or fmShareExclusive);
    584586    MapFile.Position := 0;
     
    13671369  LogFileName := FileName;
    13681370  MapFileName := Map;
    1369   if FastContact then
    1370   begin
     1371  {$IFDEF FastContact}
    13711372    lx := 24;
    13721373    ly := 42;
    1373   end
    1374   else
    1375   begin
     1374  {$ELSE}
    13761375    lx := Newlx;
    1377     ly := Newly
    1378   end;
     1376    ly := Newly;
     1377  {$ENDIF}
    13791378  MapSize := lx * ly;
    13801379  if MapFileName <> '' then
     
    26982697  end;
    26992698
    2700 const
    2701   Dirx: array [0 .. 7] of integer = (1, 2, 1, 0, -1, -2, -1, 0);
    2702   Diry: array [0 .. 7] of integer = (-1, 0, 1, 2, 1, 0, -1, -2);
    2703 
    27042699var
    27052700  d, i, j, p1, p2, pt0, pt1, uix1, cix1, Loc0, Loc1, dx, dy, NewCap, MinCap,
     
    27072702    StopTurn, FutureMCost, NewProject, OldImp, mix, V8, V21, AStr, DStr,
    27082703    ABaseDamage, DBaseDamage: integer;
    2709   CityReport, AltCityReport: TCityReport;
     2704  CityReport: TCityReport;
    27102705  FormerCLState: TCmdListState;
    2711   EndTime: int64;
    27122706  Adjacent: TVicinity8Loc;
    27132707  Radius: TVicinity21Loc;
     
    45854579constructor TBrain.Create;
    45864580begin
    4587   Picture := nil;
     4581  Picture := TDpiBitmap.Create;
     4582  Picture.SetSize(64, 64);
    45884583end;
    45894584
    45904585destructor TBrain.Destroy;
    45914586begin
    4592   if Assigned(Picture) then Picture.Free;
     4587  FreeAndNil(Picture);
    45934588  inherited Destroy;
    45944589end;
Note: See TracChangeset for help on using the changeset viewer.