Changeset 457 for trunk/GameServer.pas
- Timestamp:
- Nov 27, 2023, 12:10:57 AM (12 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GameServer.pas
r456 r457 551 551 MapFile.Position := 0; 552 552 S := 'cEvoMap'#0; 553 MapFile. write(S[1], 8); { file id }553 MapFile.Write(S[1], 8); { file id } 554 554 I := 0; 555 MapFile. write(I, 4); { format id }556 MapFile. write(MaxTurn, 4);557 MapFile. write(lx, 4);558 MapFile. write(ly, 4);559 MapFile. write(RealMap, MapSize * 4);555 MapFile.Write(I, 4); { format id } 556 MapFile.Write(MaxTurn, 4); 557 MapFile.Write(lx, 4); 558 MapFile.Write(ly, 4); 559 MapFile.Write(RealMap, MapSize * 4); 560 560 finally 561 561 FreeAndNil(MapFile); … … 574 574 MapFile := TFileStream.Create(FileName, fmOpenRead or fmShareExclusive); 575 575 MapFile.Position := 0; 576 MapFile. read(S[1], 8); { file id }577 MapFile. read(I, 4); { format id }576 MapFile.Read(S[1], 8); { file id } 577 MapFile.Read(I, 4); { format id } 578 578 if I = 0 then 579 579 begin 580 MapFile. read(I, 4); // MaxTurn581 MapFile. read(lx, 4);582 MapFile. read(ly, 4);580 MapFile.Read(I, 4); // MaxTurn 581 MapFile.Read(lx, 4); 582 MapFile.Read(ly, 4); 583 583 ly := ly and not 1; 584 584 if lx > lxmax then … … 587 587 ly := lymax; 588 588 MapSize := lx * ly; 589 MapFile. read(RealMap, MapSize * 4);589 MapFile.Read(RealMap, MapSize * 4); 590 590 for Loc1 := 0 to MapSize - 1 do 591 591 begin … … 609 609 end; 610 610 611 procedure SaveGame(FileName: string; auto: Boolean);611 procedure SaveGame(FileName: string; Auto: Boolean); 612 612 var 613 613 X, Y, I, zero, Tile, nLocal: Integer; … … 631 631 end; 632 632 633 if auto and AutoSaveExists then // append to existing file633 if Auto and AutoSaveExists then // append to existing file 634 634 LogFile := TFileStream.Create(SavePath + FileName, fmOpenReadWrite or 635 635 fmShareExclusive) … … 641 641 LogFile.Position := 0; 642 642 S := 'cEvoBook'; 643 LogFile. write(S[1], 8); { file id }643 LogFile.Write(S[1], 8); { file id } 644 644 I := CevoVersion; 645 LogFile. write(I, 4); { c-evo version }646 LogFile. write(ExeInfo.Time, 4);647 LogFile. write(lx, 4);648 LogFile. write(ly, 4);649 LogFile. write(LandMass, 4);645 LogFile.Write(I, 4); { c-evo version } 646 LogFile.Write(ExeInfo.Time, 4); 647 LogFile.Write(lx, 4); 648 LogFile.Write(ly, 4); 649 LogFile.Write(LandMass, 4); 650 650 if LandMass = 0 then 651 LogFile. write(MapField^, MapSize * 4);652 653 LogFile. write(MaxTurn, 4);654 LogFile. write(RND, 4);655 LogFile. write(GTurn, 4);651 LogFile.Write(MapField^, MapSize * 4); 652 653 LogFile.Write(MaxTurn, 4); 654 LogFile.Write(RND, 4); 655 LogFile.Write(GTurn, 4); 656 656 if nLocal > 1 then // multiplayer game -- no quick view 657 657 begin 658 658 I := $80; 659 LogFile. write(I, 4);659 LogFile.Write(I, 4); 660 660 end 661 661 else 662 LogFile. write(SaveMap, ((MapSize - 1) div 4 + 1) * 4);662 LogFile.Write(SaveMap, ((MapSize - 1) div 4 + 1) * 4); 663 663 for I := 0 to nPl - 1 do 664 664 if not Assigned(bix[I]) then 665 LogFile. write(zero, 4)665 LogFile.Write(zero, 4) 666 666 else 667 667 begin … … 671 671 S := PlayersBrain[I].FileName; 672 672 Move(zero, S[Length(S) + 1], 4); 673 LogFile. write(S, (Length(S) div 4 + 1) * 4);674 LogFile. write(OriginalDataVersion[I], 4);673 LogFile.Write(S, (Length(S) div 4 + 1) * 4); 674 LogFile.Write(OriginalDataVersion[I], 4); 675 675 S := ''; { behavior } 676 676 Move(zero, S[Length(S) + 1], 4); 677 LogFile. write(S, (Length(S) div 4 + 1) * 4);678 LogFile. write(Difficulty[I], 4);677 LogFile.Write(S, (Length(S) div 4 + 1) * 4); 678 LogFile.Write(Difficulty[I], 4); 679 679 end; 680 680 681 if auto and AutoSaveExists then681 if Auto and AutoSaveExists then 682 682 CL.AppendToFile(LogFile, AutoSaveState) 683 683 else 684 684 CL.SaveToFile(LogFile); 685 685 FreeAndNil(LogFile); 686 if auto then686 if Auto then 687 687 begin 688 688 AutoSaveState := CL.State; … … 1139 1139 LogFile.Read(SaveMap, 4); 1140 1140 if SaveMap[0] <> $80 then 1141 LogFile. read(SaveMap[4], ((MapSize - 1) div 4 + 1) * 4 - 4);1141 LogFile.Read(SaveMap[4], ((MapSize - 1) div 4 + 1) * 4 - 4); 1142 1142 for p1 := 0 to nPl - 1 do 1143 1143 begin
Note:
See TracChangeset
for help on using the changeset viewer.