Changeset 381 for trunk


Ignore:
Timestamp:
Apr 25, 2021, 11:00:24 AM (4 years ago)
Author:
chronos
Message:
  • Fixed: Error if map without map picture was renamed.
  • Fixed: Copy default map files and example saved game only once if such target directories don't exist yet.
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Global.pas

    r364 r381  
    66  CevoExt = '.cevo';
    77  CevoMapExt = '.cevomap';
     8  CevoMapPictureExt = '.png';
    89  CevoTribeExt = '.tribe.txt';
    910  CevoHomepageShort = 'app.zdechov.net/c-evo';
  • trunk/Packages/CevoComponents/Directories.pas

    r379 r381  
    7979end;
    8080
     81procedure CopyFiles;
     82begin
     83  if DirectoryExists(GetSavedDir(True)) and not DirectoryExists(GetSavedDir(False)) then
     84    CopyDir(GetSavedDir(True), GetSavedDir(False), '*.*');
     85  if DirectoryExists(GetMapsDir(True)) and not DirectoryExists(GetMapsDir(False)) then
     86    CopyDir(GetMapsDir(True), GetMapsDir(False), '*.*');
     87end;
     88
    8189procedure UnitInit;
    8290var
     
    8795
    8896  AppDataDir := GetAppConfigDir(False);
    89   if AppDataDir = '' then
    90     DataDir := HomeDir
    91   else
    92   begin
     97  if AppDataDir = '' then DataDir := HomeDir
     98  else begin
    9399    if not DirectoryExists(AppDataDir) then ForceDirectories(AppDataDir);
    94100    DataDir := AppDataDir;
    95101  end;
    96 
    97   CopyDir(GetSavedDir(True), GetSavedDir(False), '*.*');
    98   CopyDir(GetMapsDir(True), GetMapsDir(False), '*.*');
     102  CopyFiles;
    99103end;
    100104
  • trunk/Start.pas

    r373 r381  
    16241624  f: file;
    16251625  ok: boolean;
     1626  MapPictureFileName: string;
    16261627begin
    16271628  if List.ItemIndex >= 0 then
     
    16441645        begin
    16451646          SimpleMessage(Format(Phrases.Lookup('NOFILENAME'), [NewName[i]]));
    1646           exit
     1647          Exit;
    16471648        end;
    16481649      if Page = pgLoad then
     
    16591660      except
    16601661        // Play('INVALID');
    1661         ok := false
    1662       end;
    1663       if Page <> pgLoad then
    1664         try // rename map picture
     1662        ok := False;
     1663      end;
     1664      if Page <> pgLoad then begin
     1665        // Rename map picture
     1666        MapPictureFileName := GetMapsDir + DirectorySeparator +
     1667          List.Items[List.ItemIndex] + CevoMapPictureExt;
     1668        if FileExists(MapPictureFileName) then
     1669        try
    16651670          AssignFile(f, GetMapsDir + DirectorySeparator + List.Items[List.ItemIndex]
    1666             + '.png');
    1667           Rename(f, GetMapsDir + DirectorySeparator + NewName + '.png');
     1671            + CevoMapPictureExt);
     1672          Rename(f, GetMapsDir + DirectorySeparator + NewName + CevoMapPictureExt);
    16681673        except
    16691674        end;
    1670       if ok then
    1671       begin
     1675      end;
     1676      if ok then begin
    16721677        if Page = pgLoad then
    16731678          FormerGames[List.ItemIndex] := NewName
  • trunk/UMiniMap.pas

    r328 r381  
    115115  ImageFileName: string;
    116116begin
    117   ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png';
     117  ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + CevoMapPictureExt;
    118118  Mode := mmPicture;
    119119  if LoadGraphicFile(Bitmap, ImageFileName, [gfNoError]) then
Note: See TracChangeset for help on using the changeset viewer.