Add more code to units to help distinguish between types and visual values
This commit is contained in:
parent
ea426c70c6
commit
9fc5f33de8
8 changed files with 67 additions and 29 deletions
|
@ -13,7 +13,7 @@ CBoard::CBoard( unsigned int c, unsigned int r )
|
|||
|
||||
|
||||
// constructor
|
||||
CBoard::CBoard( unsigned int c, unsigned int r, vunit_c&& b )
|
||||
CBoard::CBoard( unsigned int c, unsigned int r, vunitType_c&& b )
|
||||
: cols ( c )
|
||||
, rows ( r )
|
||||
, total ( rows * cols )
|
||||
|
@ -23,7 +23,7 @@ CBoard::CBoard( unsigned int c, unsigned int r, vunit_c&& b )
|
|||
}
|
||||
|
||||
// print get a slot on the board
|
||||
unit_c CBoard::get( const unsigned int c, const unsigned int r ) const
|
||||
unitType_c CBoard::get( const unsigned int c, const unsigned int r ) const
|
||||
{
|
||||
if ( (r >= rows) || (c >= cols) )
|
||||
return square_invalid;
|
||||
|
@ -32,12 +32,12 @@ unit_c CBoard::get( const unsigned int c, const unsigned int r ) const
|
|||
}
|
||||
|
||||
// Get a square on the board
|
||||
unit_c CBoard::set( const unsigned int c, const unsigned int r , const unit_c n )
|
||||
unitType_c CBoard::set( const unsigned int c, const unsigned int r , const unitType_c n )
|
||||
{
|
||||
if ( (r >= rows) || (c >= cols) )
|
||||
return square_invalid;
|
||||
|
||||
unit_c old = board[r*c];
|
||||
unitType_c old = board[r*c];
|
||||
board[r*c] = n;
|
||||
return old;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue