Ignore:
Timestamp:
Nov 28, 2023, 3:16:24 PM (5 months ago)
Author:
chronos
Message:
  • Modified: Do not initialize all local player windows at the start of the game but later when they are really opened. This also fixes window initialization under Qt5 widgetset.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Term.pas

    r457 r460  
    1414  LCLIntf, LCLType, SysUtils, Classes, Graphics, Controls, DrawDlg, Types,
    1515  Forms, Menus, ExtCtrls, dateutils, Platform, ButtonB, ButtonC, EOTButton, Area,
    16   GraphicSet, MiniMap, IsoEngine;
     16  GraphicSet, MiniMap, IsoEngine, Wonders, TechTree, Enhance, Nego, CityType,
     17  Diagram, CityScreen, Rates, Battle, NatStat, UnitStat, Draft, Select, MessgEx,
     18  Help;
    1719
    1820const
     
    324326    NoMap: TIsoMap;
    325327    NoMapPanel: TIsoMap;
     328    // Forms
     329    FWondersDlg: TWondersDlg;
     330    FTechTreeDlg: TTechTreeDlg;
     331    FEnhanceDlg: TEnhanceDlg;
     332    FNegoDlg: TNegoDlg;
     333    FCityTypeDlg: TCityTypeDlg;
     334    FDiaDlg: TDiaDlg;
     335    FCityDlg: TCityDlg;
     336    FRatesDlg: TRatesDlg;
     337    FBattleDlg: TBattleDlg;
     338    FNatStatDlg: TNatStatDlg;
     339    FUnitStatDlg: TUnitStatDlg;
     340    FDraftDlg: TDraftDlg;
     341    FModalSelectDlg: TModalSelectDlg;
     342    FListDlg: TListDlg;
     343    FMessgExDlg: TMessgExDlg;
     344    FHelpDlg: THelpDlg;
     345    procedure ArrangeDialogs;
     346    procedure ArrangeDialog(Form: TBufferedDrawDlg);
    326347    function ChooseUnusedTribe: Integer;
    327348    function DoJob(j0: Integer): Integer;
     349    function GetBattleDlg: TBattleDlg;
     350    function GetCityDlg: TCityDlg;
     351    function GetCityTypeDlg: TCityTypeDlg;
     352    function GetDiaDlg: TDiaDlg;
     353    function GetDraftDlg: TDraftDlg;
     354    function GetEnhanceDlg: TEnhanceDlg;
     355    function GetHelpDlg: THelpDlg;
     356    function GetListDlg: TListDlg;
     357    function GetMessgExDlg: TMessgExDlg;
     358    function GetModalSelectDlg: TModalSelectDlg;
     359    function GetNatStatDlg: TNatStatDlg;
     360    function GetNegoDlg: TNegoDlg;
     361    function GetRatesDlg: TRatesDlg;
     362    function GetTechTreeDlg: TTechTreeDlg;
    328363    procedure GetTribeList;
     364    function GetUnitStatDlg: TUnitStatDlg;
     365    function GetWondersDlg: TWondersDlg;
    329366    procedure InitModule;
    330367    procedure DoneModule;
     
    397434    procedure UpdateViews(UpdateCityScreen: Boolean = False);
    398435    function ContactRefused(P: Integer; Item: String): Boolean;
     436    // Forms
     437    property WondersDlg: TWondersDlg read GetWondersDlg;
     438    property TechTreeDlg: TTechTreeDlg read GetTechTreeDlg;
     439    property EnhanceDlg: TEnhanceDlg read GetEnhanceDlg;
     440    property NegoDlg: TNegoDlg read GetNegoDlg;
     441    property CityTypeDlg: TCityTypeDlg read GetCityTypeDlg;
     442    property DiaDlg: TDiaDlg read GetDiaDlg;
     443    property CityDlg: TCityDlg read GetCityDlg;
     444    property RatesDlg: TRatesDlg read GetRatesDlg;
     445    property BattleDlg: TBattleDlg read GetBattleDlg;
     446    property NatStatDlg: TNatStatDlg read GetNatStatDlg;
     447    property UnitStatDlg: TUnitStatDlg read GetUnitStatDlg;
     448    property DraftDlg: TDraftDlg read GetDraftDlg;
     449    property ModalSelectDlg: TModalSelectDlg read GetModalSelectDlg;
     450    property ListDlg: TListDlg read GetListDlg;
     451    property MessgExDlg: TMessgExDlg read GetMessgExDlg;
     452    property HelpDlg: THelpDlg read GetHelpDlg;
    399453  end;
    400454
     
    428482  end;
    429483
    430   TPriceSet = set of $00 .. $FF;
    431484  TFormAction = (faClose, faEnable, faDisable, faUpdate, faSmartUpdateContent);
    432485
     
    579632function InitEnemyModel(emix: Integer): Boolean;
    580633procedure InitAllEnemyModels;
    581 procedure InitMyModel(mix: Integer; final: Boolean);
     634procedure InitMyModel(Mix: Integer; Final: Boolean);
    582635
    583636procedure ImpImage(ca: TCanvas; X, Y, iix: Integer; Government: Integer = -1;
     
    590643
    591644uses
    592   Directories, CityScreen, Draft, MessgEx, Select, CityType, Help,
    593   UnitStat, Log, Diagram, NatStat, Wonders, Enhance, Nego, PixelPointer, Sound,
    594   Battle, Rates, TechTree, Registry, Global, KeyBindings, CmdList;
     645  Directories, Log, PixelPointer, Sound, Registry, Global, KeyBindings, CmdList;
    595646
    596647{$R *.lfm}
     
    762813begin
    763814  if MyMap[Loc] and fDeadLands <> 0 then
    764     HelpDlg.ShowNewContent(NewMode, hkTer, 3 * 12)
     815    MainScreen.HelpDlg.ShowNewContent(NewMode, hkTer, 3 * 12)
    765816  else if (MyMap[Loc] and fTerrain = fForest) and IsJungle(Loc div G.lx) then
    766     HelpDlg.ShowNewContent(NewMode, hkTer,
     817    MainScreen.HelpDlg.ShowNewContent(NewMode, hkTer,
    767818      fJungle + (MyMap[Loc] shr 5 and 3) * 12)
    768819  else
    769     HelpDlg.ShowNewContent(NewMode, hkTer, MyMap[Loc] and fTerrain +
     820    MainScreen.HelpDlg.ShowNewContent(NewMode, hkTer, MyMap[Loc] and fTerrain +
    770821      (MyMap[Loc] shr 5 and 3) * 12);
    771822end;
     
    864915end;
    865916
    866 procedure InitMyModel(mix: Integer; final: Boolean);
     917procedure InitMyModel(Mix: Integer; Final: Boolean);
    867918var
    868919  mi: TModelInfo;
     
    871922    Exit;
    872923  // don't exit for special units because cSetModelPicture comes after TellNewModels
    873   MakeModelInfo(Me, mix, MyModel[mix], mi);
    874   ChooseModelPicture(Me, mix, ModelCode(mi), ModelHash(mi), MyRO.Turn,
    875     False, final);
     924  MakeModelInfo(Me, Mix, MyModel[mix], mi);
     925  ChooseModelPicture(Me, Mix, ModelCode(mi), ModelHash(mi), MyRO.Turn,
     926    False, Final);
    876927end;
    877928
     
    9531004        InitMyModel(MyData.ToldModels, True);
    9541005      { only run if no researched model }
    955       with MessgExDlg do
     1006      with MainScreen.MessgExDlg do
    9561007      begin
    9571008        { MakeModelInfo(me,MyData.ToldModels,MyModel[MyData.ToldModels],mi);
     
    11571208    { research complete -- select new }
    11581209    repeat
    1159       ModalSelectDlg.ShowNewContent(wmModal, kAdvance);
    1160       if ModalSelectDlg.Result < 0 then
     1210      MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kAdvance);
     1211      if MainScreen.ModalSelectDlg.Result < 0 then
    11611212      begin
    11621213        Result := False;
    11631214        Exit;
    11641215      end;
    1165       ChosenResearch := ModalSelectDlg.Result;
     1216      ChosenResearch := MainScreen.ModalSelectDlg.Result;
    11661217      if ChosenResearch = adMilitary then
    11671218      begin
    1168         DraftDlg.ShowNewContent(wmModal);
    1169         if DraftDlg.ModalResult <> mrOK then
     1219        MainScreen.DraftDlg.ShowNewContent(wmModal);
     1220        if MainScreen.DraftDlg.ModalResult <> mrOK then
    11701221          Tribe[Me].ModelPicture[MyRO.nModel].HGr := nil;
    11711222      end;
    1172     until (ChosenResearch <> adMilitary) or (DraftDlg.ModalResult = mrOK);
     1223    until (ChosenResearch <> adMilitary) or (MainScreen.DraftDlg.ModalResult = mrOK);
    11731224
    11741225    if ChosenResearch = adMilitary then
     
    11761227    else if ChosenResearch = adFar then
    11771228    begin
    1178       ModalSelectDlg.ShowNewContent(wmModal, kFarAdvance);
    1179       if ModalSelectDlg.Result >= 0 then
    1180         if (ModalSelectDlg.Result = adNone) or
    1181           (Server(sSetResearch - sExecute, Me, ModalSelectDlg.Result, nil^) <
     1229      MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kFarAdvance);
     1230      if MainScreen.ModalSelectDlg.Result >= 0 then
     1231        if (MainScreen.ModalSelectDlg.Result = adNone) or
     1232          (Server(sSetResearch - sExecute, Me, MainScreen.ModalSelectDlg.Result, nil^) <
    11821233          rExecuted) then
    1183           MyData.FarTech := ModalSelectDlg.Result
     1234          MyData.FarTech := MainScreen.ModalSelectDlg.Result
    11841235        else
    11851236        begin
    1186           ChosenResearch := ModalSelectDlg.Result;
     1237          ChosenResearch := MainScreen.ModalSelectDlg.Result;
    11871238          // can be researched immediately
    11881239          MyData.FarTech := adNone;
     
    11941245  else
    11951246    Server(sSetResearch, Me, ChosenResearch, nil^);
    1196   ListDlg.TechChange;
     1247  MainScreen.ListDlg.TechChange;
    11971248  Result := True;
    11981249end;
     
    15651616    until FindNext(SearchRec) <> 0;
    15661617  FindClose(SearchRec);
     1618end;
     1619
     1620function TMainScreen.GetUnitStatDlg: TUnitStatDlg;
     1621begin
     1622  if not Assigned(FUnitStatDlg) then begin
     1623    FUnitStatDlg := TUnitStatDlg.Create(nil);
     1624    ArrangeDialog(FUnitStatDlg);
     1625    FUnitStatDlg.CheckAge;
     1626  end;
     1627  Result := FUnitStatDlg;
     1628end;
     1629
     1630function TMainScreen.GetWondersDlg: TWondersDlg;
     1631begin
     1632  if not Assigned(FWondersDlg) then FWondersDlg := TWondersDlg.Create(nil);
     1633  Result := FWondersDlg;
    15671634end;
    15681635
     
    17581825  FreeAndNil(UnusedTribeFiles);
    17591826  FreeAndNil(TribeNames);
    1760   // AdvisorDlg.DeInit;
    17611827end;
    17621828
     
    18661932  end;
    18671933  InitCityMark(MainTexture);
    1868   CityDlg.CheckAge;
    1869   NatStatDlg.CheckAge;
    1870   UnitStatDlg.CheckAge;
    1871   HelpDlg.Difficulty := G.Difficulty[Me];
     1934  if Assigned(FCityDlg) then FCityDlg.CheckAge;
     1935  if Assigned(FNatStatDlg) then FNatStatDlg.CheckAge;
     1936  if Assigned(FUnitStatDlg) then FUnitStatDlg.CheckAge;
     1937  if Assigned(FHelpDlg) then FHelpDlg.Difficulty := G.Difficulty[Me];
    18721938
    18731939  UnFocus := -1;
     
    25212587
    25222588  HaveStrategyAdvice := False;
    2523   // (GameMode<>cMovie) and not supervising
    2524   // and AdvisorDlg.HaveStrategyAdvice;
    25252589  GoOnPhase := True;
    25262590  if Supervising or (GameMode = cMovie) then
     
    26282692      begin
    26292693        Server := TInitModuleData(Data).Server;
    2630         // AdvisorDlg.Init;
    26312694        InitModule;
    26322695        TInitModuleData(Data).DataSize := SizeOf(TPersistentData);
     
    26422705          MainTexture.Age := -1;
    26432706        Tribes.Init;
    2644         HelpDlg.UserLeft := (Screen.width - HelpDlg.width) div 2;
    2645         HelpDlg.UserTop := (Screen.height - HelpDlg.height) div 2;
     2707        HelpDlg.UserLeft := (Screen.Width - HelpDlg.Width) div 2;
     2708        HelpDlg.UserTop := (Screen.Height - HelpDlg.Height) div 2;
    26462709        HelpDlg.Difficulty := 0;
    26472710        if Command = cStartCredits then
     
    26542717    cNewGame, cLoadGame, cMovie, cNewMap:
    26552718      begin
    2656         { if (Command=cNewGame) or (Command=cLoadGame) then
    2657           AdvisorDlg.NewGame(Data); }
    26582719        GenerateNames := mNames.Checked;
    26592720        GameOK := True;
     
    26952756                begin
    26962757                  CityID := -1;
    2697                   EffectiveOwner := -1
     2758                  EffectiveOwner := -1;
    26982759                end;
    26992760              FillChar(ToldTech, SizeOf(ToldTech), Byte(tsNA));
     
    27022763            end;
    27032764
    2704         // arrange dialogs
    2705         ListDlg.UserLeft := 8;
    2706         ListDlg.UserTop := TopBarHeight + 8;
    2707         HelpDlg.UserLeft := Screen.width - HelpDlg.width - 8;
    2708         HelpDlg.UserTop := TopBarHeight + 8;
    2709         UnitStatDlg.UserLeft := 397;
    2710         UnitStatDlg.UserTop := TopBarHeight + 64;
    2711         DiaDlg.UserLeft := (Screen.width - DiaDlg.width) div 2;
    2712         DiaDlg.UserTop := (Screen.height - DiaDlg.height) div 2;
    2713         NatStatDlg.UserLeft := Screen.width - NatStatDlg.width - 8;
    2714         NatStatDlg.UserTop := Screen.height - PanelHeight -
    2715           NatStatDlg.height - 8;
    2716         if NatStatDlg.UserTop < 8 then
    2717           NatStatDlg.UserTop := 8;
     2765        ArrangeDialogs;
    27182766
    27192767        Age := 0;
    27202768        MovieSpeed := 1;
    27212769        LogDlg.mSlot.Visible := True;
    2722         LogDlg.Host := self;
    2723         HelpDlg.ClearHistory;
    2724         CityDlg.Reset;
     2770        LogDlg.Host := Self;
     2771        if Assigned(FHelpDlg) then FHelpDlg.ClearHistory;
     2772        if Assigned(FCityDlg) then FCityDlg.Reset;
    27252773
    27262774        MiniMap.Size := Point(G.lx, G.ly);
     
    28312879        Closable := True;
    28322880        Close;
    2833         { if (GameMode=cNewGame) or (GameMode=cLoadGame) then
    2834           AdvisorDlg.BreakGame; }
    28352881      end;
    28362882
     
    28582904        begin
    28592905          StayOnTop_Ensured := True;
    2860           CityDlg.StayOnTop_Workaround;
    2861           CityTypeDlg.StayOnTop_Workaround;
    2862           DiaDlg.StayOnTop_Workaround;
    2863           DraftDlg.StayOnTop_Workaround;
    2864           EnhanceDlg.StayOnTop_Workaround;
    2865           HelpDlg.StayOnTop_Workaround;
    2866           NatStatDlg.StayOnTop_Workaround;
    2867           NegoDlg.StayOnTop_Workaround;
    2868           ModalSelectDlg.StayOnTop_Workaround;
    2869           ListDlg.StayOnTop_Workaround;
    2870           UnitStatDlg.StayOnTop_Workaround;
    2871           WondersDlg.StayOnTop_Workaround;
    2872           RatesDlg.StayOnTop_Workaround;
     2906          //CityDlg.StayOnTop_Workaround;
     2907          //CityTypeDlg.StayOnTop_Workaround;
     2908          //DiaDlg.StayOnTop_Workaround;
     2909          //DraftDlg.StayOnTop_Workaround;
     2910          //EnhanceDlg.StayOnTop_Workaround;
     2911          //HelpDlg.StayOnTop_Workaround;
     2912          //NatStatDlg.StayOnTop_Workaround;
     2913          //NegoDlg.StayOnTop_Workaround;
     2914          //ModalSelectDlg.StayOnTop_Workaround;
     2915          //ListDlg.StayOnTop_Workaround;
     2916          //UnitStatDlg.StayOnTop_Workaround;
     2917          //WondersDlg.StayOnTop_Workaround;
     2918          //RatesDlg.StayOnTop_Workaround;
    28732919        end;
    28742920      end;
     
    29342980            NegoDlg.Visible then
    29352981            NegoDlg.Close;
    2936           skipped := False; // always show my moves during my turn
     2982          Skipped := False; // always show my moves during my turn
    29372983          Idle := True;
    29382984          InitTurn(NewPlayer);
     
    29532999        pTurn := NewPlayer;
    29543000        pLogo := -1;
    2955         skipped := False; // always show my moves during my turn
     3001        Skipped := False; // always show my moves during my turn
    29563002        Idle := True;
    29573003        if FirstMovieTurn then
     
    29783024        ClientMode := -1;
    29793025        Idle := False;
    2980         skipped := False;
     3026        Skipped := False;
    29813027      end;
    29823028
     
    36323678  I: Integer;
    36333679begin
     3680  if Assigned(FWondersDlg) then FreeAndNil(FWondersDlg);
     3681  if Assigned(FTechTreeDlg) then FreeAndNil(FTechTreeDlg);
     3682  if Assigned(FEnhanceDlg) then FreeAndNil(FEnhanceDlg);
     3683  if Assigned(FNegoDlg) then FreeAndNil(FNegoDlg);
     3684  if Assigned(FCityTypeDlg) then FreeAndNil(FCityTypeDlg);
     3685  if Assigned(FDiaDlg) then FreeAndNil(FDiaDlg);
     3686  if Assigned(FCityDlg) then FreeAndNil(FCityDlg);
     3687  if Assigned(FRatesDlg) then FreeAndNil(FRatesDlg);
     3688  if Assigned(FBattleDlg) then FreeAndNil(FBattleDlg);
     3689  if Assigned(FNatStatDlg) then FreeAndNil(FNatStatDlg);
     3690  if Assigned(FUnitStatDlg) then FreeAndNil(FUnitStatDlg);
     3691  if Assigned(FDraftDlg) then FreeAndNil(FDraftDlg);
     3692  if Assigned(FModalSelectDlg) then FreeAndNil(FModalSelectDlg);
     3693  if Assigned(FListDlg) then FreeAndNil(FListDlg);
     3694  if Assigned(FMessgExDlg) then FreeAndNil(FMessgExDlg);
     3695  if Assigned(FHelpDlg) then FreeAndNil(FHelpDlg);
     3696
    36343697  MainFormKeyDown := nil;
    36353698  FreeAndNil(sb);
     
    43404403  end
    43414404  else if ClientMode < 0 then
    4342     skipped := True
     4405    Skipped := True
    43434406  else if ClientMode >= scContact then
    43444407    NegoDlg.ShowNewContent(wmPersistent)
     
    45904653    ClientMode := -1;
    45914654    Idle := False;
    4592     skipped := WasSkipped;
     4655    Skipped := WasSkipped;
    45934656    for p1 := 1 to nPl - 1 do
    45944657      if G.RO[p1] <> nil then
    4595         skipped := True; // don't show enemy moves in hotseat mode
     4658        Skipped := True; // don't show enemy moves in hotseat mode
    45964659  end
    45974660  else
     
    46044667    NegoDlg.Close;
    46054668  HaveStrategyAdvice := False;
    4606   // AdvisorDlg.HaveStrategyAdvice;
    4607   // negotiation might have changed advices
    46084669  EOT.ButtonIndex := eotCancel;
    46094670  EOT.Visible := True;
     
    58165877    Exit;
    58175878
    5818   if CityDlg.Visible then
     5879  if Assigned(FCityDlg) and CityDlg.Visible then
    58195880    CityDlg.Close;
    5820   if UnitStatDlg.Visible then
     5881  if Assigned(FUnitStatDlg) and UnitStatDlg.Visible then
    58215882    UnitStatDlg.Close;
    58225883  MouseLoc := LocationOfScreenPixel(X, Y);
     
    73817442end;
    73827443
     7444function TMainScreen.GetBattleDlg: TBattleDlg;
     7445begin
     7446  if not Assigned(FBattleDlg) then FBattleDlg := TBattleDlg.Create(nil);
     7447  Result := FBattleDlg;
     7448end;
     7449
     7450function TMainScreen.GetCityDlg: TCityDlg;
     7451begin
     7452  if not Assigned(FCityDlg) then begin
     7453    FCityDlg := TCityDlg.Create(nil);
     7454    FCityDlg.CheckAge;
     7455  end;
     7456  Result := FCityDlg;
     7457end;
     7458
     7459function TMainScreen.GetCityTypeDlg: TCityTypeDlg;
     7460begin
     7461  if not Assigned(FCityTypeDlg) then FCityTypeDlg := TCityTypeDlg.Create(nil);
     7462  Result := FCityTypeDlg;
     7463end;
     7464
     7465function TMainScreen.GetDiaDlg: TDiaDlg;
     7466begin
     7467  if not Assigned(FDiaDlg) then begin
     7468    FDiaDlg := TDiaDlg.Create(nil);
     7469    ArrangeDialog(FDiaDlg);
     7470  end;
     7471  Result := FDiaDlg;
     7472end;
     7473
     7474function TMainScreen.GetDraftDlg: TDraftDlg;
     7475begin
     7476  if not Assigned(FDraftDlg) then FDraftDlg := TDraftDlg.Create(nil);
     7477  Result := FDraftDlg;
     7478end;
     7479
     7480function TMainScreen.GetEnhanceDlg: TEnhanceDlg;
     7481begin
     7482  if not Assigned(FEnhanceDlg) then FEnhanceDlg := TEnhanceDlg.Create(nil);
     7483  Result := FEnhanceDlg;
     7484end;
     7485
     7486function TMainScreen.GetHelpDlg: THelpDlg;
     7487begin
     7488  if not Assigned(FHelpDlg) then begin
     7489    FHelpDlg := THelpDlg.Create(nil);
     7490    ArrangeDialog(FHelpDlg);
     7491    FHelpDlg.Difficulty := G.Difficulty[Me];
     7492  end;
     7493  Result := FHelpDlg;
     7494end;
     7495
     7496function TMainScreen.GetListDlg: TListDlg;
     7497begin
     7498  if not Assigned(FListDlg) then begin
     7499    FListDlg := TListDlg.Create(nil);
     7500    ArrangeDialog(FListDlg);
     7501  end;
     7502  Result := FListDlg;
     7503end;
     7504
     7505function TMainScreen.GetMessgExDlg: TMessgExDlg;
     7506begin
     7507  if not Assigned(FMessgExDlg) then FMessgExDlg := TMessgExDlg.Create(nil);
     7508    Result := FMessgExDlg;
     7509end;
     7510
     7511function TMainScreen.GetModalSelectDlg: TModalSelectDlg;
     7512begin
     7513  if not Assigned(FModalSelectDlg) then FModalSelectDlg := TModalSelectDlg.Create(nil);
     7514  Result := FModalSelectDlg;
     7515end;
     7516
     7517function TMainScreen.GetNatStatDlg: TNatStatDlg;
     7518begin
     7519  if not Assigned(FNatStatDlg) then begin
     7520    FNatStatDlg := TNatStatDlg.Create(nil);
     7521    ArrangeDialog(FNatStatDlg);
     7522    FNatStatDlg.CheckAge;
     7523  end;
     7524  Result := FNatStatDlg;
     7525end;
     7526
     7527function TMainScreen.GetNegoDlg: TNegoDlg;
     7528begin
     7529  if not Assigned(FNegoDlg) then FNegoDlg := TNegoDlg.Create(nil);
     7530  Result := FNegoDlg;
     7531end;
     7532
     7533function TMainScreen.GetRatesDlg: TRatesDlg;
     7534begin
     7535  if not Assigned(FRatesDlg) then FRatesDlg := TRatesDlg.Create(nil);
     7536  Result := FRatesDlg;
     7537end;
     7538
     7539function TMainScreen.GetTechTreeDlg: TTechTreeDlg;
     7540begin
     7541  if not Assigned(FTechTreeDlg) then FTechTreeDlg := TTechTreeDlg.Create(nil);
     7542  Result := FTechTreeDlg;
     7543end;
     7544
    73837545procedure TMainScreen.mDisbandOrUtilizeClick(Sender: TObject);
    73847546var
     
    81778339end;
    81788340
    8179 { procedure TMainScreen.AdviceBtnClick;
    8180   var
    8181   OldAdviceLoc: Integer;
    8182   begin
    8183   DestinationMarkON:=False;
    8184   PaintDestination;
    8185   AdvisorDlg.GiveStrategyAdvice;
    8186   OldAdviceLoc:=MainMap.AdviceLoc;
    8187   MainMap.AdviceLoc:=-1;
    8188   PaintLoc(OldAdviceLoc);
    8189   end; }
    8190 
    8191 { procedure TMainScreen.SetAdviceLoc(Loc: integer; AvoidRect: TRect);
    8192   var
    8193   OldAdviceLoc,X,Y: Integer;
    8194   begin
    8195   if Loc<>MainMap.AdviceLoc then
    8196   begin
    8197   if Loc>=0 then
    8198   begin // center
    8199   Y:=Loc div G.lx;
    8200   X:=(Loc+G.lx - AvoidRect.Right div (2*66)) mod G.lx;
    8201   Centre(Y*G.lx+X);
    8202   PaintAllMaps;
    8203   end;
    8204   OldAdviceLoc:=MainMap.AdviceLoc;
    8205   MainMap.AdviceLoc:=Loc;
    8206   PaintLoc(OldAdviceLoc);
    8207   PaintLoc(MainMap.AdviceLoc);
    8208   end;
    8209   end; }
    8210 
    82118341procedure TMainScreen.UnitInfoBtnClick(Sender: TObject);
    82128342begin
     
    82948424end;
    82958425
     8426procedure TMainScreen.ArrangeDialogs;
     8427begin
     8428  ArrangeDialog(FListDlg);
     8429  ArrangeDialog(FHelpDlg);
     8430  ArrangeDialog(FUnitStatDlg);
     8431  ArrangeDialog(FDiaDlg);
     8432  ArrangeDialog(FNatStatDlg);
     8433end;
     8434
     8435procedure TMainScreen.ArrangeDialog(Form: TBufferedDrawDlg);
     8436begin
     8437  if not Assigned(Form) then Exit;
     8438
     8439  if Form is TListDlg then begin;
     8440    ListDlg.UserLeft := 8;
     8441    ListDlg.UserTop := TopBarHeight + 8;
     8442  end;
     8443  if Form is THelpDlg then begin
     8444   HelpDlg.UserLeft := Screen.Width - HelpDlg.Width - 8;
     8445    HelpDlg.UserTop := TopBarHeight + 8;
     8446  end;
     8447  if Form is TUnitStatDlg then begin
     8448    UnitStatDlg.UserLeft := 397;
     8449    UnitStatDlg.UserTop := TopBarHeight + 64;
     8450  end;
     8451  if Form is TDiaDlg then begin
     8452    DiaDlg.UserLeft := (Screen.Width - DiaDlg.Width) div 2;
     8453    DiaDlg.UserTop := (Screen.Height - DiaDlg.Height) div 2;
     8454  end;
     8455  if Form is TNatStatDlg then begin
     8456    NatStatDlg.UserLeft := Screen.Width - NatStatDlg.Width - 8;
     8457    NatStatDlg.UserTop := Screen.Height - PanelHeight - NatStatDlg.Height - 8;
     8458    if NatStatDlg.UserTop < 8 then
     8459      NatStatDlg.UserTop := 8;
     8460  end;
     8461end;
     8462
    82968463procedure TMainScreen.ScrollBarUpdate(Sender: TObject);
    82978464begin
Note: See TracChangeset for help on using the changeset viewer.