From ea426c70c6947fd91022c7a654641253d5cd63fa Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Tue, 16 Dec 2014 13:12:54 +0000 Subject: [PATCH] Rename unit_t to unit_c to reflect it being a char --- game/board.cpp | 8 ++++---- game/board.h | 18 +++++++++--------- game/unit.h | 4 ++-- game/unitv.h | 2 -- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/game/board.cpp b/game/board.cpp index 35f62ad..6560498 100644 --- a/game/board.cpp +++ b/game/board.cpp @@ -13,7 +13,7 @@ CBoard::CBoard( unsigned int c, unsigned int r ) // constructor -CBoard::CBoard( unsigned int c, unsigned int r, vunit_t&& b ) +CBoard::CBoard( unsigned int c, unsigned int r, vunit_c&& b ) : cols ( c ) , rows ( r ) , total ( rows * cols ) @@ -23,7 +23,7 @@ CBoard::CBoard( unsigned int c, unsigned int r, vunit_t&& b ) } // print get a slot on the board -unit_t CBoard::get( const unsigned int c, const unsigned int r ) const +unit_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_t CBoard::get( const unsigned int c, const unsigned int r ) const } // Get a square on the board -unit_t CBoard::set( const unsigned int c, const unsigned int r , const unit_t n ) +unit_c CBoard::set( const unsigned int c, const unsigned int r , const unit_c n ) { if ( (r >= rows) || (c >= cols) ) return square_invalid; - unit_t old = board[r*c]; + unit_c old = board[r*c]; board[r*c] = n; return old; } \ No newline at end of file diff --git a/game/board.h b/game/board.h index ac03270..53d2e50 100644 --- a/game/board.h +++ b/game/board.h @@ -7,11 +7,11 @@ #include // std::numeric_limits #include // std::vector -typedef std::vector< unit_t > vunit_t; +typedef std::vector< unit_c > vunit_c; // Invalid value for the board square -constexpr unit_t square_invalid = std::numeric_limits::max(); -constexpr unit_t square_empty = 32; // 32 is ascii empty +constexpr unit_c square_invalid = std::numeric_limits::max(); +constexpr unit_c square_empty = 32; // 32 is ascii empty // Class to store simple data about a board class CBoard @@ -26,7 +26,7 @@ public: CBoard( unsigned int c, unsigned int r ); // constructor - CBoard( unsigned int c, unsigned int r, vunit_t&& b ); + CBoard( unsigned int c, unsigned int r, vunit_c&& b ); // Default destructor ~CBoard() = default; @@ -35,20 +35,20 @@ public: inline void clear() { fill(square_empty); } // fill the board - inline void fill(unit_t v) { std::fill(board.begin(),board.end(),v); }; + inline void fill(unit_c v) { std::fill(board.begin(),board.end(),v); }; // Get a square on the board - unit_t get( const unsigned int c, const unsigned int r ) const; + unit_c get( const unsigned int c, const unsigned int r ) const; // Get the full board - inline const vunit_t& get() const { return board; }; + inline const vunit_c& get() const { return board; }; // Get a square on the board - unit_t set( const unsigned int c, const unsigned int r , const unit_t n ); + unit_c set( const unsigned int c, const unsigned int r , const unit_c n ); private: - vunit_t board; // Board data storage + vunit_c board; // Board data storage }; #endif //_BOARD_H_ \ No newline at end of file diff --git a/game/unit.h b/game/unit.h index dca188d..26b097b 100644 --- a/game/unit.h +++ b/game/unit.h @@ -6,10 +6,10 @@ #include "vector2.h" // Type for the unit type-id -typedef char unit_t; +typedef char unit_c; // Base unit type -template < unit_t unit_type > +template < unit_c unit_cype > class CUnit { public: diff --git a/game/unitv.h b/game/unitv.h index 65e3607..261f9aa 100644 --- a/game/unitv.h +++ b/game/unitv.h @@ -9,8 +9,6 @@ public: CUnitV() = default; virtual ~CUnitV() = default; - virtual std::string&& getDescriptor(); - private: // V also has a direction