diff --git a/game/game.cpp b/game/game.cpp index b52b671..20c6801 100644 --- a/game/game.cpp +++ b/game/game.cpp @@ -73,7 +73,7 @@ int CTTRTSGame::AddUnit( std::shared_ptr unit ) // Verify if the unit can be placed on the current board const uvector2 pos = unit->getPos(); - if( (pos.x < cols) && (pos.y < rows) ) + if( (pos.x < dimentions.x) && (pos.y < dimentions.y) ) return 1; m_allUnits.push_back(unit); diff --git a/game/game.h b/game/game.h index b4d0857..883b347 100644 --- a/game/game.h +++ b/game/game.h @@ -14,8 +14,7 @@ class CTTRTSGame public: CTTRTSGame( ucoord_t c, ucoord_t r ) - : cols (c) - , rows (r) + : dimentions( {c,r} ) { } @@ -50,6 +49,9 @@ public: // Get orders by index as above inline const COrder& GetOrdersByIndex( unsigned int i ) const { return m_orders[i]; } + + // Get dimentions + inline const uvector2& GetDimentions() const { return dimentions; }; private: @@ -72,8 +74,7 @@ private: COrderVector m_orders; // Dimensions of the game - ucoord_t rows; - ucoord_t cols; + uvector2 dimentions; }; #endif //_GAME_H_ \ No newline at end of file