Changeset 7885 for code/trunk
- Timestamp:
- Feb 14, 2011, 3:27:56 PM (14 years ago)
- Location:
- code/trunk/src/modules/pong
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/pong/PongBall.cc
r7852 r7885 48 48 this->accelerationFactor_ = 1.0f; 49 49 this->bat_ = 0; 50 this->bDeleteBats_ = false; 50 51 this->batID_ = new unsigned int[2]; 51 52 this->batID_[0] = OBJECTID_UNKNOWN; … … 58 59 PongBall::~PongBall() 59 60 { 61 if (this->isInitialized()) 62 { 63 if (this->bDeleteBats_) 64 delete[] this->bat_; 65 66 delete[] this->batID_; 67 } 60 68 } 61 69 … … 167 175 void PongBall::setBats(WeakPtr<PongBat>* bats) 168 176 { 177 if (this->bDeleteBats_) 178 { 179 delete[] this->bat_; 180 this->bDeleteBats_ = false; 181 } 182 169 183 this->bat_ = bats; 170 184 this->batID_[0] = this->bat_[0]->getObjectID(); … … 175 189 { 176 190 if (!this->bat_) 177 this->bat_ = new WeakPtr<PongBat>[2]; // TODO: delete this somewhere 191 { 192 if (this->bDeleteBats_) 193 delete[] this->bat_; 194 else 195 this->bDeleteBats_ = true; 196 197 this->bat_ = new WeakPtr<PongBat>[2]; 198 } 199 178 200 if (this->batID_[0] != OBJECTID_UNKNOWN) 179 201 this->bat_[0] = orxonox_cast<PongBat*>(Synchronisable::getSynchronisable(this->batID_[0])); -
code/trunk/src/modules/pong/PongBall.h
r7852 r7885 80 80 float batlength_; 81 81 WeakPtr<PongBat>* bat_; 82 bool bDeleteBats_; 82 83 unsigned int* batID_; 83 84 float relMercyOffset_;
Note: See TracChangeset
for help on using the changeset viewer.