Changeset 387


Ignore:
Timestamp:
Apr 27, 2021, 9:37:48 PM (3 years ago)
Author:
chronos
Message:
  • Added: New action keys for quick switching between units. "Next Unit" Insert key and "Previous Unit" Delete key.
Location:
trunk
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/Language.txt

    r385 r387  
    548548Medium
    549549Big
     550Previous Unit
     551Next Unit
    550552
    551553#ADVANCES
  • trunk/LocalPlayer/Term.lfm

    r321 r387  
    11object MainScreen: TMainScreen
    2   Left = 169
     2  Left = 516
    33  Height = 480
    4   Top = 596
     4  Top = 834
    55  Width = 800
    66  HorzScrollBar.Visible = False
     
    667667      OnClick = MenuClick
    668668    end
     669    object N13: TMenuItem
     670      Caption = '-'
     671    end
     672    object mPrevUnit: TMenuItem
     673      Tag = 100
     674      ShortCut = 46
     675      OnClick = MenuClick
     676    end
     677    object mNextUnit: TMenuItem
     678      Tag = 101
     679      ShortCut = 45
     680      OnClick = MenuClick
     681    end
    669682  end
    670683  object StatPopup: TPopupMenu
  • trunk/LocalPlayer/Term.pas

    r385 r387  
    2929  TMainScreen = class(TDrawDlg)
    3030    mBigTiles: TMenuItem;
     31    mNextUnit: TMenuItem;
     32    N13: TMenuItem;
     33    mPrevUnit: TMenuItem;
    3134    Timer1: TTimer;
    3235    GamePopup: TPopupMenu;
     
    286289    procedure CopyMiniToPanel;
    287290    procedure PanelPaint;
    288     procedure NextUnit(NearLoc: integer; AutoTurn: boolean);
     291    procedure FocusNextUnit(Dir: Integer = 1);
     292    procedure NextUnit(NearLoc: Integer; AutoTurn: Boolean);
    289293    procedure Scroll(dx, dy: integer);
    290294    procedure SetMapPos(Loc: integer; MapPos: TPoint);
     
    24272431  begin
    24282432    SetTroopLoc(-1);
    2429     PaintAll
     2433    PaintAll;
    24302434  end { supervisor }
    24312435  { else if (ClientMode=cTurn) and (MyRO.Turn=0) then
     
    24492453          FocusOnLoc(G.lx * G.ly div 2);
    24502454      SetTroopLoc(-1);
    2451       PanelPaint
     2455      PanelPaint;
    24522456    end;
    24532457    if ShowCityList then
     
    48964900end;
    48974901
     4902procedure TMainScreen.FocusNextUnit(Dir: Integer);
     4903var
     4904  i, uix, NewFocus: Integer;
     4905begin
     4906  if ClientMode >= scContact then
     4907    Exit;
     4908  DestinationMarkON := False;
     4909  PaintDestination;
     4910  NewFocus := -1;
     4911  for i := 1 to MyRO.nUn do begin
     4912    uix := (UnFocus + i * Dir + MyRO.nUn) mod MyRO.nUn;
     4913    if (MyUn[uix].Loc >= 0) and (MyUn[uix].Status and usStay = 0) then begin
     4914      NewFocus := uix;
     4915      Break;
     4916    end;
     4917  end;
     4918  if NewFocus >= 0 then begin
     4919    SetUnFocus(NewFocus);
     4920    SetTroopLoc(MyUn[NewFocus].Loc);
     4921    FocusOnLoc(TroopLoc, flRepaintPanel);
     4922  end;
     4923end;
     4924
    48984925procedure TMainScreen.FocusOnLoc(Loc: integer; Options: integer = 0);
    48994926var
     
    49224949end;
    49234950
    4924 procedure TMainScreen.NextUnit(NearLoc: integer; AutoTurn: boolean);
     4951procedure TMainScreen.NextUnit(NearLoc: Integer; AutoTurn: Boolean);
    49254952var
    4926   Dist, TestDist: single;
    4927   i, uix, NewFocus: integer;
    4928   GotoOnly: boolean;
     4953  Dist, TestDist: Single;
     4954  i, uix, NewFocus: Integer;
     4955  GotoOnly: Boolean;
    49294956begin
    49304957  Dist := 0;
    49314958  if ClientMode >= scContact then
    4932     exit;
    4933   DestinationMarkON := false;
     4959    Exit;
     4960  DestinationMarkON := False;
    49344961  PaintDestination;
    4935   for GotoOnly := GoOnPhase downto false do
    4936   begin
     4962  for GotoOnly := GoOnPhase downto False do begin
    49374963    NewFocus := -1;
    4938     for i := 1 to MyRO.nUn do
    4939     begin
     4964    for i := 1 to MyRO.nUn do begin
    49404965      uix := (UnFocus + i) mod MyRO.nUn;
    49414966      if (MyUn[uix].Loc >= 0) and (MyUn[uix].Job = jNone) and
    49424967        (MyUn[uix].Status and (usStay or usRecover or usWaiting) = usWaiting)
    49434968        and (not GotoOnly or (MyUn[uix].Status and usGoto <> 0)) then
    4944         if NearLoc < 0 then
    4945         begin
     4969        if NearLoc < 0 then begin
    49464970          NewFocus := uix;
    49474971          Break;
    4948         end
    4949         else
    4950         begin
     4972        end else begin
    49514973          TestDist := Distance(NearLoc, MyUn[uix].Loc);
    4952           if (NewFocus < 0) or (TestDist < Dist) then
    4953           begin
     4974          if (NewFocus < 0) or (TestDist < Dist) then begin
    49544975            NewFocus := uix;
    49554976            Dist := TestDist;
     
    49584979    end;
    49594980    if GotoOnly then
    4960       if NewFocus < 0 then
    4961         GoOnPhase := false
    4962       else
    4963         Break;
    4964   end;
    4965   if NewFocus >= 0 then
    4966   begin
     4981      if NewFocus < 0 then GoOnPhase := False
     4982        else Break;
     4983  end;
     4984  if NewFocus >= 0 then begin
    49674985    SetUnFocus(NewFocus);
    49684986    SetTroopLoc(MyUn[NewFocus].Loc);
    4969     FocusOnLoc(TroopLoc, flRepaintPanel)
    4970   end
    4971   else if AutoTurn and not mWaitTurn.Checked then
    4972   begin
    4973     TurnComplete := true;
     4987    FocusOnLoc(TroopLoc, flRepaintPanel);
     4988  end else
     4989  if AutoTurn and not mWaitTurn.Checked then begin
     4990    TurnComplete := True;
    49744991    SetUnFocus(-1);
    49754992    SetTroopLoc(-1);
    4976     PostMessage(Handle, WM_EOT, 0, 0)
    4977   end
    4978   else
    4979   begin
     4993    PostMessage(Handle, WM_EOT, 0, 0);
     4994  end else begin
    49804995    if { (UnFocus>=0) and } not TurnComplete and EOT.Visible then
    49814996      Play('TURNEND');
    4982     TurnComplete := true;
     4997    TurnComplete := True;
    49834998    SetUnFocus(-1);
    49844999    SetTroopLoc(-1);
     
    59545969        end
    59555970        else
    5956           NextUnit(UnStartLoc, true)
     5971          NextUnit(UnStartLoc, true);
    59575972    end
    59585973    else if (UnFocus < 0) and (Options and muAutoNext <> 0) then
     
    61596174        begin
    61606175          MyUn[uix].Status := MyUn[uix].Status and not usWaiting;
    6161           NextUnit(UnStartLoc, true)
     6176          NextUnit(UnStartLoc, true);
    61626177        end;
    61636178      end;
     
    63206335              trixFocus := TrCnt;
    63216336            inc(TrCnt);
    6322           end
     6337          end;
    63236338    end
    63246339    else // count enemy units here
     
    64356450  mStay.ShortCut := BStay.ShortCut;
    64366451  mNoOrders.ShortCut := BNoOrders.ShortCut;
     6452  mPrevUnit.ShortCut := BPrevUnit.ShortCut;
     6453  mNextUnit.ShortCut := BNextUnit.ShortCut;
    64376454  mCancel.ShortCut := BCancel.ShortCut;
    64386455  mPillage.ShortCut := BPillage.ShortCut;
     
    66286645    else if BStay.Test(ShortCut) then MenuClick(mStay)
    66296646    else if BNoOrders.Test(ShortCut) then MenuClick(mNoOrders)
     6647    else if BPrevUnit.Test(ShortCut) then MenuClick(mPrevUnit)
     6648    else if BNextUnit.Test(ShortCut) then MenuClick(mNextUnit)
    66306649    else if BCancel.Test(ShortCut) then MenuClick_Check(UnitPopup, mCancel)
    66316650    else if BPillage.Test(ShortCut) then MenuClick_Check(UnitPopup, mPillage)
     
    67106729          end
    67116730          else
    6712             PanelPaint
     6731            PanelPaint;
    67136732        end
    67146733        else
    67156734          NextUnit(UnStartLoc, true);
    6716       end
     6735      end;
    67176736    end;
    67186737    case result of
     
    67276746      if result < rExecuted then
    67286747        Play('INVALID')
    6729     end
     6748    end;
    67306749  end;
    67316750
     
    69066925  end
    69076926  else if UnFocus >= 0 then
    6908     with MyUn[UnFocus] do
     6927    with TUn(MyUn[UnFocus]) do
    69096928      if Sender = mGoOn then
    69106929      begin
     
    69376956      begin
    69386957        Centre(Loc);
    6939         PaintAllMaps
     6958        PaintAllMaps;
    69406959      end
    69416960      else if Sender = mCity then
     
    69496968            PaintAll;
    69506969            ZoomToCity(Loc0, true, chFounded);
    6951           end
     6970          end;
    69526971        end
    69536972        else
     
    70107029        if Job > jNone then
    70117030          Server(sStartJob + jNone shl 4, me, UnFocus, nil^);
    7012         NextUnit(UnStartLoc, true)
     7031        NextUnit(UnStartLoc, true);
    70137032      end
    70147033      else if Sender = mRecover then
     
    70197038        if Job > jNone then
    70207039          Server(sStartJob + jNone shl 4, me, UnFocus, nil^);
    7021         NextUnit(UnStartLoc, true)
     7040        NextUnit(UnStartLoc, true);
    70227041      end
    70237042      else if Sender = mNoOrders then
    70247043      begin
    70257044        Status := Status and not usWaiting;
    7026         NextUnit(UnStartLoc, true)
     7045        NextUnit(UnStartLoc, true);
     7046      end
     7047      else if Sender = mPrevUnit then
     7048      begin
     7049        Status := Status and not usWaiting;
     7050        FocusNextUnit(-1);
     7051      end
     7052      else if Sender = mNextUnit then
     7053      begin
     7054        Status := Status and not usWaiting;
     7055        FocusNextUnit(1);
    70277056      end
    70287057      else if Sender = mCancel then
     
    71057134              NextUnit(Loc, true)
    71067135            else
    7107               PanelPaint
     7136              PanelPaint;
    71087137          end
    71097138          else if i = eNoTime_Load then
  • trunk/LocalPlayer/UKeyBindings.pas

    r386 r387  
    6161  BStay: TKeyBinding;
    6262  BNoOrders: TKeyBinding;
     63  BPrevUnit: TKeyBinding;
     64  BNextUnit: TKeyBinding;
    6365  BCancel: TKeyBinding;
    6466  BPillage: TKeyBinding;
     
    308310  BStay := AddItem('Stay', 'Stay', 'S');
    309311  BNoOrders := AddItem('NoOrders', 'No orders', 'Space');
     312  BPrevUnit := AddItem('PrevUnit', 'Previous unit', 'Del');
     313  BNextUnit := AddItem('NextUnit', 'Next unit', 'Ins');
    310314  BCancel := AddItem('Cancel', 'Cancel', 'Ctrl+C');
    311315  BPillage := AddItem('Pillage', 'Pillage', 'Ctrl+P');
  • trunk/Localization/cs/Language.txt

    r385 r387  
    548548Střední
    549549Velká
     550Předchozí jednotka
     551Další jednotka
    550552
    551553#ADVANCES
  • trunk/Localization/de/Language.txt

    r385 r387  
    557557Medium
    558558Big
     559Previous Unit
     560Next Unit
    559561
    560562#ADVANCES
  • trunk/Localization/it/Language.txt

    r385 r387  
    538538Medium
    539539Big
     540Previous Unit
     541Next Unit
    540542
    541543#ADVANCES
  • trunk/Localization/ru/Language.txt

    r385 r387  
    564564Medium
    565565Big
     566Previous Unit
     567Next Unit
    566568
    567569#ADVANCES
  • trunk/Localization/zh-Hans/language.txt

    r385 r387  
    556556Medium
    557557Big
     558Previous Unit
     559Next Unit
    558560
    559561#ADVANCES
  • trunk/Localization/zh-Hant/language.txt

    r385 r387  
    556556Medium
    557557Big
     558Previous Unit
     559Next Unit
    558560
    559561#ADVANCES
Note: See TracChangeset for help on using the changeset viewer.