Changeset 16 for trunk


Ignore:
Timestamp:
Feb 19, 2014, 11:22:13 PM (11 years ago)
Author:
chronos
Message:
  • Added: Turn counter.
  • Modified: Do not play computer players by human.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/UFormMain.pas

    r15 r16  
    9494    RedrawPending := False;
    9595    PaintBox1.Repaint;
    96     Caption := Game.CurrentPlayer.Name + ' - xTactics';
     96    Caption := Game.CurrentPlayer.Name + ' - turn ' + IntToStr(Game.TurnCounter) + ' - xTactics';
    9797  end;
    9898end;
     
    131131  Game.NextTurn;
    132132  Redraw;
     133  while Game.CurrentPlayer.Mode <> pmHuman do begin
     134    Game.NextTurn;
     135    Redraw;
     136  end;
    133137end;
    134138
  • trunk/UGame.pas

    r15 r16  
    105105    CurrentPlayer: TPlayer;
    106106    Moves: TObjectList; // TList<TMove>
     107    TurnCounter: Integer;
    107108    procedure NextTurn;
    108109    constructor Create;
     
    314315  Map.Grow(CurrentPlayer);
    315316  CurrentPlayer := TPlayer(Players[(Players.IndexOf(CurrentPlayer) + 1) mod Players.Count]);
     317  if Players.IndexOf(CurrentPlayer) = 0 then Inc(TurnCounter);
    316318end;
    317319
     
    330332  Player.Game := Self;
    331333  Player.Color := clRed;
     334  Player.Mode := pmComputer;
    332335  Players.Add(Player);
    333336
     
    355358  StartCell: TCell;
    356359begin
     360  TurnCounter := 1;
    357361  Moves.Clear;
    358362  Map.ClearCellMoves;
     
    363367      else Terrain := ttNormal;
    364368    Power := Random(4);
     369    Player := nil;
    365370  end;
    366371  for I := 0 to Players.Count - 1 do
Note: See TracChangeset for help on using the changeset viewer.