use uvec unstead of two params, simplifies things

This commit is contained in:
Marc Di Luzio 2014-12-16 13:13:01 +00:00
parent 5e950528c1
commit 0700a13129
2 changed files with 6 additions and 5 deletions

View file

@ -73,7 +73,7 @@ int CTTRTSGame::AddUnit( std::shared_ptr<CUnit> unit )
// Verify if the unit can be placed on the current board // Verify if the unit can be placed on the current board
const uvector2 pos = unit->getPos(); const uvector2 pos = unit->getPos();
if( (pos.x < cols) && (pos.y < rows) ) if( (pos.x < dimentions.x) && (pos.y < dimentions.y) )
return 1; return 1;
m_allUnits.push_back(unit); m_allUnits.push_back(unit);

View file

@ -14,8 +14,7 @@ class CTTRTSGame
public: public:
CTTRTSGame( ucoord_t c, ucoord_t r ) CTTRTSGame( ucoord_t c, ucoord_t r )
: cols (c) : dimentions( {c,r} )
, rows (r)
{ {
} }
@ -50,6 +49,9 @@ public:
// Get orders by index as above // Get orders by index as above
inline const COrder& GetOrdersByIndex( unsigned int i ) const { return m_orders[i]; } inline const COrder& GetOrdersByIndex( unsigned int i ) const { return m_orders[i]; }
// Get dimentions
inline const uvector2& GetDimentions() const { return dimentions; };
private: private:
@ -72,8 +74,7 @@ private:
COrderVector m_orders; COrderVector m_orders;
// Dimensions of the game // Dimensions of the game
ucoord_t rows; uvector2 dimentions;
ucoord_t cols;
}; };
#endif //_GAME_H_ #endif //_GAME_H_