Changeset 6082 for code/branches/particles2/src/orxonox/infos/PlayerInfo.cc
- Timestamp:
- Nov 17, 2009, 10:57:44 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/particles2/src/orxonox/infos/PlayerInfo.cc
r5929 r6082 163 163 this->changedControllableEntity(); 164 164 } 165 166 void PlayerInfo::startTemporaryControl(ControllableEntity* entity) 167 { 168 if (!entity || entity == this->controllableEntity_) 169 return; 170 171 // if (this->controllableEntity_) 172 // this->stopControl(); 173 174 this->oldControllableEntity_ = this->controllableEntity_; 175 176 this->controllableEntity_ = entity; 177 this->controllableEntityID_ = entity->getObjectID(); 178 179 entity->setPlayer(this); 180 181 this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_); 182 183 if (this->controller_) 184 this->controller_->setControllableEntity(entity); 185 186 this->changedControllableEntity(); 187 } 165 188 166 189 void PlayerInfo::stopControl() … … 178 201 179 202 entity->removePlayer(); 180 203 204 if ( this->oldControllableEntity_ ) 205 { 206 this->oldControllableEntity_->removePlayer(); 207 this->oldControllableEntity_ = 0; 208 } 209 210 this->changedControllableEntity(); 211 } 212 213 void PlayerInfo::stopTemporaryControl() 214 { 215 ControllableEntity* entity = this->controllableEntity_; 216 217 if (!entity) 218 return; 219 220 this->controllableEntity_ = this->oldControllableEntity_.get(); 221 this->controllableEntityID_ = this->controllableEntity_->getObjectID(); 222 223 if (this->controller_) 224 this->controller_->setControllableEntity(this->controllableEntity_); 225 226 entity->removePlayer(); 227 181 228 this->changedControllableEntity(); 182 229 }
Note: See TracChangeset
for help on using the changeset viewer.