Changeset 604 for trunk


Ignore:
Timestamp:
Aug 12, 2024, 5:03:49 PM (4 months ago)
Author:
chronos
Message:
  • Fixed: Error after ending turn of loaded auto saved game.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GameServer.pas

    r592 r604  
    393393end;
    394394
     395const
     396  AutoSavePrefix = '~';
     397
    395398function ToAutoSaveFileName(FileName: string): string;
    396399begin
    397   Result := ExtractFileDir(FileName) + DirectorySeparator + '~' + ExtractFileName(FileName);
     400  if Copy(ExtractFileName(FileName), 1, 1) <> AutoSavePrefix then
     401    Result := ExtractFileDir(FileName) + DirectorySeparator + AutoSavePrefix + ExtractFileName(FileName)
     402    else Result := FileName;
     403end;
     404
     405function FromAutoSaveFileName(FileName: string): string;
     406begin
     407  if Copy(ExtractFileName(FileName), 1, 1) = AutoSavePrefix then
     408    Result := ExtractFileDir(FileName) + DirectorySeparator + Copy(ExtractFileName(FileName), 2, MaxInt)
     409    else Result := FileName;
    398410end;
    399411
     
    401413begin
    402414  FileName := ExtractFileName(FileName);
    403   Result := (Length(FileName) > 0) and (FileName[1] = '~');
     415  Result := (Length(FileName) > 0) and (FileName[1] = AutoSavePrefix);
    404416end;
    405417
     
    12501262  NoLogCityTileChanges;
    12511263  if IsAutoSaveFileName(LogFileName) then begin
    1252     Delete(LogFileName, 1, 1);
     1264    LogFileName := FromAutoSaveFileName(LogFileName);
    12531265    nLogOpened := -1;
    12541266  end
Note: See TracChangeset for help on using the changeset viewer.