Changeset 3038 for code/trunk/src/orxonox/objects/infos
- Timestamp:
- May 24, 2009, 5:42:50 PM (16 years ago)
- Location:
- code/trunk/src/orxonox/objects/infos
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/orxonox/objects/infos/PlayerInfo.cc
r2973 r3038 62 62 if (this->BaseObject::isInitialized()) 63 63 { 64 this->stopControl( this->controllableEntity_);64 this->stopControl(); 65 65 66 66 if (this->controller_) … … 142 142 } 143 143 144 void PlayerInfo::startControl(ControllableEntity* entity , bool callback)145 { 146 if ( entity == this->controllableEntity_)144 void PlayerInfo::startControl(ControllableEntity* entity) 145 { 146 if (!entity || entity == this->controllableEntity_) 147 147 return; 148 148 149 149 if (this->controllableEntity_) 150 this->stopControl( this->controllableEntity_, callback);150 this->stopControl(); 151 151 152 152 this->controllableEntity_ = entity; 153 154 if (entity) 155 { 156 this->controllableEntityID_ = entity->getObjectID(); 157 entity->setPlayer(this); 158 this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_); 159 } 160 else 161 { 162 this->controllableEntityID_ = OBJECTID_UNKNOWN; 163 } 153 this->controllableEntityID_ = entity->getObjectID(); 154 155 entity->setPlayer(this); 156 157 this->bReadyToSpawn_ &= (!this->bSetUnreadyAfterSpawn_); 164 158 165 159 if (this->controller_) … … 169 163 } 170 164 171 void PlayerInfo::stopControl(ControllableEntity* entity, bool callback) 172 { 173 if (entity && this->controllableEntity_ == entity) 174 { 175 this->controllableEntity_ = 0; 176 this->controllableEntityID_ = OBJECTID_UNKNOWN; 177 178 if (this->controller_) 179 this->controller_->setControllableEntity(0); 180 181 if (callback) 182 entity->removePlayer(); 183 184 this->changedControllableEntity(); 185 } 165 void PlayerInfo::stopControl() 166 { 167 ControllableEntity* entity = this->controllableEntity_; 168 169 if (!entity) 170 return; 171 172 this->controllableEntity_ = 0; 173 this->controllableEntityID_ = OBJECTID_UNKNOWN; 174 175 if (this->controller_) 176 this->controller_->setControllableEntity(0); 177 178 entity->removePlayer(); 179 180 this->changedControllableEntity(); 186 181 } 187 182 … … 192 187 Synchronisable* temp = Synchronisable::getSynchronisable(this->controllableEntityID_); 193 188 ControllableEntity* entity = dynamic_cast<ControllableEntity*>(temp); 194 195 189 this->startControl(entity); 196 190 } 197 191 else 198 192 { 199 this->stopControl( this->controllableEntity_);193 this->stopControl(); 200 194 } 201 195 } -
code/trunk/src/orxonox/objects/infos/PlayerInfo.h
r2973 r3038 68 68 { return this->bReadyToSpawn_; } 69 69 70 void startControl(ControllableEntity* entity , bool callback = true);71 void stopControl( ControllableEntity* entity, bool callback = true);70 void startControl(ControllableEntity* entity); 71 void stopControl(); 72 72 73 73 inline ControllableEntity* getControllableEntity() const
Note: See TracChangeset
for help on using the changeset viewer.