Ignore:
Timestamp:
Mar 9, 2021, 9:19:49 AM (3 years ago)
Author:
chronos
Message:
  • Modified: Synced code with current trunk version.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/highdpi/Start.pas

    r248 r303  
    4848    Bitmap: TDpiBitmap; { game world sample preview }
    4949    Size: TPoint;
    50     Colors: array [0 .. $1f, 0 .. 1] of TColor;
     50    Colors: array [0 .. 11, 0 .. 1] of TColor;
    5151    Mode: TMiniMode;
    5252    procedure LoadFromLogFile(FileName: string; var LastTurn: Integer);
     
    143143    DefaultAI: string;
    144144    MiniMap: TMiniMap;
     145    LastGame: string;
    145146    procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string);
    146147    procedure InitPopup(PlayerIndex: Integer);
     
    165166
    166167uses
    167   Global, Directories, Direct, ScreenTools, Inp, Back, Locale, UPixelPointer;
     168  Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UPixelPointer;
    168169
    169170{$R *.lfm}
     
    241242begin
    242243  FreeAndNil(Bitmap);
    243   inherited Destroy;
     244  inherited;
    244245end;
    245246
     
    297298  ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png';
    298299  Mode := mmPicture;
    299   if LoadGraphicFile(Bitmap, ImageFileName, gfNoError) then
     300  if LoadGraphicFile(Bitmap, ImageFileName, [gfNoError]) then
    300301  begin
    301302    if Bitmap.width div 2 > MaxWidthMapLogo then
     
    461462      Brains.GetByKind(btAI, AIBrains);
    462463      BrainDefault := Brains[0];
    463       AIBrains.Free;
     464      FreeAndNil(AIBrains);
    464465    end; // default AI not found, use any
    465466
     
    536537  FormerGames := TStringList.Create;
    537538  UpdateFormerGames;
    538   ShowTab := tbNew; // always start with new book page
    539539  MapFileName := '';
    540540  Maps := TStringList.Create;
     
    616616    if ValueExists('AutoDiff') then AutoDiff := Reg.ReadInteger('AutoDiff')
    617617      else AutoDiff := 1;
     618    if ValueExists('StartTab') then ShowTab := TStartTab(Reg.ReadInteger('StartTab'))
     619       else ShowTab := tbNew;
     620    if ValueExists('LastGame') then LastGame := Reg.ReadString('LastGame')
     621       else LastGame := '';
    618622
    619623    if ValueExists('ScreenMode') then
     
    656660      else WriteInteger('ScreenMode', 0);
    657661    WriteInteger('MultiControl', MultiControl);
     662    WriteInteger('StartTab', Integer(ShowTab));
     663    WriteString('LastGame', LastGame);
    658664  finally
    659665    Free;
     
    671677  with AIBrains[I] do begin
    672678    if not LoadGraphicFile(AIBrains[i].Picture, GetAiDir + DirectorySeparator +
    673       FileName + DirectorySeparator + FileName + '.png', gfNoError) then begin
     679      FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin
    674680      with AIBrains[i].Picture.Canvas do begin
    675681        Brush.Color := $904830;
     
    683689    end;
    684690  end;
    685   AIBrains.Free;
     691  FreeAndNil(AIBrains);
    686692end;
    687693
     
    13961402      if AIBrains[I].Flags and fMultiple <> 0 then
    13971403        OfferBrain(AIBrains[I], FixedLines);
    1398     AIBrains.Free;
     1404    FreeAndNil(AIBrains);
    13991405  end else begin
    14001406    FixedLines := 0;
     
    14241430          or (Brains[I] = PlayersBrain[PlayerPopupIndex]) then
    14251431          OfferBrain(AIBrains[i], FixedLines);
    1426       AIBrains.Free;
     1432      FreeAndNil(AIBrains);
    14271433    end;
    14281434  end;
     
    14441450    until FindNext(F) <> 0;
    14451451  FindClose(F);
    1446   ListIndex[tbNew] := FormerGames.Count - 1;
    1447   if (ShowTab = tbNew) and (FormerGames.Count > 0) then
    1448     ShowTab := tbPrevious;
     1452  I := FormerGames.IndexOf(LastGame);
     1453  if I >= 0 then ListIndex[tbPrevious] := I
     1454    else ListIndex[tbPrevious] := FormerGames.Count - 1;
    14491455  TurnValid := False;
    14501456end;
     
    16081614  if Tab <> tbNew then
    16091615    if List.Count > 0 then begin
    1610       if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then
    1611         List.ItemIndex := ListIndex[Tab]
    1612         else List.ItemIndex := 0;
     1616      if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then begin
     1617        List.ItemIndex := ListIndex[Tab];
     1618      end else List.ItemIndex := 0;
    16131619    end else List.ItemIndex := -1;
    16141620  case Tab of
     
    16501656      maConfig:
    16511657        begin
    1652           LocaleDlg := TLocaleDlg.Create(nil);
    1653           if LocaleDlg.ShowModal = mrOk then begin
     1658          SettingsDlg := TSettingsDlg.Create(nil);
     1659          if SettingsDlg.ShowModal = mrOk then begin
    16541660            LoadAssets;
    16551661            Invalidate;
     
    16571663            Background.UpdateInterface;
    16581664          end;
    1659           FreeAndNil(LocaleDlg);
     1665          FreeAndNil(SettingsDlg);
    16601666        end;
    16611667      maManual:
     
    19531959  ShowTab := Tab;
    19541960  Background.Enabled := True;
     1961  LastGame := FormerGames[ListIndex[tbPrevious]];
    19551962end;
    19561963
     
    19631970  Shift: TShiftState);
    19641971begin
    1965   if (Shift = []) and (Key = VK_F1) then
     1972  if KeyToShortCut(Key, Shift) = VK_F1 then
    19661973    DirectHelp(cStartHelp);
    19671974end;
Note: See TracChangeset for help on using the changeset viewer.