Changeset 303 for branches/highdpi/GameServer.pas
- Timestamp:
- Mar 9, 2021, 9:19:49 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/GameServer.pas
r266 r303 7 7 8 8 uses 9 UDpiControls, Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, Graphics; 9 UDpiControls, Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, 10 Graphics; 10 11 11 12 const 12 Version = $010 200;13 Version = $010300; 13 14 FirstAICompatibleVersion = $000D00; 14 15 FirstBookCompatibleVersion = $010103; … … 561 562 MapFile := TFileStream.Create(GetMapsDir + DirectorySeparator + FileName, 562 563 fmCreate or fmShareExclusive); 563 MapFile.Position := 0; 564 s := 'cEvoMap'#0; 565 MapFile.write(s[1], 8); { file id } 566 i := 0; 567 MapFile.write(i, 4); { format id } 568 MapFile.write(MaxTurn, 4); 569 MapFile.write(lx, 4); 570 MapFile.write(ly, 4); 571 MapFile.write(RealMap, MapSize * 4); 572 MapFile.Free; 564 try 565 MapFile.Position := 0; 566 s := 'cEvoMap'#0; 567 MapFile.write(s[1], 8); { file id } 568 i := 0; 569 MapFile.write(i, 4); { format id } 570 MapFile.write(MaxTurn, 4); 571 MapFile.write(lx, 4); 572 MapFile.write(ly, 4); 573 MapFile.write(RealMap, MapSize * 4); 574 finally 575 FreeAndNil(MapFile); 576 end; 573 577 end; 574 578 … … 613 617 result := true; 614 618 end; 615 MapFile.Free;619 FreeAndNil(MapFile); 616 620 except 617 621 if MapFile <> nil then 618 MapFile.Free;622 FreeAndNil(MapFile); 619 623 end; 620 624 end; … … 694 698 else 695 699 CL.SaveToFile(LogFile); 696 LogFile.Free;700 FreeAndNil(LogFile); 697 701 if auto then 698 702 begin … … 721 725 Brains.GetByKind(btAI, AIBrains); 722 726 bix[p1] := AIBrains[DelphiRandom(AIBrains.Count)]; 723 AIBrains.Free;727 FreeAndNil(AIBrains); 724 728 end 725 729 else … … 863 867 Human := 0; 864 868 for p1 := 0 to nPl - 1 do 865 if bix[p1].Kind = btTermthen869 if Assigned(bix[p1]) and (bix[p1].Kind = btTerm) then 866 870 inc(Human, 1 shl p1); 867 871 InitMapGame(Human); … … 992 996 CityProcessing.ReleaseGame; 993 997 Database.ReleaseGame; 994 CL.Free;998 FreeAndNil(CL); 995 999 end; 996 1000 … … 1190 1194 CL.LoadFromFile(LogFile); 1191 1195 end; 1192 LogFile.Free;1196 FreeAndNil(LogFile); 1193 1197 if not result then 1194 1198 Exit; … … 4604 4608 begin 4605 4609 FreeAndNil(Picture); 4606 inherited Destroy;4610 inherited; 4607 4611 end; 4608 4612
Note:
See TracChangeset
for help on using the changeset viewer.