Changeset 233 for trunk/UGame.pas


Ignore:
Timestamp:
Sep 19, 2018, 3:20:20 PM (6 years ago)
Author:
chronos
Message:
  • Fixed: Map type Image wasn't using loaded image from file on repeated new game creation.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/UGame.pas

    r231 r233  
    77uses
    88  Classes, SysUtils, ExtCtrls, Graphics, XMLConf, XMLRead, XMLWrite, Forms,
    9   DOM, Math, LazFileUtils, UXMLUtils, Dialogs, Types, LCLType, LCLIntf, fgl,
     9  DOM, Math, LazFileUtils, UXMLUtils, Dialogs, LCLType, LCLIntf, fgl,
    1010  UGeometry, UPlayer, UMap, UMapType;
    1111
     
    7777    BridgeEnabled: Boolean;
    7878    MaxPower: Integer;
     79    procedure PostConfig;
    7980    procedure Assign(Source: TGame);
    8081    function AttackProbability(AttackCount, DefendCount: Integer): Double;
     
    273274  Cell: TCell;
    274275begin
    275   if (Map.Shape = msImage) and FileExists(MapImageFileName) and
    276   (LoadedImageFileName <> MapImageFileName) then begin
    277     LoadedImageFileName := MapImageFileName;
    278     Map.Image.Picture.LoadFromFile(MapImageFileName);
    279   end;
    280 
    281276  // Randomize map terrain
    282277  for Cell in Map.Cells do
     
    290285    Power := Random(MaxNeutralUnits + 1);
    291286    Player := nil;
     287  end;
     288end;
     289
     290procedure TGame.PostConfig;
     291begin
     292  if (Map.Shape = msImage) and FileExists(MapImageFileName) and
     293  (LoadedImageFileName <> MapImageFileName) then begin
     294    LoadedImageFileName := MapImageFileName;
     295    Map.Image.Picture.LoadFromFile(MapImageFileName);
    292296  end;
    293297end;
Note: See TracChangeset for help on using the changeset viewer.