Changeset 220 for trunk


Ignore:
Timestamp:
Jun 10, 2018, 12:18:28 PM (6 years ago)
Author:
chronos
Message:
  • Added: Allow to toggle Fog of war in debug mode from Debug menu.
Location:
trunk
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormMain.lfm

    r206 r220  
    55  Width = 775
    66  Caption = 'xTactics'
    7   ClientHeight = 596
     7  ClientHeight = 587
    88  ClientWidth = 775
    9   DesignTimePPI = 120
     9  DesignTimePPI = 144
    1010  Menu = MainMenu1
    1111  OnClose = FormClose
     
    7777  object PanelMain: TPanel
    7878    Left = 0
    79     Height = 556
     79    Height = 547
    8080    Top = 40
    8181    Width = 775
     
    169169      end
    170170    end
     171    object MenuItemDebug: TMenuItem
     172      Caption = 'Debug'
     173      object MenuItem31: TMenuItem
     174        Action = Core.AToggleFogOfWar
     175      end
     176    end
    171177    object MenuItem16: TMenuItem
    172178      Caption = 'Help'
  • trunk/Forms/UFormMain.pas

    r207 r220  
    4444    MenuItem28: TMenuItem;
    4545    MenuItem29: TMenuItem;
     46    MenuItemDebug: TMenuItem;
     47    MenuItem31: TMenuItem;
    4648    MenuItem4: TMenuItem;
    4749    MenuItemLoadRecent: TMenuItem;
     
    149151  FormClient.ManualDock(PanelMain, nil, alClient);
    150152  FormClient.Align := alClient;
     153  {$IFDEF DEBUG}
     154  MenuItemDebug.Visible := True;
     155  MenuItemDebug.Enabled := True;
     156  {$ELSE}
     157  MenuItemDebug.Visible := False;
     158  MenuItemDebug.Enabled := False;
     159  {$ENDIF}
    151160end;
    152161
  • trunk/Forms/UFormSettings.lfm

    r195 r220  
    1010  Constraints.MinHeight = 327
    1111  Constraints.MinWidth = 554
    12   DesignTimePPI = 120
     12  DesignTimePPI = 144
    1313  OnCreate = FormCreate
    1414  OnShow = FormShow
     
    4040    Top = 4
    4141    Width = 546
    42     ActivePage = TabSheetGeneral
     42    ActivePage = TabSheetDebug
    4343    Align = alTop
    4444    Anchors = [akTop, akLeft, akRight, akBottom]
    4545    BorderSpacing.Around = 4
    46     TabIndex = 0
     46    TabIndex = 1
    4747    TabOrder = 2
    4848    object TabSheetGeneral: TTabSheet
    4949      Caption = 'General'
    50       ClientHeight = 231
    51       ClientWidth = 538
     50      ClientHeight = 220
     51      ClientWidth = 540
    5252      object Label2: TLabel
    5353        Left = 20
    54         Height = 20
     54        Height = 26
    5555        Top = 78
    56         Width = 116
     56        Width = 150
    5757        Caption = 'Animation speed:'
    5858        ParentColor = False
     
    6060      object SpinEditAnimSpeed: TSpinEdit
    6161        Left = 232
    62         Height = 28
     62        Height = 36
    6363        Top = 72
    6464        Width = 122
     
    6767      object Label3: TLabel
    6868        Left = 368
    69         Height = 20
     69        Height = 26
    7070        Top = 82
    71         Width = 12
     71        Width = 15
    7272        Caption = '%'
    7373        ParentColor = False
     
    7777        Height = 27
    7878        Top = 112
    79         Width = 584
     79        Width = 586
    8080        Anchors = [akTop, akLeft, akRight]
    8181        AutoSize = False
     
    8585      object Label1: TLabel
    8686        Left = 20
    87         Height = 20
     87        Height = 26
    8888        Top = 26
    89         Width = 68
     89        Width = 88
    9090        Caption = 'Language:'
    9191        ParentColor = False
     
    9393      object ComboBoxLanguage: TComboBox
    9494        Left = 178
    95         Height = 28
     95        Height = 40
    9696        Top = 24
    9797        Width = 196
    98         ItemHeight = 20
     98        ItemHeight = 0
    9999        Style = csDropDownList
    100100        TabOrder = 2
     
    102102      object CheckBoxReopenLastFile: TCheckBox
    103103        Left = 20
    104         Height = 24
     104        Height = 30
    105105        Top = 152
    106         Width = 198
     106        Width = 249
    107107        Caption = 'Reopen last game on start'
    108108        TabOrder = 3
     
    125125      object Label4: TLabel
    126126        Left = 14
    127         Height = 25
     127        Height = 26
    128128        Top = 67
    129         Width = 32
     129        Width = 35
    130130        Caption = 'DPI:'
    131131        ParentColor = False
     
    133133      object SpinEditX: TSpinEdit
    134134        Left = 104
    135         Height = 33
     135        Height = 36
    136136        Top = 64
    137137        Width = 96
     
    143143      object SpinEditY: TSpinEdit
    144144        Left = 232
    145         Height = 33
     145        Height = 36
    146146        Top = 64
    147147        Width = 90
     
    153153      object Label5: TLabel
    154154        Left = 208
    155         Height = 25
     155        Height = 26
    156156        Top = 67
    157         Width = 8
     157        Width = 10
    158158        Caption = 'x'
    159159        ParentColor = False
  • trunk/Languages/xtactics.cs.po

    r215 r220  
    103103msgstr "Pohyby jednotek"
    104104
     105#: tcore.atogglefogofwar.caption
     106msgid "Toggle fog of war"
     107msgstr "Přepnout Skrytou mapu"
     108
    105109#: tformabout.buttonclose.caption
    106110msgid "Close"
     
    278282msgstr "Nástroje"
    279283
     284#: tformmain.menuitemdebug.caption
     285msgctxt "tformmain.menuitemdebug.caption"
     286msgid "Debug"
     287msgstr "Ladění"
     288
    280289#: tformmain.menuitemloadrecent.caption
    281290msgctxt "tformmain.menuitemloadrecent.caption"
     
    711720
    712721#: tformsettings.tabsheetdebug.caption
     722msgctxt "tformsettings.tabsheetdebug.caption"
    713723msgid "Debug"
    714724msgstr "Ladění"
     
    10261036msgid "64-bit UInt read overflow."
    10271037msgstr "Přetečení při čtení 64-bit UInt"
    1028 
  • trunk/Languages/xtactics.po

    r213 r220  
    9393msgstr ""
    9494
     95#: tcore.atogglefogofwar.caption
     96msgid "Toggle fog of war"
     97msgstr ""
     98
    9599#: tformabout.buttonclose.caption
    96100msgid "Close"
     
    267271msgstr ""
    268272
     273#: tformmain.menuitemdebug.caption
     274msgctxt "tformmain.menuitemdebug.caption"
     275msgid "Debug"
     276msgstr ""
     277
    269278#: tformmain.menuitemloadrecent.caption
    270279msgctxt "tformmain.menuitemloadrecent.caption"
     
    696705
    697706#: tformsettings.tabsheetdebug.caption
     707msgctxt "tformsettings.tabsheetdebug.caption"
    698708msgid "Debug"
    699709msgstr ""
  • trunk/UCore.lfm

    r213 r220  
    9898      Caption = 'Key shortcuts'
    9999      OnExecute = AShowKeyShortcutsExecute
     100    end
     101    object AToggleFogOfWar: TAction
     102      Caption = 'Toggle fog of war'
     103      OnExecute = AToggleFogOfWarExecute
    100104    end
    101105  end
  • trunk/UCore.pas

    r216 r220  
    1717  TCore = class(TDataModule)
    1818    AAbout: TAction;
     19    AToggleFogOfWar: TAction;
    1920    AShowKeyShortcuts: TAction;
    2021    AGameSave: TAction;
     
    5758    procedure AShowKeyShortcutsExecute(Sender: TObject);
    5859    procedure AShowUnitMovesExecute(Sender: TObject);
     60    procedure AToggleFogOfWarExecute(Sender: TObject);
    5961    procedure CoolTranslator1Translate(Sender: TObject);
    6062    procedure DataModuleCreate(Sender: TObject);
     
    389391end;
    390392
     393procedure TCore.AToggleFogOfWarExecute(Sender: TObject);
     394begin
     395  Game.FogOfWar := not Game.FogOfWar;
     396  Server.DoChange(Self);
     397end;
     398
    391399procedure TCore.CoolTranslator1Translate(Sender: TObject);
    392400begin
  • trunk/UGame.pas

    r219 r220  
    207207    CellLinks: TCellLinks;
    208208    Areas: TMapAreas;
     209    Cyclic: Boolean;
    209210    function IsOutsideShape(Coord: TPoint): Boolean; virtual;
    210211    function IsCellsNeighbor(Cell1, Cell2: TCell): Boolean; virtual;
     
    946947        else Pen.Width := 1;
    947948      Angle := ArcTan((PosTo.Y - PosFrom.Y) / (PosTo.X - PosFrom.X));
     949      if (Angle > +Pi) or (Angle < -Pi) then
     950        raise Exception.Create('Wrong arrow angle ' + FloatToStr(Angle));
     951
    948952      if Sign(PosTo.X - PosFrom.X) = -1 then Angle := Angle + Pi;
    949953      ArrowCenter := View.CellToCanvasPos(TPoint.Create(Trunc(PosFrom.X + (PosTo.X - PosFrom.X) / 2),
     
    32463250    for I := 0 to Cells.Count - 1 do begin
    32473251      if I = 0 then Player := Cells[I].Player;
    3248       if not Assigned(Cells[I].Player) or (Cells[I].Player <> Player) then begin
     3252      if not Assigned(Cells[I].Player) then begin
     3253        R := False;
     3254        Break;
     3255      end;
     3256      if (Cells[I].Player <> Player) then begin
    32493257        R := False;
    32503258        Break;
  • trunk/UGameClient.pas

    r213 r220  
    4444    procedure DoNextPlayerHandler(Sender: TObject);
    4545    procedure DoNextPlayer;
     46    procedure DoParametersChangedHandler(Sender: TObject);
    4647  public
    4748    Name: string;
     
    172173end;
    173174
     175procedure TClient.DoParametersChangedHandler(Sender: TObject);
     176begin
     177  Synchronize(DoChange);
     178end;
     179
    174180procedure TClient.SetControlPlayer(AValue: TPlayer);
    175181begin
     
    232238  Protocol.OnGameEnd := DoGameEndHandler;
    233239  Protocol.OnNextPlayer := DoNextPlayerHandler;
     240  Protocol.OnParametersChanged := DoParametersChangedHandler;
    234241end;
    235242
  • trunk/UGameProtocol.pas

    r215 r220  
    1010type
    1111  TCommand = (cmdTextMessage, cmdTurnStart, cmdTurnEnd, cmdGameStart, cmdGameEnd,
    12     cmdSurrender, cmdNextPlayer);
     12    cmdSurrender, cmdNextPlayer, cmdParametersChanged);
    1313  TCommandEvent = procedure (Command: TCommand; DataIn, DataOut: TStream);
    1414
     
    2424    FOnGameStart: TNotifyEvent;
    2525    FOnNextPlayer: TNotifyEvent;
     26    FOnParametersChanged: TNotifyEvent;
    2627    FOnTurnStart: TNotifyEvent;
    2728    procedure Receive(Sender: TCommPin; Stream: TListByte);
     
    3839    property OnTurnStart: TNotifyEvent read FOnTurnStart write FOnTurnStart;
    3940    property OnNextPlayer: TNotifyEvent read FOnNextPlayer write FOnNextPlayer;
     41    property OnParametersChanged: TNotifyEvent read FOnParametersChanged
     42      write FOnParametersChanged;
    4043  end;
    4144
     
    5861    procedure GameEnd;
    5962    procedure TurnStart;
     63    procedure ParametersChanged;
    6064    procedure NextPlayer;
    6165    property OnSendMessage: TSendMessageEvent read FOnSendMessage
     
    139143end;
    140144
     145procedure TGameProtocolServer.ParametersChanged;
     146begin
     147  SendCmd(cmdParametersChanged);
     148end;
     149
    141150procedure TGameProtocolServer.NextPlayer;
    142151begin
     
    167176    if Command = Integer(cmdNextPlayer) then begin
    168177      if Assigned(FOnNextPlayer) then FOnNextPlayer(Self);
     178    end else
     179    if Command = Integer(cmdParametersChanged) then begin
     180      if Assigned(FOnParametersChanged) then FOnParametersChanged(Self);
    169181    end;
    170182  finally
  • trunk/UGameServer.pas

    r213 r220  
    4747    procedure SetGame(AValue: TGame);
    4848    procedure SetServerMode(AValue: TServerMode);
    49     procedure DoChange(Sender: TObject);
    5049    procedure GameStarted(Sender: TObject);
    5150  public
     
    5554    RemoteNetworkAddress: string;
    5655    RemoteNetworkPort: Word;
     56    procedure DoChange(Sender: TObject);
    5757    function GetNewServerClient: TServerClient;
    5858    procedure LoadConfig(Config: TXmlConfig; Path: string);
     
    9090procedure TServerClient.DoChange;
    9191begin
    92 
     92  Protocol.ParametersChanged;
    9393end;
    9494
Note: See TracChangeset for help on using the changeset viewer.