- Timestamp:
- May 24, 2011, 4:44:39 PM (13 years ago)
- Location:
- code/branches/presentation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation
- Property svn:mergeinfo changed
-
code/branches/presentation/src/orxonox/infos/PlayerInfo.cc
r8327 r8561 51 51 this->controllableEntity_ = 0; 52 52 this->controllableEntityID_ = OBJECTID_UNKNOWN; 53 this->oldControllableEntity_ = 0;54 53 55 54 this->gtinfo_ = 0; … … 151 150 return; 152 151 153 if (this->oldControllableEntity_)152 while (this->previousControllableEntity_.size() > 0) 154 153 this->stopTemporaryControl(); 154 155 155 if (this->controllableEntity_) 156 156 this->stopControl(); … … 176 176 if (!entity) 177 177 return; 178 179 assert( this->oldControllableEntity_==0 ); 180 181 this->oldControllableEntity_ = this->controllableEntity_; 178 179 this->previousControllableEntity_.push_back(WeakPtr<ControllableEntity>(this->controllableEntity_)); 182 180 this->controllableEntity_ = entity; 183 181 this->controllableEntityID_ = entity->getObjectID(); … … 194 192 void PlayerInfo::stopControl() 195 193 { 196 if ( this->oldControllableEntity_)194 while ( this->previousControllableEntity_.size() > 0) 197 195 this->stopTemporaryControl(); 198 196 … … 215 213 } 216 214 215 void PlayerInfo::pauseControl() 216 { 217 ControllableEntity* entity = this->controllableEntity_; 218 219 if (!entity) 220 return; 221 222 this->controllableEntity_->getController()->setActive(false); 223 //this->controllableEntity_->getController()->setControllableEntity(NULL); 224 this->controllableEntity_->setController(0); 225 } 226 217 227 void PlayerInfo::stopTemporaryControl() 218 228 { 219 229 ControllableEntity* entity = this->controllableEntity_; 220 230 221 assert( this->controllableEntity_ && this->oldControllableEntity_);222 if( !entity || !this->oldControllableEntity_)231 assert(this->controllableEntity_ != NULL); 232 if( !entity || this->previousControllableEntity_.size() == 0 ) 223 233 return; 224 234 225 235 this->controllableEntity_->setController(0); 226 236 227 this->controllableEntity_ = this->oldControllableEntity_; 237 // this->controllableEntity_ = this->previousControllableEntity_.back(); 238 do { 239 this->controllableEntity_ = this->previousControllableEntity_.back(); 240 } while(this->controllableEntity_ == NULL && this->previousControllableEntity_.size() > 0); 228 241 this->controllableEntityID_ = this->controllableEntity_->getObjectID(); 229 this-> oldControllableEntity_ = 0;230 231 if ( this->controllableEntity_ && this->controller_)242 this->previousControllableEntity_.pop_back(); 243 244 if ( this->controllableEntity_ != NULL && this->controller_ != NULL) 232 245 this->controller_->setControllableEntity(this->controllableEntity_); 233 246
Note: See TracChangeset
for help on using the changeset viewer.