Final bit of design doe the game class, should be enough of a final interface to get started on implementation

This commit is contained in:
Marc Di Luzio 2014-12-16 13:12:58 +00:00
parent 2abd4ad832
commit 108be3035f
2 changed files with 28 additions and 17 deletions

View file

@ -1,8 +1 @@
#include "game.h"
// Initialise the game with default configuration
void CTTRTSGame::Initialise()
{
}

View file

@ -13,18 +13,29 @@ class CTTRTSGame
{
public:
CTTRTSGame();
CTTRTSGame( ucoord_t c, ucoord_t r )
: cols (c)
, rows (r)
{
}
// Default dtor
~CTTRTSGame() = default;
// Initialise the game with default configuration
void Initialise();
// Issue orders to the game
bool IssueOrders( std::string orders );
bool IssueOrders( COrderVector orders );
// Issue orders to the game, returns non-zero if orders are incorrect
int IssueOrders( player_id_t player, std::string orders );
int IssueOrders( player_id_t player, COrderVector orders );
// Simulate and progress to the next turn
bool NextTurn();
// Returns non-zero if simulation failed
int SimulateToNextTurn();
// Add a unit, nonzero return value indicates error
int AddUnit( std::shared_ptr<CUnit> unit );
// Add a units, nonzero return value indicates error
int AddUnits( sharedUnitVector_t units );
// Get the number of units
inline unsigned int GetNumUnits() const { return m_allUnits.size(); }
@ -46,11 +57,18 @@ private:
// Simulate all actions
bool SimulateActions();
// Verify any order
bool VerifyOrder( player_id_t player, COrder& order );
// Vector to store points to all units
sharedUnitVector_t m_allUnits;
sharedUnitVector_t m_allUnits;
// Orders to execute this turn
COrderVector m_orders;
COrderVector m_orders;
// Dimensions of the game
ucoord_t rows;
ucoord_t cols;
};
#endif //_GAME_H_