Changeset 377 for trunk/Game.pas


Ignore:
Timestamp:
Jan 3, 2025, 11:20:28 PM (4 days ago)
Author:
chronos
Message:
  • Fixed: Map image was not always loaded and applied.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Game.pas

    r360 r377  
    8686    StoredRandSeed: Cardinal;
    8787    GeneratePlayers: Boolean;
    88     procedure PostConfig;
    8988    procedure Assign(Source: TGame);
    9089    function AttackProbability(AttackCount, DefendCount: Integer): Double;
     
    297296  Cell: TCell;
    298297begin
     298  // Load map image
     299  if (Map.Shape = msImage) then begin
     300    if LoadedImageFileName <> MapImageFileName then begin
     301      LoadedImageFileName := MapImageFileName;
     302      if FileExists(MapImageFileName) then begin
     303        Map.Image.Picture.LoadFromFile(MapImageFileName)
     304      end else begin
     305        LoadedImageFileName := '';
     306        Map.Image.Picture.Clear;
     307      end;
     308    end;
     309  end;
     310
    299311  // Randomize map terrain
    300312  for Cell in Map.Cells do
     
    376388end;
    377389
    378 procedure TGame.PostConfig;
    379 begin
    380   if (Map.Shape = msImage) and FileExists(MapImageFileName) and
    381   (LoadedImageFileName <> MapImageFileName) then begin
    382     LoadedImageFileName := MapImageFileName;
    383     Map.Image.Picture.LoadFromFile(MapImageFileName);
    384   end;
    385 end;
    386 
    387390procedure TGame.SelectPlayerStartCell(Player: TPlayer);
    388391var
     
    502505  Map.Assign(Source.Map);
    503506  MapImageFileName := Source.MapImageFileName;
     507  LoadedImageFileName := Source.LoadedImageFileName;
    504508  VoidEnabled := Source.VoidEnabled;
    505509  VoidPercentage := Source.VoidPercentage;
Note: See TracChangeset for help on using the changeset viewer.