Changeset 290 for trunk/GameServer.pas
- Timestamp:
- Feb 26, 2021, 11:56:48 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GameServer.pas
r288 r290 7 7 8 8 uses 9 Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, Graphics; 9 Protocol, Database, dynlibs, Platform, dateutils, fgl, LazFileUtils, 10 Graphics; 10 11 11 12 const … … 289 290 FreeLibrary(hm); 290 291 end; 291 PlayersBrain.Free;292 bix.Free;293 Brains.Free;292 FreeAndNil(PlayersBrain); 293 FreeAndNil(bix); 294 FreeAndNil(Brains); 294 295 end; 295 296 … … 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 … … 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.