Changeset 303 for branches/highdpi/Start.pas
- Timestamp:
- Mar 9, 2021, 9:19:49 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/highdpi/Start.pas
r248 r303 48 48 Bitmap: TDpiBitmap; { game world sample preview } 49 49 Size: TPoint; 50 Colors: array [0 .. $1f, 0 .. 1] of TColor;50 Colors: array [0 .. 11, 0 .. 1] of TColor; 51 51 Mode: TMiniMode; 52 52 procedure LoadFromLogFile(FileName: string; var LastTurn: Integer); … … 143 143 DefaultAI: string; 144 144 MiniMap: TMiniMap; 145 LastGame: string; 145 146 procedure DrawAction(y, IconIndex: integer; HeaderItem, TextItem: string); 146 147 procedure InitPopup(PlayerIndex: Integer); … … 165 166 166 167 uses 167 Global, Directories, Direct, ScreenTools, Inp, Back, Locale, UPixelPointer;168 Global, Directories, Direct, ScreenTools, Inp, Back, Settings, UPixelPointer; 168 169 169 170 {$R *.lfm} … … 241 242 begin 242 243 FreeAndNil(Bitmap); 243 inherited Destroy;244 inherited; 244 245 end; 245 246 … … 297 298 ImageFileName := Copy(FileName, 1, Length(FileName) - Length(CevoMapExt)) + '.png'; 298 299 Mode := mmPicture; 299 if LoadGraphicFile(Bitmap, ImageFileName, gfNoError) then300 if LoadGraphicFile(Bitmap, ImageFileName, [gfNoError]) then 300 301 begin 301 302 if Bitmap.width div 2 > MaxWidthMapLogo then … … 461 462 Brains.GetByKind(btAI, AIBrains); 462 463 BrainDefault := Brains[0]; 463 AIBrains.Free;464 FreeAndNil(AIBrains); 464 465 end; // default AI not found, use any 465 466 … … 536 537 FormerGames := TStringList.Create; 537 538 UpdateFormerGames; 538 ShowTab := tbNew; // always start with new book page539 539 MapFileName := ''; 540 540 Maps := TStringList.Create; … … 616 616 if ValueExists('AutoDiff') then AutoDiff := Reg.ReadInteger('AutoDiff') 617 617 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 := ''; 618 622 619 623 if ValueExists('ScreenMode') then … … 656 660 else WriteInteger('ScreenMode', 0); 657 661 WriteInteger('MultiControl', MultiControl); 662 WriteInteger('StartTab', Integer(ShowTab)); 663 WriteString('LastGame', LastGame); 658 664 finally 659 665 Free; … … 671 677 with AIBrains[I] do begin 672 678 if not LoadGraphicFile(AIBrains[i].Picture, GetAiDir + DirectorySeparator + 673 FileName + DirectorySeparator + FileName + '.png', gfNoError) then begin679 FileName + DirectorySeparator + FileName + '.png', [gfNoError]) then begin 674 680 with AIBrains[i].Picture.Canvas do begin 675 681 Brush.Color := $904830; … … 683 689 end; 684 690 end; 685 AIBrains.Free;691 FreeAndNil(AIBrains); 686 692 end; 687 693 … … 1396 1402 if AIBrains[I].Flags and fMultiple <> 0 then 1397 1403 OfferBrain(AIBrains[I], FixedLines); 1398 AIBrains.Free;1404 FreeAndNil(AIBrains); 1399 1405 end else begin 1400 1406 FixedLines := 0; … … 1424 1430 or (Brains[I] = PlayersBrain[PlayerPopupIndex]) then 1425 1431 OfferBrain(AIBrains[i], FixedLines); 1426 AIBrains.Free;1432 FreeAndNil(AIBrains); 1427 1433 end; 1428 1434 end; … … 1444 1450 until FindNext(F) <> 0; 1445 1451 FindClose(F); 1446 ListIndex[tbNew] := FormerGames.Count - 1;1447 if (ShowTab = tbNew) and (FormerGames.Count > 0) then1448 ShowTab := tbPrevious;1452 I := FormerGames.IndexOf(LastGame); 1453 if I >= 0 then ListIndex[tbPrevious] := I 1454 else ListIndex[tbPrevious] := FormerGames.Count - 1; 1449 1455 TurnValid := False; 1450 1456 end; … … 1608 1614 if Tab <> tbNew then 1609 1615 if List.Count > 0 then begin 1610 if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then 1611 List.ItemIndex := ListIndex[Tab] 1612 1616 if (ListIndex[Tab] < List.Count) and (ListIndex[Tab] >= 0) then begin 1617 List.ItemIndex := ListIndex[Tab]; 1618 end else List.ItemIndex := 0; 1613 1619 end else List.ItemIndex := -1; 1614 1620 case Tab of … … 1650 1656 maConfig: 1651 1657 begin 1652 LocaleDlg := TLocaleDlg.Create(nil);1653 if LocaleDlg.ShowModal = mrOk then begin1658 SettingsDlg := TSettingsDlg.Create(nil); 1659 if SettingsDlg.ShowModal = mrOk then begin 1654 1660 LoadAssets; 1655 1661 Invalidate; … … 1657 1663 Background.UpdateInterface; 1658 1664 end; 1659 FreeAndNil( LocaleDlg);1665 FreeAndNil(SettingsDlg); 1660 1666 end; 1661 1667 maManual: … … 1953 1959 ShowTab := Tab; 1954 1960 Background.Enabled := True; 1961 LastGame := FormerGames[ListIndex[tbPrevious]]; 1955 1962 end; 1956 1963 … … 1963 1970 Shift: TShiftState); 1964 1971 begin 1965 if (Shift = []) and (Key = VK_F1)then1972 if KeyToShortCut(Key, Shift) = VK_F1 then 1966 1973 DirectHelp(cStartHelp); 1967 1974 end;
Note:
See TracChangeset
for help on using the changeset viewer.