Ignore:
Timestamp:
Nov 28, 2023, 3:16:24 PM (6 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/Nego.pas

    r457 r460  
    55
    66uses
    7   ScreenTools, BaseWin, Protocol, Term, LCLType, SysUtils, Classes, Graphics,
     7  ScreenTools, BaseWin, Protocol, LCLType, SysUtils, Classes, Graphics,
    88  Controls, Forms, ButtonA, ButtonB, ButtonN;
    99
     
    2020
    2121  TCommandAllowedEnum = scDipNoticeStart..scDipBreakStart;
     22  TPriceSet = set of $00..$FF;
    2223
    2324  { TNegoDlg }
     
    6970    procedure OfferClick(Sender: TObject);
    7071    procedure FastBtnClick(Sender: TObject);
    71 
    7272  public
    7373    procedure Initiate; // first turn of negotiation, initiate
     
    7676    procedure OffscreenPaint; override;
    7777    procedure ShowNewContent(NewMode: TWindowMode);
    78 
    7978  private
    8079    Page, DipCommand: Integer;
     
    9392  end;
    9493
    95 var
    96   NegoDlg: TNegoDlg;
    97 
    9894
    9995implementation
    10096
    10197uses
    102   Messg, ClientTools, Diplomacy, Inp, Select, NatStat, Tribes, MessgEx;
     98  Messg, ClientTools, Diplomacy, Inp, Select, NatStat, Tribes, MessgEx, Term;
    10399
    104100{$R *.lfm}
     
    392388  else
    393389  begin
    394     if ModalSelectDlg.OnlyChoice(kChooseModel) <> mixAll then
     390    if MainScreen.ModalSelectDlg.OnlyChoice(kChooseModel) <> mixAll then
    395391      MyAllowed := MyAllowed + [opAllModel shr 24];
    396     if ModalSelectDlg.OnlyChoice(kChooseEModel) <> mixAll then
     392    if MainScreen.ModalSelectDlg.OnlyChoice(kChooseEModel) <> mixAll then
    397393      OppoAllowed := OppoAllowed + [opAllModel shr 24];
    398394  end;
     
    649645  if (X >= xNationPicture0) and (X < xNationPicture0 + 64) and
    650646    (Y >= yNationPicture) and (Y < yNationPicture + 48) then
    651     NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), DipMem[Me].pContact)
     647    MainScreen.NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), DipMem[Me].pContact)
    652648  else if (X >= xNationPicture1) and (X < xNationPicture1 + 64) and
    653649    (Y >= yNationPicture) and (Y < yNationPicture + 48) then
    654     NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), Me)
     650    MainScreen.NatStatDlg.ShowNewContent(WindowModeMakePersistent(FWindowMode), Me)
    655651end;
    656652
     
    756752        begin // choose type and number
    757753          if MyRO.NatBuilt[imSpacePort] = 0 then
    758             with MessgExDlg do
     754            with MainScreen.MessgExDlg do
    759755            begin
    760756              OpenSound := 'WARNING_LOWSUPPORT';
     
    767763                Exit;
    768764            end;
    769           ModalSelectDlg.ShowNewContent(wmModal, kEShipPart);
    770           if ModalSelectDlg.Result < 0 then
    771             Exit;
    772           Inc(Price, ModalSelectDlg.Result shl 16);
    773           Max := MyRO.Ship[DipMem[Me].pContact].Parts[ModalSelectDlg.Result];
     765          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kEShipPart);
     766          if MainScreen.ModalSelectDlg.Result < 0 then
     767            Exit;
     768          Inc(Price, MainScreen.ModalSelectDlg.Result shl 16);
     769          Max := MyRO.Ship[DipMem[Me].pContact].Parts[MainScreen.ModalSelectDlg.Result];
    774770          InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER');
    775771          InputDlg.EInput.Text := '';
     
    789785      opAllTech:
    790786        begin // choose technology
    791           ModalSelectDlg.ShowNewContent(wmModal, kChooseETech);
    792           if ModalSelectDlg.Result < 0 then
    793             Exit;
    794           if ModalSelectDlg.Result = adAll then
     787          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseETech);
     788          if MainScreen.ModalSelectDlg.Result < 0 then
     789            Exit;
     790          if MainScreen.ModalSelectDlg.Result = adAll then
    795791            Price := opAllTech
    796792          else
    797             Price := OpTech + ModalSelectDlg.Result;
     793            Price := OpTech + MainScreen.ModalSelectDlg.Result;
    798794        end;
    799795      opAllModel:
    800796        begin // choose model
    801           ModalSelectDlg.ShowNewContent(wmModal, kChooseEModel);
    802           if ModalSelectDlg.Result < 0 then
    803             Exit;
    804           if ModalSelectDlg.Result = mixAll then
     797          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseEModel);
     798          if MainScreen.ModalSelectDlg.Result < 0 then
     799            Exit;
     800          if MainScreen.ModalSelectDlg.Result = mixAll then
    805801            Price := opAllModel
    806802          else
    807             Price := OpModel + MyRO.EnemyModel[ModalSelectDlg.Result].mix;
     803            Price := OpModel + MyRO.EnemyModel[MainScreen.ModalSelectDlg.Result].mix;
    808804        end;
    809805      opTreaty:
     
    869865      opShipParts:
    870866        begin // choose type and number
    871           ModalSelectDlg.ShowNewContent(wmModal, kShipPart);
    872           if ModalSelectDlg.Result < 0 then
    873             Exit;
    874           Inc(Price, ModalSelectDlg.Result shl 16);
    875           Max := MyRO.Ship[Me].Parts[ModalSelectDlg.Result];
     867          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kShipPart);
     868          if MainScreen.ModalSelectDlg.Result < 0 then
     869            Exit;
     870          Inc(Price, MainScreen.ModalSelectDlg.Result shl 16);
     871          Max := MyRO.Ship[Me].Parts[MainScreen.ModalSelectDlg.Result];
    876872          InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER');
    877873          InputDlg.EInput.Text := '';
     
    891887      opAllTech:
    892888        begin // choose technology
    893           ModalSelectDlg.ShowNewContent(wmModal, kChooseTech);
    894           if ModalSelectDlg.Result < 0 then
    895             Exit;
    896           if ModalSelectDlg.Result = adAll then
     889          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseTech);
     890          if MainScreen.ModalSelectDlg.Result < 0 then
     891            Exit;
     892          if MainScreen.ModalSelectDlg.Result = adAll then
    897893            Price := opAllTech
    898894          else
    899             Price := OpTech + ModalSelectDlg.Result;
     895            Price := OpTech + MainScreen.ModalSelectDlg.Result;
    900896        end;
    901897      opAllModel:
    902898        begin // choose model
    903           ModalSelectDlg.ShowNewContent(wmModal, kChooseModel);
    904           if ModalSelectDlg.Result < 0 then
    905             Exit;
    906           if ModalSelectDlg.Result = mixAll then
     899          MainScreen.ModalSelectDlg.ShowNewContent(wmModal, kChooseModel);
     900          if MainScreen.ModalSelectDlg.Result < 0 then
     901            Exit;
     902          if MainScreen.ModalSelectDlg.Result = mixAll then
    907903            Price := opAllModel
    908904          else
    909             Price := OpModel + ModalSelectDlg.Result;
     905            Price := OpModel + MainScreen.ModalSelectDlg.Result;
    910906        end;
    911907      opTreaty:
Note: See TracChangeset for help on using the changeset viewer.