Changeset 197


Ignore:
Timestamp:
May 16, 2018, 11:03:48 AM (6 years ago)
Author:
chronos
Message:
  • Added: Evaluate win objection to stay alive for defined number of turns. Multiple players can win.
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Forms/UFormNew.lfm

    r196 r197  
    11object FormNew: TFormNew
    22  Left = 387
    3   Height = 843
     3  Height = 748
    44  Top = 102
    5   Width = 1069
     5  Width = 795
    66  Caption = 'New game'
    7   ClientHeight = 843
    8   ClientWidth = 1069
     7  ClientHeight = 748
     8  ClientWidth = 795
    99  Constraints.MinHeight = 501
    1010  Constraints.MinWidth = 667
     
    1818  object PageControl1: TPageControl
    1919    Left = 4
    20     Height = 556
     20    Height = 461
    2121    Top = 4
    22     Width = 1061
    23     ActivePage = TabSheetMode
     22    Width = 787
     23    ActivePage = TabSheet3
    2424    Align = alClient
    2525    BorderSpacing.Around = 4
    26     TabIndex = 0
     26    TabIndex = 3
    2727    TabOrder = 0
    2828    object TabSheetMode: TTabSheet
    2929      Caption = 'Mode'
    30       ClientHeight = 523
    31       ClientWidth = 1053
     30      ClientHeight = 362
     31      ClientWidth = 694
    3232      object RadioButtonModeLocal: TRadioButton
    3333        Left = 10
     
    9090      object ListViewServers: TListView
    9191        Left = 26
    92         Height = 291
     92        Height = 130
    9393        Top = 181
    9494        Width = 334
     
    118118        Left = 27
    119119        Height = 31
    120         Top = 484
     120        Top = 323
    121121        Width = 94
    122122        Action = AServerAdd
     
    127127        Left = 240
    128128        Height = 31
    129         Top = 484
     129        Top = 323
    130130        Width = 94
    131131        Action = AServerRemove
     
    136136        Left = 136
    137137        Height = 30
    138         Top = 484
     138        Top = 323
    139139        Width = 94
    140140        Action = AServerModify
     
    145145    object TabSheet1: TTabSheet
    146146      Caption = 'Players'
    147       ClientHeight = 297
    148       ClientWidth = 759
     147      ClientHeight = 428
     148      ClientWidth = 779
    149149      object ListViewPlayers: TListView
    150150        Left = 4
    151         Height = 247
     151        Height = 378
    152152        Top = 4
    153         Width = 751
     153        Width = 771
    154154        Align = alTop
    155155        Anchors = [akTop, akLeft, akRight, akBottom]
     
    188188        Left = 224
    189189        Height = 25
    190         Top = 259
     190        Top = 390
    191191        Width = 83
    192192        Action = APlayerRemove
     
    197197        Left = 16
    198198        Height = 25
    199         Top = 259
     199        Top = 390
    200200        Width = 83
    201201        Action = APlayerAdd
     
    206206        Left = 120
    207207        Height = 25
    208         Top = 259
     208        Top = 390
    209209        Width = 83
    210210        Action = APlayerModify
     
    216216    object TabSheet2: TTabSheet
    217217      Caption = 'Map'
    218       ClientHeight = 523
    219       ClientWidth = 1053
     218      ClientHeight = 428
     219      ClientWidth = 779
    220220      object Label1: TLabel
    221221        Left = 8
     
    258258        Height = 47
    259259        Top = 8
    260         Width = 802
     260        Width = 528
    261261        Max = 100
    262262        Min = 2
     
    271271        Height = 47
    272272        Top = 49
    273         Width = 802
     273        Width = 528
    274274        Max = 100
    275275        Min = 2
     
    329329        Height = 27
    330330        Top = 110
    331         Width = 565
     331        Width = 291
    332332        Anchors = [akTop, akLeft, akRight]
    333333        AutoSize = False
     
    408408        Height = 28
    409409        Top = 184
    410         Width = 786
     410        Width = 512
    411411        Anchors = [akTop, akLeft, akRight]
    412412        TabOrder = 12
    413413      end
    414414      object ButtonImageBrowse: TButton
    415         Left = 938
     415        Left = 664
    416416        Height = 25
    417417        Top = 192
     
    460460    object TabSheet3: TTabSheet
    461461      Caption = 'Rules'
    462       ClientHeight = 297
    463       ClientWidth = 759
     462      ClientHeight = 428
     463      ClientWidth = 779
    464464      object RadioGroupGrowCells: TRadioGroup
    465465        Left = 15
     
    534534        Height = 27
    535535        Top = 24
    536         Width = 599
     536        Width = 619
    537537        Anchors = [akTop, akLeft, akRight]
    538538        AutoSize = False
     
    540540        TabOrder = 3
    541541      end
     542      object Label13: TLabel
     543        Left = 8
     544        Height = 20
     545        Top = 280
     546        Width = 111
     547        Caption = 'Number of turns:'
     548        ParentColor = False
     549      end
     550      object SpinEditTurns: TSpinEdit
     551        Left = 236
     552        Height = 28
     553        Top = 278
     554        Width = 159
     555        MaxValue = 1000
     556        MinValue = 1
     557        TabOrder = 4
     558        Value = 1
     559      end
    542560    end
    543561  end
     
    545563    Left = 0
    546564    Height = 45
    547     Top = 798
    548     Width = 1069
     565    Top = 703
     566    Width = 795
    549567    Align = alBottom
    550568    BevelOuter = bvNone
    551569    ClientHeight = 45
    552     ClientWidth = 1069
     570    ClientWidth = 795
    553571    TabOrder = 1
    554572    object ButtonOk: TButton
    555       Left = 881
     573      Left = 607
    556574      Height = 25
    557575      Top = 6
     
    563581    end
    564582    object ButtonCancel: TButton
    565       Left = 985
     583      Left = 711
    566584      Height = 25
    567585      Top = 6
     
    576594    Left = 0
    577595    Height = 228
    578     Top = 570
    579     Width = 1069
     596    Top = 475
     597    Width = 795
    580598    Align = alBottom
    581599    BevelOuter = bvNone
     
    586604    Left = 0
    587605    Height = 6
    588     Top = 564
    589     Width = 1069
     606    Top = 469
     607    Width = 795
    590608    Align = alBottom
    591609    ResizeAnchor = akBottom
  • trunk/Forms/UFormNew.pas

    r196 r197  
    4545    Label11: TLabel;
    4646    Label12: TLabel;
     47    Label13: TLabel;
    4748    Label2: TLabel;
    4849    Label3: TLabel;
     
    7273    RadioGroupGrowAmount: TRadioGroup;
    7374    RadioGroupGrowCells: TRadioGroup;
     75    SpinEditTurns: TSpinEdit;
    7476    SpinEditMaxPower: TSpinEdit;
    7577    SpinEditServerPort: TSpinEdit;
     
    501503    SpinEditServerPort.Value := LocalNetworkPort;
    502504    SpinEditMaxPower.Value := Game.MaxPower;
     505    SpinEditTurns.Value := Game.StayAliveForDefinedTurns;
    503506  end;
    504507end;
     
    536539    Game.BridgeEnabled := CheckBoxBridges.Checked;
    537540    Game.MaxPower := SpinEditMaxPower.Value;
     541    Game.StayAliveForDefinedTurns := SpinEditTurns.Value;
    538542  end;
    539543end;
  • trunk/Languages/xtactics.cs.po

    r196 r197  
    399399msgstr "Adresa:"
    400400
     401#: tformnew.label13.caption
     402msgid "Number of turns:"
     403msgstr "Počet tahů:"
     404
    401405#: tformnew.label2.caption
    402406#| msgid "x"
     
    710714msgid "Not all players were initialized with start cell. Needed %d, initialized %d. Change map parameters to have more terrain cells."
    711715msgstr "Ne všichni hráči byli vytvoření. Potřeba %d, vytvořeno %d. Změňte parametry mapy abyste měli více políček země."
     716
     717#: ucore.splayerswins
     718msgid "Players %s win"
     719msgstr "Hráči %s vyhráli"
    712720
    713721#: ucore.splayerwins
     
    939947#: uvarblockserializer.serrorgetvarsize
    940948msgid "Error reading variable block size"
    941 msgstr ""
     949msgstr "Chyba čtení velikosti délkou proměnného bloku"
    942950
    943951#: uvarblockserializer.smaskedvaluereaderror
    944952msgid "Error reading masked variable length block."
    945 msgstr ""
     953msgstr "Chyba čtení maskovaného délkou proměnného bloku"
    946954
    947955#: uvarblockserializer.sreaderror
    948956msgid "Stream read error. Expected length %d, read %d. Source stream size %d."
    949 msgstr ""
     957msgstr "Chyba čtení proudu: Očekávaná délka %d, přečteno %d. Zdrojový proud %d."
    950958
    951959#: uvarblockserializer.suint64overflow
    952960msgid "64-bit UInt read overflow."
    953 msgstr ""
     961msgstr "Přetečení při čtení 64-bit UInt"
  • trunk/Languages/xtactics.po

    r196 r197  
    385385msgstr ""
    386386
     387#: tformnew.label13.caption
     388msgid "Number of turns:"
     389msgstr ""
     390
    387391#: tformnew.label2.caption
    388392msgid "Map height:"
     
    694698#: ucore.splayersnotinitialized
    695699msgid "Not all players were initialized with start cell. Needed %d, initialized %d. Change map parameters to have more terrain cells."
     700msgstr ""
     701
     702#: ucore.splayerswins
     703msgid "Players %s win"
    696704msgstr ""
    697705
  • trunk/UCore.lfm

    r194 r197  
    1010  object ActionList1: TActionList
    1111    Images = ImageListSmall
    12     left = 113
     12    left = 114
    1313    top = 50
    1414    object AExit: TAction
  • trunk/UCore.pas

    r196 r197  
    116116resourcestring
    117117  SPlayerWins = 'Player %s wins';
     118  SPlayersWins = 'Players %s win';
    118119  SEndGame = 'End game?';
    119120  SEndGameQuestion = 'Do you want to end current game?';
     
    127128
    128129procedure TCore.DoOnWin(Player: TPlayer);
     130var
     131  PlayerNames: string;
     132  AlivePlayers: TPlayerArray;
     133  I: Integer;
    129134begin
    130135  RedrawClients;
    131   ShowMessage(Format(SPlayerWins, [Player.Name]));
     136  if Assigned(Player) then
     137    ShowMessage(Format(SPlayerWins, [Player.Name]))
     138  else begin
     139    AlivePlayers := Game.Players.GetAlivePlayers;
     140    PlayerNames := '';
     141    for I := 0 to Length(AlivePlayers) - 1 do begin
     142      if I > 0 then PlayerNames := PlayerNames + ', ';
     143      PlayerNames := PlayerNames + AlivePlayers[I].Name;
     144    end;
     145    ShowMessage(Format(SPlayersWins, [PlayerNames]))
     146  end;
    132147end;
    133148
     
    407422  FreeAndNil(StoredDimension);
    408423  FreeAndNil(Server);
     424  FreeAndNil(Clients);
    409425  FreeAndNil(Game);
    410   FreeAndNil(Clients);
    411426end;
    412427
  • trunk/UGame.pas

    r194 r197  
    32063206    SetValue(DOMString(Path + '/GrowCells'), Integer(GrowCells));
    32073207    SetValue(DOMString(Path + '/WinObjective'), Integer(WinObjective));
     3208    SetValue(DOMString(Path + '/StayAliveForDefinedTurns'), StayAliveForDefinedTurns);
    32083209    PlayersSetting.SaveConfig(Config, Path + '/Players');
    32093210  end;
     
    32383239    if (Value >= Integer(Low(TWinObjective))) and (Value <= Integer(High(TWinObjective))) then
    32393240      WinObjective := TWinObjective(Value) else WinObjective := Low(TWinObjective);
     3241    StayAliveForDefinedTurns := GetValue(DOMString(Path + '/StayAliveForDefinedTurns'), 20);
    32403242    PlayersSetting.LoadConfig(Config, Path + '/Players');
    32413243  end;
     
    34313433  end else
    34323434  if WinObjective = woStayAliveForDefinedTurns then begin
    3433     // TODO: Not only one can win but multiple human players can survive.
    34343435    if TurnCounter > StayAliveForDefinedTurns then
    34353436      EndGame(nil);
     
    35223523begin
    35233524  Running := False;
    3524   if Assigned(OnWin) and Assigned(Winner) then OnWin(Winner);
     3525  if Assigned(OnWin) then OnWin(Winner);
    35253526end;
    35263527
Note: See TracChangeset for help on using the changeset viewer.