- Timestamp:
- Sep 26, 2013, 3:33:18 AM (11 years ago)
- Branches:
- master
- Children:
- 2992b1a
- Parents:
- 99afbb8
- Location:
- common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Game.cpp
r99afbb8 r2ee386d 20 20 } 21 21 22 int Game::getNumPlayers() { 23 return players.size(); 24 } 25 26 void Game::setNumPlayers(int numPlayers) { 27 int numCurPlayers = this->getNumPlayers(); 28 int numNewPlayers = numPlayers-numCurPlayers; 29 30 for (int i=0; i<numNewPlayers; i++) 31 this->players[numCurPlayers+i] = NULL; 32 } 33 22 34 bool Game::addPlayer(Player* p) { 23 35 if (players.count(p->id) == 0) { … … 35 47 return false; 36 48 } 37 38 int Game::getNumPlayers() {39 return players.size();40 } -
common/Game.h
r99afbb8 r2ee386d 30 30 ~Game(); 31 31 32 int getNumPlayers(); 33 32 34 void setId(int id); 33 35 void setNumPlayers(int numPlayers); 34 36 bool addPlayer(Player* p); 35 37 bool removePlayer(int id); 36 int getNumPlayers();37 38 }; 38 39
Note:
See TracChangeset
for help on using the changeset viewer.