- Timestamp:
- Dec 22, 2013, 2:57:04 AM (11 years ago)
- Branches:
- master
- Children:
- 45734ff
- Parents:
- 483a2cb
- Location:
- common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
common/Game.cpp
r483a2cb r1d96513 37 37 } 38 38 39 map<unsigned int, Projectile>& Game::getProjectiles() { 40 return this->projectiles; 41 } 42 39 43 int Game::getRedScore() { 40 44 return this->redScore; … … 51 55 void Game::setId(unsigned int id) { 52 56 this->id = id; 57 } 58 59 void Game::setRedScore(int score) { 60 this->redScore = score; 61 } 62 63 void Game::setBlueScore(int score) { 64 this->blueScore = score; 53 65 } 54 66 … … 147 159 } 148 160 149 void Game::setRedScore(int score) { 150 this->redScore = score; 161 bool Game::addProjectile(Projectile p) { 162 if (projectiles.find(p.id) == projectiles.end()) { 163 projectiles[p.id] = p; 164 return true; 165 } 166 else 167 return false; 151 168 } 152 169 153 void Game::setBlueScore(int score) { 154 this->blueScore = score; 170 bool Game::removeProjectile(unsigned int id) { 171 if (projectiles.erase(id) == 1) 172 return true; 173 else 174 return false; 155 175 } -
common/Game.h
r483a2cb r1d96513 13 13 #include "Player.h" 14 14 #include "WorldMap.h" 15 #include "Projectile.h" 15 16 16 17 using namespace std; … … 21 22 string name; 22 23 map<unsigned int, Player*> players; 24 map<unsigned int, Projectile> projectiles; 23 25 WorldMap* worldMap; 24 26 int blueScore; … … 34 36 int getNumPlayers(); 35 37 map<unsigned int, Player*>& getPlayers(); 38 map<unsigned int, Projectile>& getProjectiles(); 36 39 int getBlueScore(); 37 40 int getRedScore(); … … 39 42 40 43 void setId(unsigned int id); 44 void setBlueScore(int score); 45 void setRedScore(int score); 46 41 47 bool addPlayer(Player* p); 42 48 bool removePlayer(unsigned int id); … … 45 51 int processFlagPickupRequest(Player* p); 46 52 47 void setBlueScore(int score);48 void setRedScore(int score);53 bool addProjectile(Projectile p); 54 bool removeProjectile(unsigned int id); 49 55 }; 50 56
Note:
See TracChangeset
for help on using the changeset viewer.