Changeset 6087 for code/branches/particles2/src/orxonox
- Timestamp:
- Nov 18, 2009, 1:34:14 PM (15 years ago)
- Location:
- code/branches/particles2/src/orxonox
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/particles2/src/orxonox/Scene.cc
r5929 r6087 334 334 { 335 335 // get the WorldEntity pointers 336 WorldEntity* object0 = static_cast<WorldEntity*>(colObj0->getUserPointer()); 337 assert(orxonox_cast<WorldEntity*>(object0)); 338 WorldEntity* object1 = static_cast<WorldEntity*>(colObj1->getUserPointer()); 339 assert(orxonox_cast<WorldEntity*>(object1)); 336 SmartPtr<WorldEntity> object0 = static_cast<WorldEntity*>(colObj0->getUserPointer()); 337 SmartPtr<WorldEntity> object1 = static_cast<WorldEntity*>(colObj1->getUserPointer()); 340 338 341 339 // false means that bullet will assume we didn't modify the contact -
code/branches/particles2/src/orxonox/controllers/AIController.cc
r5929 r6087 109 109 110 110 if (this->getControllableEntity() && this->bShooting_ && this->isCloseAtTarget(1000) && this->isLookingAtTarget(Ogre::Math::PI / 20.0f)) 111 this->getControllableEntity()->fire(0);111 // this->getControllableEntity()->fire(0); 112 112 113 113 SUPER(AIController, tick, dt); -
code/branches/particles2/src/orxonox/infos/PlayerInfo.cc
r6082 r6087 50 50 this->controller_ = 0; 51 51 this->controllableEntity_ = 0; 52 this->controllableEntityID_ = CLIENTID_UNKNOWN; 52 this->controllableEntityID_ = OBJECTID_UNKNOWN; 53 this->temporaryControllableEntity_ = 0; 54 this->temporaryControllableEntityID_ = OBJECTID_UNKNOWN; 53 55 54 56 this->gtinfo_ = 0; … … 80 82 registerVariable(this->name_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::changedName)); 81 83 registerVariable(this->controllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 84 registerVariable(this->temporaryControllableEntityID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedcontrollableentityID)); 82 85 registerVariable(this->bReadyToSpawn_, VariableDirection::ToServer); 83 86 registerVariable(this->gtinfoID_, VariableDirection::ToClient, new NetworkCallback<PlayerInfo>(this, &PlayerInfo::networkcallback_changedgtinfoID)); … … 166 169 void PlayerInfo::startTemporaryControl(ControllableEntity* entity) 167 170 { 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(); 171 if (!entity) 172 return; 173 174 assert( this->temporaryControllableEntity_==0 ); 175 176 this->temporaryControllableEntity_ = entity; 177 this->temporaryControllableEntityID_ = entity->getObjectID(); 178 178 179 179 entity->setPlayer(this); … … 201 201 202 202 entity->removePlayer(); 203 204 if ( this->oldControllableEntity_ )205 {206 this->oldControllableEntity_->removePlayer();207 this->oldControllableEntity_ = 0;208 }209 203 210 204 this->changedControllableEntity(); … … 213 207 void PlayerInfo::stopTemporaryControl() 214 208 { 215 ControllableEntity* entity = this-> controllableEntity_;209 ControllableEntity* entity = this->temporaryControllableEntity_; 216 210 217 211 if (!entity) 218 212 return; 219 213 220 this-> controllableEntity_ = this->oldControllableEntity_.get();221 this-> controllableEntityID_ = this->controllableEntity_->getObjectID();222 223 if ( this->controller_)214 this->temporaryControllableEntity_ = 0; 215 this->temporaryControllableEntityID_ = OBJECTID_UNKNOWN; 216 217 if ( this->controllableEntity_ && this->controller_) 224 218 this->controller_->setControllableEntity(this->controllableEntity_); 225 219 … … 228 222 this->changedControllableEntity(); 229 223 } 230 224 231 225 void PlayerInfo::networkcallback_changedcontrollableentityID() 232 226 { … … 243 237 } 244 238 239 void PlayerInfo::networkcallback_changedtemporarycontrollableentityID() 240 { 241 CCOUT(0) << "changedtemporarycontrollableentityid" << endl; 242 if (this->temporaryControllableEntityID_ != OBJECTID_UNKNOWN) 243 { 244 Synchronisable* temp = Synchronisable::getSynchronisable(this->temporaryControllableEntityID_); 245 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(temp); 246 this->startTemporaryControl(entity); 247 } 248 else 249 { 250 this->stopTemporaryControl(); 251 } 252 } 253 254 245 255 void PlayerInfo::networkcallback_changedgtinfoID() 246 256 { 257 CCOUT(0) << "changedcontrollableentityid" << endl; 247 258 if (this->gtinfoID_ != OBJECTID_UNKNOWN) 248 259 { -
code/branches/particles2/src/orxonox/infos/PlayerInfo.h
r6082 r6087 92 92 private: 93 93 void networkcallback_changedcontrollableentityID(); 94 void networkcallback_changedtemporarycontrollableentityID(); 94 95 void networkcallback_changedgtinfoID(); 95 96 void updateGametypeInfo(); … … 98 99 Controller* controller_; 99 100 ControllableEntity* controllableEntity_; 100 WeakPtr<ControllableEntity> oldControllableEntity_;101 ControllableEntity* temporaryControllableEntity_; 101 102 unsigned int controllableEntityID_; 103 unsigned int temporaryControllableEntityID_; 102 104 103 105 const GametypeInfo* gtinfo_;
Note: See TracChangeset
for help on using the changeset viewer.