Changeset 725 for trunk/LocalPlayer


Ignore:
Timestamp:
Jan 13, 2026, 4:01:26 PM (3 weeks ago)
Author:
chronos
Message:
Location:
trunk/LocalPlayer
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/LocalPlayer/Help.pas

    r715 r725  
    20542054
    20552055procedure THelpDlg.SearchBtnClick(Sender: TObject);
    2056 begin
    2057   InputDlg.Caption := Phrases.Lookup('SEARCH');
    2058   InputDlg.EditInput.Text := SearchContent;
    2059   InputDlg.CenterToRect(BoundsRect);
    2060   InputDlg.ShowModal;
    2061   if (InputDlg.ModalResult = mrOK) and (Length(InputDlg.EditInput.Text) >= 2) then
    2062   begin
    2063     Search(InputDlg.EditInput.Text);
    2064     case SearchResult.Count of
    2065       0: begin
    2066         Gtk2Fix;
    2067         SimpleMessage(Format(HelpText.Lookup('NOMATCHES'),
    2068           [InputDlg.EditInput.Text]));
    2069       end;
    2070       1:
    2071         with THelpLineInfo(SearchResult.Objects[0]) do
    2072           ShowNewContent(FWindowMode, Category, Index);
    2073       else begin
    2074         NewSearchContent := InputDlg.EditInput.Text;
    2075         ShowNewContent(FWindowMode, hkMisc, Integer(miscSearchResult));
     2056var
     2057  InputDlg: TInputDlg;
     2058begin
     2059  InputDlg := TInputDlg.Create(nil);
     2060  try
     2061    InputDlg.Caption := Phrases.Lookup('SEARCH');
     2062    InputDlg.EditInput.Text := SearchContent;
     2063    InputDlg.CenterToRect(BoundsRect);
     2064    InputDlg.ShowModal;
     2065    if (InputDlg.ModalResult = mrOK) and (Length(InputDlg.EditInput.Text) >= 2) then
     2066    begin
     2067      Search(InputDlg.EditInput.Text);
     2068      case SearchResult.Count of
     2069        0: begin
     2070          Gtk2Fix;
     2071          SimpleMessage(Format(HelpText.Lookup('NOMATCHES'),
     2072            [InputDlg.EditInput.Text]));
     2073        end;
     2074        1:
     2075          with THelpLineInfo(SearchResult.Objects[0]) do
     2076            ShowNewContent(FWindowMode, Category, Index);
     2077        else begin
     2078          NewSearchContent := InputDlg.EditInput.Text;
     2079          ShowNewContent(FWindowMode, hkMisc, Integer(miscSearchResult));
     2080        end;
    20762081      end;
    20772082    end;
     2083  finally
     2084    InputDlg.Free;
    20782085  end;
    20792086end;
  • trunk/LocalPlayer/Nego.pas

    r674 r725  
    715715  A, I, Max: Integer;
    716716  Price: Cardinal;
     717  InputDlg: TInputDlg;
    717718begin
    718719  if (Page <> History[Me].N) or (ClientMode = scDipCancelTreaty) or
     
    737738      opMoney:
    738739        begin // choose amount
    739           InputDlg.Caption := Phrases.Lookup('TITLE_AMOUNT');
    740           InputDlg.EditInput.Text := '';
    741           InputDlg.CenterToRect(BoundsRect);
    742           InputDlg.ShowModal;
    743           if InputDlg.ModalResult <> mrOK then
    744             Exit;
    745           Val(InputDlg.EditInput.Text, A, I);
    746           if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then
    747             Exit;
    748           Inc(Price, A);
     740          InputDlg := TInputDlg.Create(nil);
     741          try
     742            InputDlg.Caption := Phrases.Lookup('TITLE_AMOUNT');
     743            InputDlg.EditInput.Text := '';
     744            InputDlg.CenterToRect(BoundsRect);
     745            InputDlg.ShowModal;
     746            if InputDlg.ModalResult <> mrOK then
     747              Exit;
     748            Val(InputDlg.EditInput.Text, A, I);
     749            if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then
     750              Exit;
     751            Inc(Price, A);
     752          finally
     753            InputDlg.Free;
     754          end;
    749755        end;
    750756      opShipParts:
     
    828834  A, I, Max: Integer;
    829835  Price: Cardinal;
     836  InputDlg: TInputDlg;
    830837begin
    831838  if (Page <> History[Me].N) or (ClientMode = scDipCancelTreaty) or
     
    849856      opMoney:
    850857        begin // choose amount
    851           InputDlg.Caption := Phrases.Lookup('TITLE_AMOUNT');
    852           InputDlg.EditInput.Text := '';
    853           InputDlg.CenterToRect(BoundsRect);
    854           InputDlg.ShowModal;
    855           if InputDlg.ModalResult <> mrOK then
    856             Exit;
    857           Val(InputDlg.EditInput.Text, A, I);
    858           if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then
    859             Exit;
    860           if (Price = opMoney) and (A > MyRO.Money) then
    861             A := MyRO.Money;
    862           Inc(Price, A);
     858          InputDlg := TInputDlg.Create(nil);
     859          try
     860            InputDlg.Caption := Phrases.Lookup('TITLE_AMOUNT');
     861            InputDlg.EditInput.Text := '';
     862            InputDlg.CenterToRect(BoundsRect);
     863            InputDlg.ShowModal;
     864            if InputDlg.ModalResult <> mrOK then
     865              Exit;
     866            Val(InputDlg.EditInput.Text, A, I);
     867            if (I <> 0) or (A <= 0) or (A >= MaxMoneyPrice) then
     868              Exit;
     869            if (Price = opMoney) and (A > MyRO.Money) then
     870              A := MyRO.Money;
     871            Inc(Price, A);
     872          finally
     873            InputDlg.Free;
     874          end;
    863875        end;
    864876      opShipParts:
     
    869881          Inc(Price, MainScreen.ModalSelectDlg.Result shl 16);
    870882          Max := MyRO.Ship[Me].Parts[MainScreen.ModalSelectDlg.Result];
    871           InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER');
    872           InputDlg.EditInput.Text := '';
    873           InputDlg.CenterToRect(BoundsRect);
    874           Gtk2Fix;
    875           InputDlg.ShowModal;
    876           if InputDlg.ModalResult <> mrOK then
    877             Exit;
    878           Val(InputDlg.EditInput.Text, A, I);
    879           if (I <> 0) or (A <= 0) then
    880             Exit;
    881           if A > Max then
    882             A := Max;
    883           if A > MaxShipPartPrice then
    884             A := MaxShipPartPrice;
    885           Inc(Price, A);
     883          InputDlg := TInputDlg.Create(nil);
     884          try
     885            InputDlg.Caption := Phrases.Lookup('TITLE_NUMBER');
     886            InputDlg.EditInput.Text := '';
     887            InputDlg.CenterToRect(BoundsRect);
     888            Gtk2Fix;
     889            InputDlg.ShowModal;
     890            if InputDlg.ModalResult <> mrOK then
     891              Exit;
     892            Val(InputDlg.EditInput.Text, A, I);
     893            if (I <> 0) or (A <= 0) then
     894              Exit;
     895            if A > Max then
     896              A := Max;
     897            if A > MaxShipPartPrice then
     898              A := MaxShipPartPrice;
     899            Inc(Price, A);
     900          finally
     901            InputDlg.Free;
     902          end;
    886903        end;
    887904      opAllTech:
  • trunk/LocalPlayer/Select.pas

    r714 r725  
    967967var
    968968  CityNameInfo: TCityNameInfo;
    969 begin
    970   InputDlg.Caption := Phrases.Lookup('TITLE_CITYNAME');
    971   InputDlg.EditInput.Text := CityName(MyCity[cix].ID);
    972   InputDlg.CenterToRect(BoundsRect);
    973   InputDlg.ShowModal;
    974   if (InputDlg.ModalResult = mrOK) and (InputDlg.EditInput.Text <> '') and
    975     (InputDlg.EditInput.Text <> CityName(MyCity[cix].ID)) then
    976   begin
    977     CityNameInfo.ID := MyCity[cix].ID;
    978     CityNameInfo.NewName := InputDlg.EditInput.Text;
    979     if CityNameInfo.GetCommandDataSize > CommandDataMaxSize then
    980       Delete(CityNameInfo.NewName, Length(CityNameInfo.NewName) -
    981         (CityNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt);
    982     Server(CommandWithData(cSetCityName, CityNameInfo.GetCommandDataSize),
    983       Me, 0, CityNameInfo);
    984     if MainScreen.CityDlg.Visible then
     969  InputDlg: TInputDlg;
     970begin
     971  InputDlg := TInputDlg.Create(nil);
     972  try
     973    InputDlg.Caption := Phrases.Lookup('TITLE_CITYNAME');
     974    InputDlg.EditInput.Text := CityName(MyCity[cix].ID);
     975    InputDlg.CenterToRect(BoundsRect);
     976    InputDlg.ShowModal;
     977    if (InputDlg.ModalResult = mrOK) and (InputDlg.EditInput.Text <> '') and
     978      (InputDlg.EditInput.Text <> CityName(MyCity[cix].ID)) then
    985979    begin
    986       MainScreen.CityDlg.FormShow(nil);
    987       MainScreen.CityDlg.Invalidate;
    988     end;
    989     Result := True;
    990   end
    991   else
    992     Result := False;
     980      CityNameInfo.ID := MyCity[cix].ID;
     981      CityNameInfo.NewName := InputDlg.EditInput.Text;
     982      if CityNameInfo.GetCommandDataSize > CommandDataMaxSize then
     983        Delete(CityNameInfo.NewName, Length(CityNameInfo.NewName) -
     984          (CityNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt);
     985      Server(CommandWithData(cSetCityName, CityNameInfo.GetCommandDataSize),
     986        Me, 0, CityNameInfo);
     987      if MainScreen.CityDlg.Visible then
     988      begin
     989        MainScreen.CityDlg.FormShow(nil);
     990        MainScreen.CityDlg.Invalidate;
     991      end;
     992      Result := True;
     993    end else Result := False;
     994  finally
     995    InputDlg.Free;
     996  end;
    993997end;
    994998
     
    9961000var
    9971001  ModelNameInfo: TModelNameInfo;
    998 begin
    999   InputDlg.Caption := Phrases.Lookup('TITLE_MODELNAME');
    1000   InputDlg.EditInput.Text := Tribe[Me].ModelName[mix];
    1001   InputDlg.CenterToRect(BoundsRect);
    1002   InputDlg.ShowModal;
    1003   if (InputDlg.ModalResult = mrOK) and (InputDlg.EditInput.Text <> '') and
    1004     (InputDlg.EditInput.Text <> Tribe[Me].ModelName[mix]) then
    1005   begin
    1006     ModelNameInfo.mix := mix;
    1007     ModelNameInfo.NewName := InputDlg.EditInput.Text;
    1008     if ModelNameInfo.GetCommandDataSize > CommandDataMaxSize then
    1009       Delete(ModelNameInfo.NewName, Length(ModelNameInfo.NewName) -
    1010         (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt);
    1011     Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize),
    1012       Me, 0, ModelNameInfo);
    1013     if MainScreen.UnitStatDlg.Visible then
     1002  InputDlg: TInputDlg;
     1003begin
     1004  InputDlg := TInputDlg.Create(nil);
     1005  try
     1006    InputDlg.Caption := Phrases.Lookup('TITLE_MODELNAME');
     1007    InputDlg.EditInput.Text := Tribe[Me].ModelName[mix];
     1008    InputDlg.CenterToRect(BoundsRect);
     1009    InputDlg.ShowModal;
     1010    if (InputDlg.ModalResult = mrOK) and (InputDlg.EditInput.Text <> '') and
     1011      (InputDlg.EditInput.Text <> Tribe[Me].ModelName[mix]) then
    10141012    begin
    1015       MainScreen.UnitStatDlg.FormShow(nil);
    1016       MainScreen.UnitStatDlg.Invalidate;
    1017     end;
    1018     Result := True;
    1019   end
    1020   else
    1021     Result := False;
     1013      ModelNameInfo.mix := mix;
     1014      ModelNameInfo.NewName := InputDlg.EditInput.Text;
     1015      if ModelNameInfo.GetCommandDataSize > CommandDataMaxSize then
     1016        Delete(ModelNameInfo.NewName, Length(ModelNameInfo.NewName) -
     1017          (ModelNameInfo.GetCommandDataSize - 1 - CommandDataMaxSize), MaxInt);
     1018      Server(CommandWithData(cSetModelName, ModelNameInfo.GetCommandDataSize),
     1019        Me, 0, ModelNameInfo);
     1020      if MainScreen.UnitStatDlg.Visible then
     1021      begin
     1022        MainScreen.UnitStatDlg.FormShow(nil);
     1023        MainScreen.UnitStatDlg.Invalidate;
     1024      end;
     1025      Result := True;
     1026    end else Result := False;
     1027  finally
     1028    InputDlg.Free;
     1029  end;
    10221030end;
    10231031
Note: See TracChangeset for help on using the changeset viewer.