Changeset 457 for trunk/GameServer.pas


Ignore:
Timestamp:
Nov 27, 2023, 12:10:57 AM (12 months ago)
Author:
chronos
Message:
  • Modified: Use enumeration type in Help unit for better readability.
  • Fixed: Corruption external help image referenced with incorrect file name case.
  • Fixed: Chinese translation converted to UTF-8.
  • Modified: Code cleanup.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GameServer.pas

    r456 r457  
    551551    MapFile.Position := 0;
    552552    S := 'cEvoMap'#0;
    553     MapFile.write(S[1], 8); { file id }
     553    MapFile.Write(S[1], 8); { file id }
    554554    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);
    560560  finally
    561561    FreeAndNil(MapFile);
     
    574574    MapFile := TFileStream.Create(FileName, fmOpenRead or fmShareExclusive);
    575575    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 }
    578578    if I = 0 then
    579579    begin
    580       MapFile.read(I, 4); // MaxTurn
    581       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);
    583583      ly := ly and not 1;
    584584      if lx > lxmax then
     
    587587        ly := lymax;
    588588      MapSize := lx * ly;
    589       MapFile.read(RealMap, MapSize * 4);
     589      MapFile.Read(RealMap, MapSize * 4);
    590590      for Loc1 := 0 to MapSize - 1 do
    591591      begin
     
    609609end;
    610610
    611 procedure SaveGame(FileName: string; auto: Boolean);
     611procedure SaveGame(FileName: string; Auto: Boolean);
    612612var
    613613  X, Y, I, zero, Tile, nLocal: Integer;
     
    631631      end;
    632632
    633   if auto and AutoSaveExists then // append to existing file
     633  if Auto and AutoSaveExists then // append to existing file
    634634    LogFile := TFileStream.Create(SavePath + FileName, fmOpenReadWrite or
    635635      fmShareExclusive)
     
    641641  LogFile.Position := 0;
    642642  S := 'cEvoBook';
    643   LogFile.write(S[1], 8); { file id }
     643  LogFile.Write(S[1], 8); { file id }
    644644  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);
    650650  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);
    656656  if nLocal > 1 then // multiplayer game -- no quick view
    657657  begin
    658658    I := $80;
    659     LogFile.write(I, 4);
     659    LogFile.Write(I, 4);
    660660  end
    661661  else
    662     LogFile.write(SaveMap, ((MapSize - 1) div 4 + 1) * 4);
     662    LogFile.Write(SaveMap, ((MapSize - 1) div 4 + 1) * 4);
    663663  for I := 0 to nPl - 1 do
    664664    if not Assigned(bix[I]) then
    665       LogFile.write(zero, 4)
     665      LogFile.Write(zero, 4)
    666666    else
    667667    begin
     
    671671        S := PlayersBrain[I].FileName;
    672672      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);
    675675      S := ''; { behavior }
    676676      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);
    679679    end;
    680680
    681   if auto and AutoSaveExists then
     681  if Auto and AutoSaveExists then
    682682    CL.AppendToFile(LogFile, AutoSaveState)
    683683  else
    684684    CL.SaveToFile(LogFile);
    685685  FreeAndNil(LogFile);
    686   if auto then
     686  if Auto then
    687687  begin
    688688    AutoSaveState := CL.State;
     
    11391139    LogFile.Read(SaveMap, 4);
    11401140    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);
    11421142    for p1 := 0 to nPl - 1 do
    11431143    begin
Note: See TracChangeset for help on using the changeset viewer.