Changeset 283 for trunk/Start.pas


Ignore:
Timestamp:
Sep 30, 2020, 11:57:40 AM (4 years ago)
Author:
chronos
Message:
  • Fixed: Remember last selected game.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Start.pas

    r282 r283  
    143143    DefaultAI: string;
    144144    MiniMap: TMiniMap;
     145    LastGame: string;
    145146    procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string);
    146147    procedure InitPopup(PlayerIndex: Integer);
     
    626627    if ValueExists('StartTab') then ShowTab := TStartTab(Reg.ReadInteger('StartTab'))
    627628       else ShowTab := tbNew;
     629    if ValueExists('LastGame') then LastGame := Reg.ReadString('LastGame')
     630       else LastGame := '';
    628631
    629632    if ValueExists('ScreenMode') then
     
    667670    WriteInteger('MultiControl', MultiControl);
    668671    WriteInteger('StartTab', Integer(ShowTab));
     672    WriteString('LastGame', LastGame);
    669673  finally
    670674    Free;
     
    14551459    until FindNext(F) <> 0;
    14561460  FindClose(F);
    1457   ListIndex[tbNew] := FormerGames.Count - 1;
     1461  I := FormerGames.IndexOf(LastGame);
     1462  if I >= 0 then ListIndex[tbPrevious] := I
     1463    else ListIndex[tbPrevious] := FormerGames.Count - 1;
    14581464  TurnValid := False;
    14591465end;
     
    16171623  if Tab <> tbNew then
    16181624    if List.Count > 0 then begin
    1619       if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then
    1620         List.ItemIndex := ListIndex[Tab]
    1621         else List.ItemIndex := 0;
     1625      if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then begin
     1626        List.ItemIndex := ListIndex[Tab];
     1627      end else List.ItemIndex := 0;
    16221628    end else List.ItemIndex := -1;
    16231629  case Tab of
     
    19621968  ShowTab := Tab;
    19631969  Background.Enabled := True;
     1970  LastGame := FormerGames[ListIndex[tbPrevious]];
    19641971end;
    19651972
Note: See TracChangeset for help on using the changeset viewer.