Changeset 20 for trunk/UGame.pas


Ignore:
Timestamp:
Mar 1, 2014, 11:18:26 AM (11 years ago)
Author:
chronos
Message:
  • Added: Build modes Debug and Release in project settings.
  • Modified: Show game board only if game is in Running state.
  • Added: Keep board center during main form resize.
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

    • Property svn:ignore
      •  

        old new  
        33lib
        44xtactics.res
         5xtactics.dbg
  • trunk/UGame.pas

    r19 r20  
    112112    FOnMove: TMoveEvent;
    113113    FOnWin: TWinEvent;
     114    FRunning: Boolean;
    114115    procedure MoveAll(Player: TPlayer);
    115116    procedure SetMove(CellFrom, CellTo: TCell);
     117    procedure SetRunning(AValue: Boolean);
    116118  public
    117119    Players: TPlayers;
     
    121123    Moves: TObjectList; // TList<TMove>
    122124    TurnCounter: Integer;
    123     Running: Boolean;
     125
    124126    procedure ComputePlayerStats;
    125127    procedure NextTurn;
     
    127129    destructor Destroy; override;
    128130    procedure New;
     131    property Running: Boolean read FRunning write SetRunning;
    129132  published
    130133    property OnMove: TMoveEvent read FOnMove write FOnMove;
     
    343346end;
    344347
     348procedure TGame.SetRunning(AValue: Boolean);
     349begin
     350  if FRunning = AValue then Exit;
     351  if AValue then begin
     352    if Players.Count < 2 then raise Exception.Create('You need at least two players');
     353    FRunning := AValue;
     354  end else FRunning := AValue;
     355end;
     356
    345357procedure TGame.ComputePlayerStats;
    346358var
     
    454466  end;
    455467  CurrentPlayer := TPlayer(Players[0]);
    456   Running := True;
    457468end;
    458469
Note: See TracChangeset for help on using the changeset viewer.