Changeset 11054 for code/branches/cpp11_v3/src/orxonox/worldentities
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 28 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/orxonox/worldentities/CameraPosition.h
r9667 r11054 41 41 virtual ~CameraPosition(); 42 42 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 44 44 45 45 inline void setDrag(bool bDrag) -
code/branches/cpp11_v3/src/orxonox/worldentities/ControllableEntity.cc
r10624 r11054 61 61 this->server_overwrite_ = 0; 62 62 this->client_overwrite_ = 0; 63 this->player_ = 0;64 this->formerPlayer_ = NULL;63 this->player_ = nullptr; 64 this->formerPlayer_ = nullptr; 65 65 this->playerID_ = OBJECTID_UNKNOWN; 66 this->hud_ = 0;67 this->camera_ = 0;68 this->xmlcontroller_ = 0;69 //this->controller_ = 0;70 this->reverseCamera_ = 0;66 this->hud_ = nullptr; 67 this->camera_ = nullptr; 68 this->xmlcontroller_ = nullptr; 69 //this->controller_ = nullptr; 70 this->reverseCamera_ = nullptr; 71 71 this->bDestroyWhenPlayerLeft_ = false; 72 72 this->cameraPositionRootNode_ = this->node_->createChildSceneNode(); 73 this->currentCameraPosition_ = 0;73 this->currentCameraPosition_ = nullptr; 74 74 this->bMouseLook_ = false; 75 75 this->mouseLookSpeed_ = 200; … … 108 108 this->camera_->destroy(); 109 109 110 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)111 (*it)->destroy();110 for (CameraPosition* cameraPosition : this->cameraPositions_) 111 cameraPosition->destroy(); 112 112 113 113 if (this->getScene()->getSceneManager()) … … 165 165 { 166 166 unsigned int i = 0; 167 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)167 for (CameraPosition* cameraPosition : this->cameraPositions_) 168 168 { 169 169 if (i == index) 170 return (*it);170 return cameraPosition; 171 171 ++i; 172 172 } 173 return 0;173 return nullptr; 174 174 } 175 175 … … 180 180 181 181 unsigned int counter = 0; 182 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)183 { 184 if ( (*it)== this->currentCameraPosition_)182 for (CameraPosition* cameraPosition : this->cameraPositions_) 183 { 184 if (cameraPosition == this->currentCameraPosition_) 185 185 break; 186 186 counter++; … … 194 194 bool ControllableEntity::setCameraPosition(unsigned int index) 195 195 { 196 if(this->camera_ != NULL&& this->cameraPositions_.size() > 0)196 if(this->camera_ != nullptr && this->cameraPositions_.size() > 0) 197 197 { 198 198 if(index >= this->cameraPositions_.size()) … … 219 219 else if (this->cameraPositions_.size() > 0) 220 220 { 221 for (std::list<StrongPtr<CameraPosition> 221 for (std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it) 222 222 { 223 223 if ((*it) == this->camera_->getParent()) … … 241 241 { 242 242 this->camera_->attachToNode(this->cameraPositionRootNode_); 243 this->currentCameraPosition_ = 0;243 this->currentCameraPosition_ = nullptr; 244 244 } 245 245 … … 321 321 if ( !GameMode::isMaster() ) 322 322 { 323 if ( target != 0)323 if ( target != nullptr ) 324 324 { 325 325 callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() ); … … 350 350 this->bHasLocalController_ = player->isLocalPlayer(); 351 351 this->bHasHumanController_ = player->isHumanPlayer(); 352 if(controller_ != NULL)352 if(controller_ != nullptr) 353 353 this->team_ = controller_->getTeam(); // forward controller team number 354 354 … … 372 372 this->stopLocalHumanControl(); 373 373 374 this->player_ = 0;374 this->player_ = nullptr; 375 375 this->playerID_ = OBJECTID_UNKNOWN; 376 376 this->bHasLocalController_ = false; … … 411 411 { 412 412 this->camera_->attachToNode(this->cameraPositionRootNode_); 413 this->currentCameraPosition_ = 0;413 this->currentCameraPosition_ = nullptr; 414 414 } 415 415 } … … 434 434 void ControllableEntity::destroyHud(void) 435 435 { 436 if (this->hud_ != NULL)436 if (this->hud_ != nullptr) 437 437 { 438 438 this->hud_->destroy(); 439 this->hud_ = NULL;439 this->hud_ = nullptr; 440 440 } 441 441 } … … 447 447 this->camera_->detachFromParent(); 448 448 this->camera_->destroy(); 449 this->camera_ = 0;449 this->camera_ = nullptr; 450 450 } 451 451 … … 453 453 { 454 454 this->hud_->destroy(); 455 this->hud_ = 0;455 this->hud_ = nullptr; 456 456 } 457 457 } … … 477 477 if (parent) 478 478 { 479 for ( std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)480 if ( (*it)->getIsAbsolute())481 parent->attach( (*it));479 for (CameraPosition* cameraPosition : this->cameraPositions_) 480 if (cameraPosition->getIsAbsolute()) 481 parent->attach(cameraPosition); 482 482 } 483 483 } -
code/branches/cpp11_v3/src/orxonox/worldentities/ControllableEntity.h
r10624 r11054 54 54 virtual ~ControllableEntity(); 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;57 virtual void tick(float dt) ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 virtual void tick(float dt) override; 58 58 void setConfigValues(); 59 59 … … 121 121 void addCameraPosition(CameraPosition* position); 122 122 CameraPosition* getCameraPosition(unsigned int index) const; 123 inline const std::list<StrongPtr<CameraPosition> 123 inline const std::list<StrongPtr<CameraPosition>>& getCameraPositions() const 124 124 { return this->cameraPositions_; } 125 125 unsigned int getCurrentCameraIndex() const; … … 141 141 using MobileEntity::setAngularVelocity; 142 142 143 v oid setPosition(const Vector3& position);144 v oid setOrientation(const Quaternion& orientation);145 v oid setVelocity(const Vector3& velocity);146 v oid setAngularVelocity(const Vector3& velocity);143 virtual void setPosition(const Vector3& position) override; 144 virtual void setOrientation(const Quaternion& orientation) override; 145 virtual void setVelocity(const Vector3& velocity) override; 146 virtual void setAngularVelocity(const Vector3& velocity) override; 147 147 148 148 inline bool hasLocalController() const … … 177 177 178 178 protected: 179 virtual void preDestroy() ;179 virtual void preDestroy() override; 180 180 181 181 virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead … … 184 184 virtual void startLocalHumanControl(); 185 185 virtual void stopLocalHumanControl(); 186 virtual void parentChanged() ;186 virtual void parentChanged() override; 187 187 188 188 inline void setHudTemplate(const std::string& name) … … 214 214 215 215 // Bullet btMotionState related 216 v oid setWorldTransform(const btTransform& worldTrans);216 virtual void setWorldTransform(const btTransform& worldTrans) override; 217 217 218 218 unsigned int server_overwrite_; … … 242 242 bool bMouseLook_; 243 243 float mouseLookSpeed_; 244 std::list<StrongPtr<CameraPosition> 244 std::list<StrongPtr<CameraPosition>> cameraPositions_; 245 245 CameraPosition* currentCameraPosition_; 246 246 std::string cameraPositionTemplate_; -
code/branches/cpp11_v3/src/orxonox/worldentities/Drone.cc
r9667 r11054 30 30 31 31 #include "core/XMLPort.h" 32 #include "core/CoreIncludes.h" 32 33 #include "BulletDynamics/Dynamics/btRigidBody.h" 33 34 … … 43 44 RegisterObject(Drone); 44 45 45 this->myController_ = 0;46 this->myController_ = nullptr; 46 47 47 48 this->localLinearAcceleration_.setValue(0, 0, 0); -
code/branches/cpp11_v3/src/orxonox/worldentities/Drone.h
r9667 r11054 50 50 virtual ~Drone(); 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a Drone through XML.53 virtual void tick(float dt) ; //!< Defines which actions the Drone has to take in each tick.52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Drone through XML. 53 virtual void tick(float dt) override; //!< Defines which actions the Drone has to take in each tick. 54 54 55 55 56 virtual void moveFrontBack(const Vector2& value) ;57 virtual void moveRightLeft(const Vector2& value) ;58 virtual void moveUpDown(const Vector2& value) ;56 virtual void moveFrontBack(const Vector2& value) override; 57 virtual void moveRightLeft(const Vector2& value) override; 58 virtual void moveUpDown(const Vector2& value) override; 59 59 60 virtual void rotateYaw(const Vector2& value) ;61 virtual void rotatePitch(const Vector2& value) ;62 virtual void rotateRoll(const Vector2& value) ;60 virtual void rotateYaw(const Vector2& value) override; 61 virtual void rotatePitch(const Vector2& value) override; 62 virtual void rotateRoll(const Vector2& value) override; 63 63 64 64 /** -
code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.cc
r9667 r11054 44 44 EffectContainer::EffectContainer(Context* context) 45 45 : BaseObject(context) 46 , lua_( NULL)46 , lua_(nullptr) 47 47 { 48 48 RegisterObject(EffectContainer); … … 89 89 { 90 90 unsigned int i = 0; 91 for ( std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)91 for (WorldEntity* effect : this->effects_) 92 92 if (i == index) 93 return (*it);94 return NULL;93 return effect; 94 return nullptr; 95 95 } 96 96 … … 103 103 bool result = (bool)lua_toboolean(this->lua_->getInternalLuaState(), -1); 104 104 lua_pop(this->lua_->getInternalLuaState(), 1); 105 for ( std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)105 for (WorldEntity* effect : this->effects_) 106 106 { 107 (*it)->setMainState(result);107 effect->setMainState(result); 108 108 } 109 109 } -
code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.h
r9667 r11054 43 43 virtual ~EffectContainer(); 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 47 47 void setLuaState(LuaState* state, const std::string& functionName); -
code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionChunk.cc
r9667 r11054 62 62 { 63 63 orxout(internal_error) << "Couldn't load particle effect in ExplosionChunk: " << ex.what() << endl; 64 this->fire_ = 0;65 this->smoke_ = 0;64 this->fire_ = nullptr; 65 this->smoke_ = nullptr; 66 66 } 67 67 } 68 68 else 69 69 { 70 this->fire_ = 0;71 this->smoke_ = 0;70 this->fire_ = nullptr; 71 this->smoke_ = nullptr; 72 72 } 73 73 -
code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionChunk.h
r9667 r11054 43 43 virtual ~ExplosionChunk(); 44 44 45 virtual void tick(float dt) ;45 virtual void tick(float dt) override; 46 46 47 47 inline void setLOD(LODParticle::Value level) -
code/branches/cpp11_v3/src/orxonox/worldentities/MobileEntity.h
r11052 r11054 57 57 virtual ~MobileEntity(); 58 58 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;60 virtual void tick(float dt) ;59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 60 virtual void tick(float dt) override; 61 61 62 virtual void setPosition(const Vector3& position) ;63 virtual void setOrientation(const Quaternion& orientation) ;62 virtual void setPosition(const Vector3& position) override; 63 virtual void setOrientation(const Quaternion& orientation) override; 64 64 65 65 virtual void setVelocity(const Vector3& velocity); 66 66 inline void setVelocity(float x, float y, float z) 67 67 { this->setVelocity(Vector3(x, y, z)); } 68 inline const Vector3& getVelocity() const68 virtual inline const Vector3& getVelocity() const override 69 69 { return this->linearVelocity_; } 70 70 /** … … 110 110 protected: 111 111 // Bullet btMotionState related 112 virtual void setWorldTransform(const btTransform& worldTrans) ;113 v oid getWorldTransform(btTransform& worldTrans) const;112 virtual void setWorldTransform(const btTransform& worldTrans) override; 113 virtual void getWorldTransform(btTransform& worldTrans) const override; 114 114 115 115 Vector3 linearAcceleration_; … … 119 119 120 120 private: 121 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const ;121 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const override; 122 122 }; 123 123 } -
code/branches/cpp11_v3/src/orxonox/worldentities/MovableEntity.cc
r11018 r11054 50 50 this->overwrite_orientation_ = Quaternion::IDENTITY; 51 51 52 this->continuousResynchroTimer_ = 0;52 this->continuousResynchroTimer_ = nullptr; 53 53 54 54 this->setPriority(Priority::Low); … … 80 80 { 81 81 float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length(); 82 victim->hit( 0, contactPoint, ownCollisionShape, damage);82 victim->hit(nullptr, contactPoint, ownCollisionShape, damage); 83 83 } 84 84 } -
code/branches/cpp11_v3/src/orxonox/worldentities/MovableEntity.h
r10216 r11054 46 46 virtual ~MovableEntity(); 47 47 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 50 50 51 51 using WorldEntity::setPosition; 52 52 using WorldEntity::setOrientation; 53 53 54 inline void setPosition(const Vector3& position)54 virtual inline void setPosition(const Vector3& position) override 55 55 { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); } 56 inline void setOrientation(const Quaternion& orientation)56 virtual inline void setOrientation(const Quaternion& orientation) override 57 57 { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); } 58 58 … … 79 79 private: 80 80 void registerVariables(); 81 v oid clientConnected(unsigned int clientID);82 v oid clientDisconnected(unsigned int clientID);81 virtual void clientConnected(unsigned int clientID) override; 82 virtual void clientDisconnected(unsigned int clientID) override; 83 83 void resynchronize(); 84 84 -
code/branches/cpp11_v3/src/orxonox/worldentities/SpawnPoint.cc
r9667 r11054 43 43 RegisterObject(SpawnPoint); 44 44 45 this->template_ = 0;45 this->template_ = nullptr; 46 46 47 47 if (this->getGametype()) -
code/branches/cpp11_v3/src/orxonox/worldentities/SpawnPoint.h
r11052 r11054 44 44 virtual ~SpawnPoint() {} 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 inline void setSpawnClass(Identifier* identifier) -
code/branches/cpp11_v3/src/orxonox/worldentities/StaticEntity.h
r11052 r11054 57 57 using WorldEntity::setOrientation; 58 58 59 v oid setPosition(const Vector3& position);60 v oid setOrientation(const Quaternion& orientation);59 virtual void setPosition(const Vector3& position) override; 60 virtual void setOrientation(const Quaternion& orientation) override; 61 61 62 62 private: 63 63 void registerVariables(); 64 bool isCollisionTypeLegal(CollisionType type) const;64 virtual bool isCollisionTypeLegal(CollisionType type) const override; 65 65 66 66 // network callbacks … … 71 71 72 72 // Bullet btMotionState related 73 v oid setWorldTransform(const btTransform& worldTrans);74 v oid getWorldTransform(btTransform& worldTrans) const;73 virtual void setWorldTransform(const btTransform& worldTrans) override; 74 virtual void getWorldTransform(btTransform& worldTrans) const override; 75 75 }; 76 76 } -
code/branches/cpp11_v3/src/orxonox/worldentities/TeamSpawnPoint.h
r11052 r11054 43 43 virtual ~TeamSpawnPoint() {} 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 47 47 void setTeamNumber(unsigned int team) -
code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.cc
r10624 r11054 37 37 #include <OgreSceneNode.h> 38 38 #include <BulletDynamics/Dynamics/btRigidBody.h> 39 #include <boost/static_assert.hpp>40 39 41 40 #include "util/OrxAssert.h" … … 57 56 58 57 // Be sure we don't do bad conversions 59 BOOST_STATIC_ASSERT((int)Ogre::Node::TS_LOCAL == (int)WorldEntity::Local);60 BOOST_STATIC_ASSERT((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent);61 BOOST_STATIC_ASSERT((int)Ogre::Node::TS_WORLD == (int)WorldEntity::World);58 static_assert((int)Ogre::Node::TS_LOCAL == (int)WorldEntity::Local, "check enum"); 59 static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent, "check enum"); 60 static_assert((int)Ogre::Node::TS_WORLD == (int)WorldEntity::World, "check enum"); 62 61 63 62 RegisterAbstractClass(WorldEntity).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>(); … … 77 76 this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode(); 78 77 79 this->parent_ = 0;78 this->parent_ = nullptr; 80 79 this->parentID_ = OBJECTID_UNKNOWN; 81 80 this->bDeleteWithParent_ = true; … … 90 89 91 90 // Default behaviour does not include physics 92 this->physicalBody_ = 0;91 this->physicalBody_ = nullptr; 93 92 this->bPhysicsActive_ = false; 94 93 this->bPhysicsActiveSynchronised_ = false; … … 234 233 235 234 // iterate over all children and change their activity as well 236 for ( std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)235 for (WorldEntity* object : this->getAttachedObjects()) 237 236 { 238 237 if(!this->isActive()) 239 238 { 240 (*it)->bActiveMem_ = (*it)->isActive();241 (*it)->setActive(this->isActive());239 object->bActiveMem_ = object->isActive(); 240 object->setActive(this->isActive()); 242 241 } 243 242 else 244 243 { 245 (*it)->setActive((*it)->bActiveMem_);244 object->setActive(object->bActiveMem_); 246 245 } 247 246 } … … 260 259 { 261 260 // iterate over all children and change their visibility as well 262 for ( std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)261 for (WorldEntity* object : this->getAttachedObjects()) 263 262 { 264 263 if(!this->isVisible()) 265 264 { 266 (*it)->bVisibleMem_ = (*it)->isVisible();267 (*it)->setVisible(this->isVisible());265 object->bVisibleMem_ = object->isVisible(); 266 object->setVisible(this->isVisible()); 268 267 } 269 268 else 270 269 { 271 (*it)->setVisible((*it)->bVisibleMem_);270 object->setVisible(object->bVisibleMem_); 272 271 } 273 272 } … … 498 497 void WorldEntity::notifyDetached() 499 498 { 500 this->parent_ = 0;499 this->parent_ = nullptr; 501 500 this->parentID_ = OBJECTID_UNKNOWN; 502 501 … … 519 518 { 520 519 unsigned int i = 0; 521 for ( std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)520 for (WorldEntity* child : this->children_) 522 521 { 523 522 if (i == index) 524 return (*it);523 return child; 525 524 ++i; 526 525 } 527 return 0;526 return nullptr; 528 527 } 529 528 … … 563 562 void WorldEntity::detachOgreObject(Ogre::MovableObject* object) 564 563 { 565 object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>( NULL)));564 object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(nullptr))); 566 565 this->node_->detachObject(object); 567 566 } … … 660 659 { 661 660 // If physics is enabled scale the attached CollisionShape. 662 /*if (this->hasPhysics() && this->collisionShape_ != NULL)661 /*if (this->hasPhysics() && this->collisionShape_ != nullptr) 663 662 { 664 663 this->collisionShape_->setScale3D(scale); … … 856 855 deactivatePhysics(); 857 856 delete this->physicalBody_; 858 this->physicalBody_ = 0;857 this->physicalBody_ = nullptr; 859 858 this->collisionType_ = None; 860 859 this->collisionTypeSynchronised_ = None; … … 939 938 // Recalculate mass 940 939 this->childrenMass_ = 0.0f; 941 for ( std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)942 this->childrenMass_ += (*it)->getMass();940 for (WorldEntity* child : this->children_) 941 this->childrenMass_ += child->getMass(); 943 942 recalculateMassProps(); 944 943 // Notify parent WE -
code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.h
r10726 r11054 96 96 virtual ~WorldEntity(); 97 97 98 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;98 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 99 99 100 100 inline const Ogre::SceneNode* getNode() const … … 108 108 static const Vector3 UP; 109 109 110 virtual void changedActivity(void) ;111 virtual void changedVisibility(void) ;110 virtual void changedActivity(void) override; 111 virtual void changedVisibility(void) override; 112 112 113 113 virtual void setPosition(const Vector3& position) = 0; -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.cc
r9667 r11054 282 282 } 283 283 284 bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)284 bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 285 285 { 286 286 if (contactPoint.m_normalWorldOnB.y() > 0.6) -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.h
r9667 r11054 69 69 virtual void fire(); 70 70 71 bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);71 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 72 72 73 73 virtual void addedWeaponPack(WeaponPack* wPack); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10624 r11054 53 53 RegisterClass(ModularSpaceShip); 54 54 55 std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;55 std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = nullptr; 56 56 57 57 ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context) … … 94 94 for (unsigned int i=0; i < this->getAttachedObjects().size(); i++) 95 95 { 96 if (this->getAttachedObject(i) == NULL)96 if (this->getAttachedObject(i) == nullptr) 97 97 { 98 98 break; 99 99 } 100 100 // iterate through all attached parts 101 for( unsigned int j = 0; j < this->partList_.size(); j++)101 for(ShipPart* part : this->partList_) 102 102 { 103 103 // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done). 104 if(( this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))104 if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)))) 105 105 { 106 106 // The Entity is added to the part's entityList_ 107 this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));107 part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))); 108 108 // An entry in the partMap_ is created, assigning the part to the entity. 109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part); 110 110 } 111 111 } … … 146 146 ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const 147 147 { 148 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)149 { 150 if ( it->first == entity)151 return it->second;152 } 153 return NULL;148 for (const auto& mapEntry : this->partMap_) 149 { 150 if (mapEntry.first == entity) 151 return mapEntry.second; 152 } 153 return nullptr; 154 154 } 155 155 … … 160 160 void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 161 161 { 162 if (cs != NULL && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)162 if (cs != nullptr && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != nullptr) 163 163 this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator); 164 164 else … … 174 174 void ModularSpaceShip::killShipPartStatic(std::string name) 175 175 { 176 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)177 { 178 if ( it->second->getName() == name)179 { 180 it->second->death();176 for (const auto& mapEntry : *ModularSpaceShip::partMap_s) 177 { 178 if (mapEntry.second->getName() == name) 179 { 180 mapEntry.second->death(); 181 181 return; 182 182 } … … 193 193 void ModularSpaceShip::killShipPart(std::string name) 194 194 { 195 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)196 { 197 if ( it->second->getName() == name)198 { 199 it->second->death();195 for (const auto& mapEntry : ModularSpaceShip::partMap_) 196 { 197 if (mapEntry.second->getName() == name) 198 { 199 mapEntry.second->death(); 200 200 return; 201 201 } … … 212 212 void ModularSpaceShip::addShipPart(ShipPart* part) 213 213 { 214 OrxAssert(part != NULL, "The ShipPart cannot be NULL.");214 OrxAssert(part != nullptr, "The ShipPart cannot be nullptr."); 215 215 this->partList_.push_back(part); 216 216 part->setParent(this); … … 222 222 Get the i-th ShipPart of the SpaceShip. 223 223 @return 224 Returns a pointer to the i-the ShipPart. NULLif there is no ShipPart with that index.224 Returns a pointer to the i-the ShipPart. nullptr if there is no ShipPart with that index. 225 225 */ 226 226 ShipPart* ModularSpaceShip::getShipPart(unsigned int index) 227 227 { 228 228 if(this->partList_.size() <= index) 229 return NULL;229 return nullptr; 230 230 else 231 231 return this->partList_[index]; … … 238 238 The name of the ShipPart to be returned. 239 239 @return 240 Pointer to the ShipPart with the given name, or NULLif not found.240 Pointer to the ShipPart with the given name, or nullptr if not found. 241 241 */ 242 242 ShipPart* ModularSpaceShip::getShipPartByName(std::string name) 243 243 { 244 for( std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)245 { 246 if(orxonox_cast<ShipPart*>( *it)->getName() == name)247 { 248 return orxonox_cast<ShipPart*>( *it);244 for(ShipPart* part : this->partList_) 245 { 246 if(orxonox_cast<ShipPart*>(part)->getName() == name) 247 { 248 return orxonox_cast<ShipPart*>(part); 249 249 } 250 250 } 251 251 orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl; 252 return NULL;252 return nullptr; 253 253 } 254 254 … … 256 256 @brief 257 257 Check whether the SpaceShip has a particular Engine. 258 @param engine258 @param search 259 259 A pointer to the Engine to be checked. 260 260 */ 261 bool ModularSpaceShip::hasShipPart(ShipPart* part) const262 { 263 for( unsigned int i = 0; i < this->partList_.size(); i++)264 { 265 if( this->partList_[i] == part)261 bool ModularSpaceShip::hasShipPart(ShipPart* search) const 262 { 263 for(ShipPart* part : this->partList_) 264 { 265 if(part == search) 266 266 return true; 267 267 } -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10262 r11054 109 109 ShipPart* getPartOfEntity(StaticEntity* entity) const; 110 110 111 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);111 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr); 112 112 113 113 static void killShipPartStatic(std::string name); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.cc
r11052 r11054 77 77 this->shieldRechargeWaitCountdown_ = 0; 78 78 79 this->lastHitOriginator_ = 0;79 this->lastHitOriginator_ = nullptr; 80 80 81 81 // set damage multiplier to default value 1, meaning nominal damage … … 94 94 } 95 95 else 96 this->weaponSystem_ = 0;96 this->weaponSystem_ = nullptr; 97 97 98 98 this->setRadarObjectColour(ColourValue::Red); … … 112 112 else 113 113 { 114 this->explosionSound_ = 0;114 this->explosionSound_ = nullptr; 115 115 } 116 116 } … … 373 373 { 374 374 // delete the AIController // <-- TODO: delete? nothing is deleted here... should we delete the controller? 375 slave->setControllableEntity( 0);375 slave->setControllableEntity(nullptr); 376 376 377 377 // set a new master within the formation … … 468 468 return this->weaponSystem_->getWeaponSlot(index); 469 469 else 470 return 0;470 return nullptr; 471 471 } 472 472 … … 482 482 return this->weaponSystem_->getWeaponSet(index); 483 483 else 484 return 0;484 return nullptr; 485 485 } 486 486 … … 510 510 return this->weaponSystem_->getWeaponPack(index); 511 511 else 512 return 0;512 return nullptr; 513 513 } 514 514 … … 564 564 bool Pawn::hasSlaves() 565 565 { 566 for (ObjectList<FormationController>::iterator it = 567 ObjectList<FormationController>::begin(); 568 it != ObjectList<FormationController>::end(); ++it ) 566 for (FormationController* controller : ObjectList<FormationController>()) 569 567 { 570 568 // checks if the pawn's controller has a slave 571 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())569 if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController()) 572 570 return true; 573 571 } … … 577 575 // A function that returns a slave of the pawn's controller 578 576 Controller* Pawn::getSlave(){ 579 for (ObjectList<FormationController>::iterator it = 580 ObjectList<FormationController>::begin(); 581 it != ObjectList<FormationController>::end(); ++it ) 582 { 583 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 584 return it->getController(); 585 } 586 return 0; 577 for (FormationController* controller : ObjectList<FormationController>()) 578 { 579 if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController()) 580 return controller->getController(); 581 } 582 return nullptr; 587 583 } 588 584 -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.h
r11052 r11054 63 63 virtual ~Pawn(); 64 64 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;67 virtual void tick(float dt) ;65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 67 virtual void tick(float dt) override; 68 68 69 69 inline bool isAlive() const … … 157 157 virtual void kill(); 158 158 159 virtual void fired(unsigned int firemode) ;159 virtual void fired(unsigned int firemode) override; 160 160 virtual void postSpawn(); 161 161 … … 201 201 202 202 203 virtual void startLocalHumanControl() ;203 virtual void startLocalHumanControl() override; 204 204 205 205 void setAimPosition( Vector3 position ) … … 208 208 { return this->aimPosition_; } 209 209 210 virtual const Vector3& getCarrierPosition(void) const 210 virtual const Vector3& getCarrierPosition(void) const override 211 211 { return this->getWorldPosition(); }; 212 212 213 virtual void changedVisibility() ;213 virtual void changedVisibility() override; 214 214 215 215 void setExplosionSound(const std::string& engineSound); … … 220 220 221 221 protected: 222 virtual void preDestroy() ;223 224 virtual void setPlayer(PlayerInfo* player) ;225 virtual void removePlayer() ;222 virtual void preDestroy() override; 223 224 virtual void setPlayer(PlayerInfo* player) override; 225 virtual void removePlayer() override; 226 226 227 227 virtual void death(); … … 231 231 virtual void spawneffect(); 232 232 233 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);233 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr); 234 234 235 235 bool bAlive_; 236 236 bool bVulnerable_; ///< If false the pawn may not ged damaged 237 237 238 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const 238 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const override 239 239 { return new std::vector<PickupCarrier*>(); } 240 virtual PickupCarrier* getCarrierParent(void) const 241 { return NULL; }240 virtual PickupCarrier* getCarrierParent(void) const override 241 { return nullptr; } 242 242 243 243 -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/SpaceShip.cc
r11052 r11054 48 48 RegisterClass(SpaceShip); 49 49 50 SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_( NULL)50 SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_(nullptr) 51 51 { 52 52 RegisterObject(SpaceShip); … … 160 160 161 161 // Run the engines 162 for( std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); it++)163 (*it)->run(dt);162 for(Engine* engine : this->engineList_) 163 engine->run(dt); 164 164 165 165 if (this->hasLocalController()) … … 198 198 if(this->bEnableMotionBlur_) 199 199 { 200 if (this->boostBlur_ == NULL&& this->hasLocalController() && this->hasHumanController())200 if (this->boostBlur_ == nullptr && this->hasLocalController() && this->hasHumanController()) 201 201 { 202 202 this->boostBlur_ = new Shader(this->getScene()->getSceneManager()); … … 325 325 void SpaceShip::addEngine(orxonox::Engine* engine) 326 326 { 327 OrxAssert(engine != NULL, "The engine cannot be NULL.");327 OrxAssert(engine != nullptr, "The engine cannot be nullptr."); 328 328 this->engineList_.push_back(engine); 329 329 engine->addToSpaceShip(this); … … 333 333 @brief 334 334 Check whether the SpaceShip has a particular Engine. 335 @param engine335 @param search 336 336 A pointer to the Engine to be checked. 337 337 */ 338 bool SpaceShip::hasEngine(Engine* engine) const339 { 340 for( unsigned int i = 0; i < this->engineList_.size(); i++)341 { 342 if( this->engineList_[i] == engine)338 bool SpaceShip::hasEngine(Engine* search) const 339 { 340 for(Engine* engine : this->engineList_) 341 { 342 if(engine == search) 343 343 return true; 344 344 } … … 350 350 Get the i-th Engine of the SpaceShip. 351 351 @return 352 Returns a pointer to the i-the Engine. NULLif there is no Engine with that index.352 Returns a pointer to the i-the Engine. nullptr if there is no Engine with that index. 353 353 */ 354 354 Engine* SpaceShip::getEngine(unsigned int i) 355 355 { 356 356 if(this->engineList_.size() >= i) 357 return NULL;357 return nullptr; 358 358 else 359 359 return this->engineList_[i]; … … 366 366 The name of the engine to be returned. 367 367 @return 368 Pointer to the engine with the given name, or NULLif not found.368 Pointer to the engine with the given name, or nullptr if not found. 369 369 */ 370 370 Engine* SpaceShip::getEngineByName(const std::string& name) 371 371 { 372 for( size_t i = 0; i < this->engineList_.size(); ++i)373 if( this->engineList_[i]->getName() == name)374 return this->engineList_[i];372 for(Engine* engine : this->engineList_) 373 if(engine->getName() == name) 374 return engine; 375 375 376 376 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; 377 return NULL;377 return nullptr; 378 378 } 379 379 … … 416 416 void SpaceShip::addSpeedFactor(float factor) 417 417 { 418 for( unsigned int i=0; i<this->engineList_.size(); i++)419 this->engineList_[i]->addSpeedMultiply(factor);418 for(Engine* engine : this->engineList_) 419 engine->addSpeedMultiply(factor); 420 420 } 421 421 … … 428 428 void SpaceShip::addSpeed(float speed) 429 429 { 430 for( unsigned int i=0; i<this->engineList_.size(); i++)431 this->engineList_[i]->addSpeedAdd(speed);430 for(Engine* engine : this->engineList_) 431 engine->addSpeedAdd(speed); 432 432 } 433 433 … … 456 456 { 457 457 float speed=0; 458 for( unsigned int i=0; i<this->engineList_.size(); i++)459 { 460 if( this->engineList_[i]->getMaxSpeedFront() > speed)461 speed = this->engineList_[i]->getMaxSpeedFront();458 for(Engine* engine : this->engineList_) 459 { 460 if(engine->getMaxSpeedFront() > speed) 461 speed = engine->getMaxSpeedFront(); 462 462 } 463 463 return speed; … … 485 485 void SpaceShip::changedEnableMotionBlur() 486 486 { 487 if (!this->bEnableMotionBlur_ && this->boostBlur_ != NULL)487 if (!this->bEnableMotionBlur_ && this->boostBlur_ != nullptr) 488 488 { 489 489 delete this->boostBlur_; 490 this->boostBlur_ = NULL;490 this->boostBlur_ = nullptr; 491 491 } 492 492 } … … 514 514 Camera* camera = this->getCamera(); 515 515 //Shaking Camera effect 516 if (camera != 0)516 if (camera != nullptr) 517 517 camera->setOrientation(Vector3::UNIT_X, angle); 518 518 … … 530 530 { 531 531 Camera* camera = CameraManager::getInstance().getActiveCamera(); 532 if(camera != NULL)532 if(camera != nullptr) 533 533 { 534 534 this->cameraOriginalPosition_ = camera->getPosition(); … … 546 546 { 547 547 Camera *camera = this->getCamera(); 548 if (camera == 0)548 if (camera == nullptr) 549 549 { 550 550 orxout(internal_warning) << "Failed to reset camera!" << endl; -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Spectator.cc
r10624 r11054 58 58 this->localVelocity_ = Vector3::ZERO; 59 59 this->setHudTemplate("spectatorhud"); 60 this->greetingFlare_ = 0;60 this->greetingFlare_ = nullptr; 61 61 62 62 this->setDestroyWhenPlayerLeft(true); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
r10624 r11054 80 80 81 81 std::set<WorldEntity*> attachments = this->getAttachedObjects(); 82 for ( std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it)82 for (WorldEntity* attachment : attachments) 83 83 { 84 if ( (*it)->isA(Class(TeamColourable)))84 if (attachment->isA(Class(TeamColourable))) 85 85 { 86 TeamColourable* tc = orxonox_cast<TeamColourable*>( *it);86 TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment); 87 87 tc->setTeamColour(colour); 88 88 } … … 92 92 93 93 // Call this so bots stop shooting at the base after they converted it 94 for ( ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)95 it->abandonTarget(this);94 for (ArtificialController* controller : ObjectList<ArtificialController>()) 95 controller->abandonTarget(this); 96 96 } 97 97 }
Note: See TracChangeset
for help on using the changeset viewer.