Changeset 1d96513 in network-game for common/Game.cpp


Ignore:
Timestamp:
Dec 22, 2013, 2:57:04 AM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
45734ff
Parents:
483a2cb
Message:

Game class includes projectile list

File:
1 edited

Legend:

Unmodified
Added
Removed
  • common/Game.cpp

    r483a2cb r1d96513  
    3737}
    3838
     39map<unsigned int, Projectile>& Game::getProjectiles() {
     40   return this->projectiles;
     41}
     42
    3943int Game::getRedScore() {
    4044   return this->redScore;
     
    5155void Game::setId(unsigned int id) {
    5256   this->id = id;
     57}
     58
     59void Game::setRedScore(int score) {
     60   this->redScore = score;
     61}
     62
     63void Game::setBlueScore(int score) {
     64   this->blueScore = score;
    5365}
    5466
     
    147159}
    148160
    149 void Game::setRedScore(int score) {
    150    this->redScore = score;
     161bool 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;
    151168}
    152169
    153 void Game::setBlueScore(int score) {
    154    this->blueScore = score;
     170bool Game::removeProjectile(unsigned int id) {
     171   if (projectiles.erase(id) == 1)
     172      return true;
     173   else
     174      return false;
    155175}
Note: See TracChangeset for help on using the changeset viewer.