Changeset 210 for branches/highdpi/GameServer.pas
- Timestamp:
- May 9, 2020, 4:02:07 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/GameServer.pas
r178 r210 7 7 8 8 uses 9 Protocol, Database, dynlibs, Platform, dateutils, fgl, FileUtil, Graphics, 10 UDpiControls; 9 UDpiControls, Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, Graphics; 11 10 12 11 const … … 117 116 function PreviewMap(lm: integer): pointer; 118 117 118 119 119 implementation 120 120 121 121 uses 122 Directories, CityProcessing, UnitProcessing, CmdList, 123 124 LCLIntf, LCLType, LMessages, Classes, SysUtils; 122 Directories, CityProcessing, UnitProcessing, CmdList, LCLIntf, LCLType, 123 LMessages, Classes, SysUtils; 124 125 resourcestring 126 SNoAiFound = 'No AI libraries found in directory %s'; 125 127 126 128 var … … 257 259 BrainBeginner := nil; 258 260 259 if FindFirst( HomeDir + 'AI'+ DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then261 if FindFirst(GetAiDir + DirectorySeparator + '*', faDirectory or faArchive or faReadOnly, f) = 0 then 260 262 repeat 261 BasePath := HomeDir + 'AI'+ DirectorySeparator + f.Name;263 BasePath := GetAiDir + DirectorySeparator + f.Name; 262 264 if (f.Name <> '.') and (f.Name <> '..') and DirectoryExists(BasePath) then begin 263 265 NewBrain := Brains.AddNew; … … 273 275 274 276 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])); 276 278 end; 277 279 … … 305 307 end; 306 308 CreateMap(true); 307 result := @RealMap;309 Result := @RealMap; 308 310 end; 309 311 … … 557 559 s: string[255]; 558 560 begin 559 MapFile := TFileStream.Create( DataDir + 'Maps'+ DirectorySeparator + FileName,561 MapFile := TFileStream.Create(GetMapsDir + DirectorySeparator + FileName, 560 562 fmCreate or fmShareExclusive); 561 563 MapFile.Position := 0; … … 580 582 MapFile := nil; 581 583 try 582 MapFile := TFileStream.Create( DataDir + 'Maps'+ DirectorySeparator + FileName,584 MapFile := TFileStream.Create(GetMapsDir + DirectorySeparator + FileName, 583 585 fmOpenRead or fmShareExclusive); 584 586 MapFile.Position := 0; … … 1367 1369 LogFileName := FileName; 1368 1370 MapFileName := Map; 1369 if FastContact then 1370 begin 1371 {$IFDEF FastContact} 1371 1372 lx := 24; 1372 1373 ly := 42; 1373 end 1374 else 1375 begin 1374 {$ELSE} 1376 1375 lx := Newlx; 1377 ly := Newly 1378 end;1376 ly := Newly; 1377 {$ENDIF} 1379 1378 MapSize := lx * ly; 1380 1379 if MapFileName <> '' then … … 2698 2697 end; 2699 2698 2700 const2701 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 2704 2699 var 2705 2700 d, i, j, p1, p2, pt0, pt1, uix1, cix1, Loc0, Loc1, dx, dy, NewCap, MinCap, … … 2707 2702 StopTurn, FutureMCost, NewProject, OldImp, mix, V8, V21, AStr, DStr, 2708 2703 ABaseDamage, DBaseDamage: integer; 2709 CityReport , AltCityReport: TCityReport;2704 CityReport: TCityReport; 2710 2705 FormerCLState: TCmdListState; 2711 EndTime: int64;2712 2706 Adjacent: TVicinity8Loc; 2713 2707 Radius: TVicinity21Loc; … … 4585 4579 constructor TBrain.Create; 4586 4580 begin 4587 Picture := nil; 4581 Picture := TDpiBitmap.Create; 4582 Picture.SetSize(64, 64); 4588 4583 end; 4589 4584 4590 4585 destructor TBrain.Destroy; 4591 4586 begin 4592 if Assigned(Picture) then Picture.Free;4587 FreeAndNil(Picture); 4593 4588 inherited Destroy; 4594 4589 end;
Note:
See TracChangeset
for help on using the changeset viewer.