Changeset 11071 for code/trunk/src/modules
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 356 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/designtools/CreateStars.h
r9667 r11071 43 43 void createBillboards(); 44 44 45 v oid XMLPort(Element& xmlelement, XMLPort::Mode mode);45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 47 47 void setNumStars(int num) { -
code/trunk/src/modules/designtools/ScreenshotManager.cc
r10624 r11071 69 69 Constructor. 70 70 */ 71 ScreenshotManager::ScreenshotManager() : finalPicturePB_( NULL), data_(NULL)71 ScreenshotManager::ScreenshotManager() : finalPicturePB_(nullptr), data_(nullptr) 72 72 { 73 73 RegisterObject(ScreenshotManager); … … 90 90 void ScreenshotManager::cleanup(void) 91 91 { 92 if(this->finalPicturePB_ != NULL)92 if(this->finalPicturePB_ != nullptr) 93 93 { 94 94 delete this->finalPicturePB_; 95 this->finalPicturePB_ = NULL;96 } 97 if(this->data_ != NULL)95 this->finalPicturePB_ = nullptr; 96 } 97 if(this->data_ != nullptr) 98 98 { 99 99 delete this->data_; 100 this->data_ = NULL;100 this->data_ = nullptr; 101 101 } 102 102 if(!this->tempTexture_.isNull()) … … 151 151 // Get the screenshot. 152 152 Ogre::Image* finalImage = getScreenshot(); 153 if(finalImage != NULL)153 if(finalImage != nullptr) 154 154 { 155 155 // Save it. … … 173 173 Ogre::Image* ScreenshotManager::getScreenshot() 174 174 { 175 if(CameraManager::getInstance().getActiveCamera() == NULL)176 return NULL;175 if(CameraManager::getInstance().getActiveCamera() == nullptr ) 176 return nullptr; 177 177 return this->getScreenshot(CameraManager::getInstance().getActiveCamera()->getOgreCamera()); 178 178 } … … 189 189 Ogre::Image* ScreenshotManager::getScreenshot(Ogre::Camera* camera) 190 190 { 191 if(camera == NULL)192 return NULL;191 if(camera == nullptr) 192 return nullptr; 193 193 194 194 // Update the internal parameters. -
code/trunk/src/modules/designtools/SkyboxGenerator.cc
r10624 r11071 82 82 this->faceCounter_ = 0; 83 83 84 this->names_. push_back("fr");85 this->names_. push_back("lf");86 this->names_. push_back("bk");87 this->names_. push_back("rt");88 this->names_. push_back("up");89 this->names_. push_back("dn");90 91 this->rotations_. push_back(std::pair<int, int>(90, 0));92 this->rotations_. push_back(std::pair<int, int>(90, 0));93 this->rotations_. push_back(std::pair<int, int>(90, 0));94 this->rotations_. push_back(std::pair<int, int>(90, 90));95 this->rotations_. push_back(std::pair<int, int>(0, 180));96 this->rotations_. push_back(std::pair<int, int>(0, 90));84 this->names_.emplace_back("fr"); 85 this->names_.emplace_back("lf"); 86 this->names_.emplace_back("bk"); 87 this->names_.emplace_back("rt"); 88 this->names_.emplace_back("up"); 89 this->names_.emplace_back("dn"); 90 91 this->rotations_.emplace_back(90, 0); 92 this->rotations_.emplace_back(90, 0); 93 this->rotations_.emplace_back(90, 0); 94 this->rotations_.emplace_back(90, 90); 95 this->rotations_.emplace_back(0, 180); 96 this->rotations_.emplace_back(0, 90); 97 97 } 98 98 … … 146 146 } 147 147 148 ControllableEntity* entity = NULL;149 if(HumanController::getLocalControllerSingleton() != NULL && HumanController::getLocalControllerSingleton()->getControllableEntity() != NULL)148 ControllableEntity* entity = nullptr; 149 if(HumanController::getLocalControllerSingleton() != nullptr && HumanController::getLocalControllerSingleton()->getControllableEntity() != nullptr) 150 150 entity = HumanController::getLocalControllerSingleton()->getControllableEntity(); 151 151 else -
code/trunk/src/modules/designtools/SkyboxGenerator.h
r9667 r11071 65 65 SkyboxGenerator(); 66 66 virtual ~SkyboxGenerator(); 67 v oid tick(float dt); // This is where the skybox generation happens.67 virtual void tick(float dt) override; // This is where the skybox generation happens. 68 68 static void createSkybox(void); // Generate the 6 faces of a skybox. 69 69 void setConfigValues(void); // Sets some config values. … … 106 106 107 107 std::vector<std::string> names_; //!< The names of the image files for the skybox faces to be generated. 108 std::vector< std::pair<int, int> 108 std::vector< std::pair<int, int>> rotations_; //!< The rotation in yaw an pitch direction that is applied to the camera after a specific face has been generated. 109 109 110 110 // Storage variables -
code/trunk/src/modules/docking/Dock.cc
r10624 r11071 87 87 88 88 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 89 PlayerInfo* player = NULL;89 PlayerInfo* player = nullptr; 90 90 91 91 // Check whether it is a player trigger and extract pawn from it 92 if(pTrigger != NULL)92 if(pTrigger != nullptr) 93 93 { 94 94 if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 103 103 return false; 104 104 } 105 if(player == NULL)105 if(player == nullptr) 106 106 { 107 107 orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 131 131 { 132 132 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 133 PlayerInfo* player = NULL;133 PlayerInfo* player = nullptr; 134 134 135 135 // Check whether it is a player trigger and extract pawn from it 136 if(pTrigger != NULL)136 if(pTrigger != nullptr) 137 137 { 138 138 if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 147 147 return false; 148 148 } 149 if(player == NULL)149 if(player == nullptr) 150 150 { 151 151 orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 214 214 { 215 215 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 216 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)217 { 218 if( it->dock(player))216 for(Dock* dock : ObjectList<Dock>()) 217 { 218 if(dock->dock(player)) 219 219 break; 220 220 } … … 224 224 { 225 225 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 226 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)227 { 228 if( it->undock(player))226 for(Dock* dock : ObjectList<Dock>()) 227 { 228 if(dock->undock(player)) 229 229 break; 230 230 } … … 295 295 int i = 0; 296 296 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 297 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)298 { 299 if( it->candidates_.find(player) != it->candidates_.end())297 for(Dock* dock : ObjectList<Dock>()) 298 { 299 if(dock->candidates_.find(player) != dock->candidates_.end()) 300 300 i++; 301 301 } … … 306 306 { 307 307 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 308 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)309 { 310 if( it->candidates_.find(player) != it->candidates_.end())308 for(Dock* dock : ObjectList<Dock>()) 309 { 310 if(dock->candidates_.find(player) != dock->candidates_.end()) 311 311 { 312 312 if(index == 0) 313 return *it;313 return dock; 314 314 index--; 315 315 } 316 316 } 317 return NULL;317 return nullptr; 318 318 } 319 319 … … 327 327 const DockingEffect* Dock::getEffect(unsigned int i) const 328 328 { 329 for ( std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)329 for (DockingEffect* effect : this->effects_) 330 330 { 331 331 if(i == 0) 332 return *effect;332 return effect; 333 333 i--; 334 334 } 335 return NULL;335 return nullptr; 336 336 } 337 337 … … 346 346 const DockingAnimation* Dock::getAnimation(unsigned int i) const 347 347 { 348 for ( std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)348 for (DockingAnimation* animation : this->animations_) 349 349 { 350 350 if(i == 0) 351 return *animation;351 return animation; 352 352 i--; 353 353 } 354 return NULL;354 return nullptr; 355 355 } 356 356 } -
code/trunk/src/modules/docking/Dock.h
r9939 r11071 65 65 66 66 // XML interface 67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;68 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 68 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 69 69 70 70 // XML functions -
code/trunk/src/modules/docking/DockToShip.cc
r9974 r11071 72 72 73 73 DockingTarget *target = DockingEffect::findTarget(this->target_); 74 if (target == NULL) {74 if (target == nullptr) { 75 75 orxout(internal_warning, context::docking) << "Can't retrieve target for '" << this->target_ << "'.." << endl; 76 76 return false; … … 78 78 79 79 ControllableEntity *dockTo = (ControllableEntity*) target->getParent(); 80 if (dockTo == NULL) {80 if (dockTo == nullptr) { 81 81 orxout(internal_warning, context::docking) << "Parent is not a ControllableEntity.." << endl; 82 82 return false; -
code/trunk/src/modules/docking/DockToShip.h
r9667 r11071 60 60 virtual ~DockToShip(); 61 61 62 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;62 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 63 63 void setTargetId(const std::string& str); 64 64 const std::string& getTargetId() const; 65 65 66 virtual bool docking(PlayerInfo* player) ; //!< Called when docking starts67 virtual bool release(PlayerInfo* player) ; //!< Called when player wants undock66 virtual bool docking(PlayerInfo* player) override; //!< Called when docking starts 67 virtual bool release(PlayerInfo* player) override; //!< Called when player wants undock 68 68 private: 69 69 std::string target_; -
code/trunk/src/modules/docking/DockingAnimation.cc
r10624 r11071 45 45 RegisterObject(DockingAnimation); 46 46 47 this->parent_ = NULL;47 this->parent_ = nullptr; 48 48 } 49 49 … … 57 57 bool check = true; 58 58 59 for ( std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)59 for (DockingAnimation* animation : animations) 60 60 { 61 61 if(dock) 62 check &= (*animation)->docking(player);62 check &= animation->docking(player); 63 63 else 64 check &= (*animation)->release(player);64 check &= animation->release(player); 65 65 } 66 66 -
code/trunk/src/modules/docking/DockingController.cc
r11052 r11071 44 44 RegisterObject(DockingController); 45 45 46 this->dock_ = NULL;47 this->player_ = NULL;48 this->entity_ = NULL;46 this->dock_ = nullptr; 47 this->player_ = nullptr; 48 this->entity_ = nullptr; 49 49 } 50 50 … … 122 122 this->player_->startControl(this->entity_); 123 123 this->setActive(false); 124 this->controllableEntity_ = NULL;124 this->controllableEntity_ = nullptr; 125 125 126 126 if (this->docking_) -
code/trunk/src/modules/docking/DockingController.h
r9667 r11071 45 45 virtual ~DockingController(); 46 46 47 virtual void tick(float dt) ;47 virtual void tick(float dt) override; 48 48 49 49 void takeControl(bool docking); … … 53 53 54 54 protected: 55 virtual void positionReached() ;55 virtual void positionReached() override; 56 56 57 57 private: -
code/trunk/src/modules/docking/DockingEffect.cc
r10624 r11071 53 53 bool check = true; 54 54 55 for ( std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)55 for (DockingEffect* effect : effects) 56 56 { 57 57 if (dock) 58 check &= (*effect)->docking(player);58 check &= effect->docking(player); 59 59 else 60 check &= (*effect)->release(player);60 check &= effect->release(player); 61 61 } 62 62 … … 65 65 66 66 DockingTarget *DockingEffect::findTarget(std::string name) { 67 for ( ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it)67 for (DockingTarget* target : ObjectList<DockingTarget>()) 68 68 { 69 if ( (*it)->getName().compare(name) == 0)70 return (*it);69 if (target->getName().compare(name) == 0) 70 return target; 71 71 } 72 return NULL;72 return nullptr; 73 73 } 74 74 } -
code/trunk/src/modules/docking/DockingTarget.cc
r9667 r11071 34 34 #include "DockingTarget.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 … … 49 48 { 50 49 } 51 52 void DockingTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode)53 {54 SUPER(DockingTarget, XMLPort, xmlelement, mode);55 56 orxout(verbose, context::docking) << "DockingTarget with name '" << this->getName() << "' created.." << endl;57 }58 59 50 } 60 51 -
code/trunk/src/modules/docking/DockingTarget.h
r9667 r11071 58 58 virtual ~DockingTarget(); 59 59 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);61 62 60 }; 63 61 -
code/trunk/src/modules/docking/MoveToDockingTarget.h
r9667 r11071 59 59 virtual ~MoveToDockingTarget(); 60 60 61 virtual bool docking(PlayerInfo* player) ; //!< Called when a player starts docking62 virtual bool release(PlayerInfo* player) ; //!< Called when player wants to undock61 virtual bool docking(PlayerInfo* player) override; //!< Called when a player starts docking 62 virtual bool release(PlayerInfo* player) override; //!< Called when player wants to undock 63 63 }; 64 64 -
code/trunk/src/modules/dodgerace/DodgeRace.cc
r11052 r11071 59 59 comboTimer.setTimer(3.0f, true, createExecutor(createFunctor(&DodgeRace::comboControll, this))); 60 60 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 61 this->center_ = 0;61 this->center_ = nullptr; 62 62 63 63 this->setHUDTemplate("DodgeRaceHUD"); … … 67 67 { 68 68 level++; 69 if (getPlayer() != NULL)69 if (getPlayer() != nullptr) 70 70 { 71 71 for (int i = 0; i < 7; i++) … … 89 89 void DodgeRace::tick(float dt) 90 90 { 91 if (getPlayer() != NULL)91 if (getPlayer() != nullptr) 92 92 { 93 93 currentPosition = getPlayer()->getWorldPosition().x; … … 138 138 DodgeRaceShip* DodgeRace::getPlayer() 139 139 { 140 if (player == NULL)141 { 142 for ( ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)143 { 144 player = *it;140 if (player == nullptr) 141 { 142 for (DodgeRaceShip* ship : ObjectList<DodgeRaceShip>()) 143 { 144 player = ship; 145 145 } 146 146 } … … 177 177 this->bForceSpawn_ = false; 178 178 179 if (this->center_ == NULL) // abandon mission!179 if (this->center_ == nullptr) // abandon mission! 180 180 { 181 181 orxout(internal_error) << "DodgeRace: No Centerpoint specified." << endl; -
code/trunk/src/modules/dodgerace/DodgeRace.h
r11052 r11071 68 68 DodgeRace(Context* context); 69 69 70 virtual void start() ;71 virtual void end() ;70 virtual void start() override; 71 virtual void end() override; 72 72 73 virtual void tick(float dt) ;73 virtual void tick(float dt) override; 74 74 75 virtual void playerPreSpawn(PlayerInfo* player) ;75 virtual void playerPreSpawn(PlayerInfo* player) override; 76 76 77 77 void levelUp(); … … 84 84 void setCenterpoint(DodgeRaceCenterPoint* center) 85 85 { this->center_ = center; } 86 virtual void addBots(unsigned int amount) {} //<! overwrite function in order to bypass the addbots command86 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 87 87 88 88 // checks if multiplier should be reset. -
code/trunk/src/modules/dodgerace/DodgeRaceCenterPoint.cc
r10624 r11071 49 49 } 50 50 51 void DodgeRaceCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)52 {53 SUPER(DodgeRaceCenterPoint, XMLPort, xmlelement, mode);54 }55 56 51 void DodgeRaceCenterPoint::checkGametype() 57 52 { 58 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(DodgeRace)))53 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(DodgeRace))) 59 54 { 60 55 DodgeRace* DodgeRaceGametype = orxonox_cast<DodgeRace*>(this->getGametype()); -
code/trunk/src/modules/dodgerace/DodgeRaceCenterPoint.h
r10624 r11071 50 50 DodgeRaceCenterPoint(Context* context); //checks whether the gametype is actually DodgeRace. 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);53 54 52 private: 55 53 void checkGametype(); -
code/trunk/src/modules/dodgerace/DodgeRaceHUDinfo.cc
r10624 r11071 40 40 RegisterObject(DodgeRaceHUDinfo); 41 41 42 this->DodgeRaceGame = 0;42 this->DodgeRaceGame = nullptr; 43 43 this->bShowPoints_ = true; 44 44 } … … 86 86 else 87 87 { 88 this->DodgeRaceGame = 0;88 this->DodgeRaceGame = nullptr; 89 89 } 90 90 } -
code/trunk/src/modules/dodgerace/DodgeRaceHUDinfo.h
r10234 r11071 44 44 DodgeRaceHUDinfo(Context* context); 45 45 46 virtual void tick(float dt) ;47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void changedOwner() ;46 virtual void tick(float dt) override; 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 48 virtual void changedOwner() override; 49 49 50 50 inline void setShowPoints(bool value) -
code/trunk/src/modules/dodgerace/DodgeRaceShip.cc
r10624 r11071 91 91 // Camera 92 92 Camera* camera = this->getCamera(); 93 if (camera != NULL)93 if (camera != nullptr) 94 94 { 95 95 // camera->setPosition(Vector3(-pos.z, -posforeward, 0)); … … 142 142 } 143 143 144 inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)144 inline bool DodgeRaceShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 145 145 { 146 146 … … 152 152 DodgeRace* DodgeRaceShip::getGame() 153 153 { 154 if (game == NULL)154 if (game == nullptr) 155 155 { 156 for ( ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it)156 for (DodgeRace* race : ObjectList<DodgeRace>()) 157 157 { 158 game = *it;158 game = race; 159 159 } 160 160 } -
code/trunk/src/modules/dodgerace/DodgeRaceShip.h
r10624 r11071 52 52 DodgeRaceShip(Context* context); 53 53 54 virtual void tick(float dt) ;54 virtual void tick(float dt) override; 55 55 56 56 // overwrite for 2d movement 57 virtual void moveFrontBack(const Vector2& value) ;58 virtual void moveRightLeft(const Vector2& value) ;57 virtual void moveFrontBack(const Vector2& value) override; 58 virtual void moveRightLeft(const Vector2& value) override; 59 59 60 60 // Starts or stops fireing 61 virtual void boost(bool bBoost) ;61 virtual void boost(bool bBoost) override; 62 62 63 63 //no rotation! 64 virtual void rotateYaw(const Vector2& value) {};65 virtual void rotatePitch(const Vector2& value) {};64 virtual void rotateYaw(const Vector2& value) override{}; 65 virtual void rotatePitch(const Vector2& value) override{}; 66 66 67 67 //return to main menu if game has ended. 68 virtual void rotateRoll(const Vector2& value) {if (getGame()) if (getGame()->bEndGame) getGame()->end();};68 virtual void rotateRoll(const Vector2& value) override{if (getGame()) if (getGame()->bEndGame) getGame()->end();}; 69 69 70 70 virtual void updateLevel(); 71 72 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 71 73 72 74 float speed, damping, posforeward; … … 74 76 75 77 protected: 76 virtual void death() ;78 virtual void death() override; 77 79 78 80 private: 79 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);80 81 DodgeRace* getGame(); 81 82 WeakPtr<DodgeRace> game; -
code/trunk/src/modules/gametypes/OldRaceCheckPoint.cc
r10624 r11071 49 49 50 50 this->setRadarObjectColour(ColourValue::Blue); 51 this->setRadarObjectShape(RadarViewable:: Triangle);51 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 52 52 this->setRadarVisibility(false); 53 53 } -
code/trunk/src/modules/gametypes/OldRaceCheckPoint.h
r9667 r11071 48 48 virtual ~OldRaceCheckPoint(); 49 49 50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;51 virtual void tick(float dt) ;50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 51 virtual void tick(float dt) override; 52 52 53 53 protected: 54 virtual void triggered(bool bIsTriggered) ;54 virtual void triggered(bool bIsTriggered) override; 55 55 inline void setLast(bool isLast) 56 56 { this->bIsLast_ = isLast; } … … 64 64 inline float getTimeLimit() 65 65 { return this->bTimeLimit_;} 66 inline const WorldEntity* getWorldEntity() const66 virtual inline const WorldEntity* getWorldEntity() const override 67 67 { return this; } 68 68 -
code/trunk/src/modules/gametypes/OldSpaceRace.h
r9667 r11071 55 55 virtual ~OldSpaceRace() {} 56 56 57 virtual void start() ;58 virtual void end() ;57 virtual void start() override; 58 virtual void end() override; 59 59 60 60 virtual void newCheckpointReached(); 61 virtual void addBots(unsigned int amount) {} //<! overwrite function in order to bypass the addbots command.61 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command. 62 62 //<! This is only a temporary solution. Better: create racingBots. 63 63 -
code/trunk/src/modules/gametypes/RaceCheckPoint.cc
r9973 r11071 53 53 54 54 this->setRadarObjectColour(ColourValue::Blue); 55 this->setRadarObjectShape(RadarViewable:: Triangle);55 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 56 56 this->setRadarVisibility(false); 57 57 this->settingsChanged(); … … 125 125 } 126 126 } 127 return NULL;127 return nullptr; 128 128 } 129 129 … … 146 146 { 147 147 Vector3 checkpoints(-1,-1,-1); int count=0; 148 for ( std::set<int>::iterator it= nextCheckpoints_.begin();it!=nextCheckpoints_.end(); it++)148 for (int nextCheckpoint : nextCheckpoints_) 149 149 { 150 150 switch (count) 151 151 { 152 case 0: checkpoints.x = static_cast<Ogre::Real>( *it); break;153 case 1: checkpoints.y = static_cast<Ogre::Real>( *it); break;154 case 2: checkpoints.z = static_cast<Ogre::Real>( *it); break;152 case 0: checkpoints.x = static_cast<Ogre::Real>(nextCheckpoint); break; 153 case 1: checkpoints.y = static_cast<Ogre::Real>(nextCheckpoint); break; 154 case 2: checkpoints.z = static_cast<Ogre::Real>(nextCheckpoint); break; 155 155 } 156 156 ++count; -
code/trunk/src/modules/gametypes/RaceCheckPoint.h
r9971 r11071 48 48 virtual ~RaceCheckPoint(); 49 49 50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 51 51 52 52 inline void setCheckpointIndex(int checkpointIndex) … … 92 92 protected: 93 93 94 virtual void fire(bool bIsTriggered, BaseObject* originator) ;94 virtual void fire(bool bIsTriggered, BaseObject* originator) override; 95 95 96 inline const WorldEntity* getWorldEntity() const96 virtual inline const WorldEntity* getWorldEntity() const override 97 97 { 98 98 return this; -
code/trunk/src/modules/gametypes/SpaceRace.cc
r9804 r11071 88 88 this->cantMove_ = true; 89 89 90 for ( ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)91 it->setActive(false);90 for (Engine* engine : ObjectList<Engine>()) 91 engine->setActive(false); 92 92 } 93 93 … … 95 95 if (!this->isStartCountdownRunning() && this->cantMove_) 96 96 { 97 for ( ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)98 it->setActive(true);97 for (Engine* engine : ObjectList<Engine>()) 98 engine->setActive(true); 99 99 100 100 this->cantMove_= false; -
code/trunk/src/modules/gametypes/SpaceRace.h
r9667 r11071 57 57 virtual ~SpaceRace() {} 58 58 59 v oid tick(float dt);59 virtual void tick(float dt) override; 60 60 61 virtual void end() ;61 virtual void end() override; 62 62 63 63 void newCheckpointReached(RaceCheckPoint* checkpoint, PlayerInfo* player); … … 70 70 { return this->clock_; } 71 71 72 bool allowPawnHit(Pawn* victim, Pawn* originator);73 bool allowPawnDamage(Pawn* victim, Pawn* originator);74 bool allowPawnDeath(Pawn* victim, Pawn* originator);72 virtual bool allowPawnHit(Pawn* victim, Pawn* originator) override; 73 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) override; 74 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator) override; 75 75 76 76 private: -
code/trunk/src/modules/gametypes/SpaceRaceController.cc
r10318 r11071 59 59 60 60 virtualCheckPointIndex = -2; 61 if (ObjectList<SpaceRaceManager> ::size() != 1)62 orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager> ::size() << endl;63 for ( ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it != ObjectList<SpaceRaceManager>::end(); ++it)64 { 65 checkpoints = it->getAllCheckpoints();66 nextRaceCheckpoint_ = it->findCheckpoint(0);61 if (ObjectList<SpaceRaceManager>().size() != 1) 62 orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>().size() << endl; 63 for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>()) 64 { 65 checkpoints = manager->getAllCheckpoints(); 66 nextRaceCheckpoint_ = manager->findCheckpoint(0); 67 67 } 68 68 … … 98 98 RaceCheckPoint* point2 = findCheckpoint((*numb)); 99 99 100 //if(point2 != NULL)100 //if(point2 != nullptr) 101 101 //placeVirtualCheckpoints((*it), point2); 102 102 } … … 126 126 staticRacePoints_ = findStaticCheckpoints(nextRaceCheckpoint_, checkpoints); 127 127 // initialisation of currentRaceCheckpoint_ 128 currentRaceCheckpoint_ = NULL;128 currentRaceCheckpoint_ = nullptr; 129 129 130 130 int i; 131 for (i = -2; findCheckpoint(i) != NULL; i--)131 for (i = -2; findCheckpoint(i) != nullptr; i--) 132 132 { 133 133 continue; … … 154 154 { 155 155 std::map<RaceCheckPoint*, int> zaehler; // counts how many times the checkpoint was reached (for simulation) 156 for ( unsigned int i = 0; i < allCheckpoints.size(); i++)157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>( allCheckpoints[i],0));156 for (RaceCheckPoint* checkpoint : allCheckpoints) 157 { 158 zaehler.insert(std::pair<RaceCheckPoint*, int>(checkpoint,0)); 159 159 } 160 160 int maxWays = rekSimulationCheckpointsReached(currentCheckpoint, zaehler); 161 161 162 162 std::vector<RaceCheckPoint*> returnVec; 163 for ( std::map<RaceCheckPoint*, int>::iterator iter = zaehler.begin(); iter != zaehler.end(); iter++)164 { 165 if ( iter->second == maxWays)166 { 167 returnVec.push_back( iter->first);163 for (const auto& mapEntry : zaehler) 164 { 165 if (mapEntry.second == maxWays) 166 { 167 returnVec.push_back(mapEntry.first); 168 168 } 169 169 } … … 187 187 { 188 188 int numberOfWays = 0; // counts number of ways from this Point to the last point 189 for ( std::set<int>::iterator it = currentCheckpoint->getNextCheckpoints().begin(); it!= currentCheckpoint->getNextCheckpoints().end(); ++it)190 { 191 if (currentCheckpoint == findCheckpoint( *it))189 for (int checkpointIndex : currentCheckpoint->getNextCheckpoints()) 190 { 191 if (currentCheckpoint == findCheckpoint(checkpointIndex)) 192 192 { 193 193 //orxout() << currentCheckpoint->getCheckpointIndex()<<endl; 194 194 continue; 195 195 } 196 if (findCheckpoint( *it) == NULL)197 orxout(internal_warning) << "Problematic Point: " << (*it)<< endl;196 if (findCheckpoint(checkpointIndex) == nullptr) 197 orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl; 198 198 else 199 numberOfWays += rekSimulationCheckpointsReached(findCheckpoint( *it), zaehler);199 numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(checkpointIndex), zaehler); 200 200 } 201 201 zaehler[currentCheckpoint] += numberOfWays; … … 209 209 float SpaceRaceController::distanceSpaceshipToCheckPoint(RaceCheckPoint* CheckPoint) 210 210 { 211 if (this->getControllableEntity() != NULL)211 if (this->getControllableEntity() != nullptr) 212 212 { 213 213 return (CheckPoint->getPosition()- this->getControllableEntity()->getPosition()).length(); … … 223 223 { 224 224 float minDistance = 0; 225 RaceCheckPoint* minNextRaceCheckPoint = NULL;225 RaceCheckPoint* minNextRaceCheckPoint = nullptr; 226 226 227 227 // find the next checkpoint with the minimal distance 228 for ( std::set<int>::iterator it = raceCheckpoint->getNextCheckpoints().begin(); it != raceCheckpoint->getNextCheckpoints().end(); ++it)229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint( *it);228 for (int checkpointIndex : raceCheckpoint->getNextCheckpoints()) 229 { 230 RaceCheckPoint* nextRaceCheckPoint = findCheckpoint(checkpointIndex); 231 231 float distance = recCalculateDistance(nextRaceCheckPoint, this->getControllableEntity()->getPosition()); 232 232 233 if (distance < minDistance || minNextRaceCheckPoint == NULL)233 if (distance < minDistance || minNextRaceCheckPoint == nullptr) 234 234 { 235 235 minDistance = distance; … … 255 255 { 256 256 float minimum = std::numeric_limits<float>::max(); 257 for ( std::set<int>::iterator it = currentCheckPoint->getNextCheckpoints().begin(); it != currentCheckPoint->getNextCheckpoints().end(); ++it)257 for (int checkpointIndex : currentCheckPoint->getNextCheckpoints()) 258 258 { 259 259 int dist_currentCheckPoint_currentPosition = static_cast<int> ((currentPosition- currentCheckPoint->getPosition()).length()); 260 260 261 minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint( *it), currentCheckPoint->getPosition()));261 minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(checkpointIndex), currentCheckPoint->getPosition())); 262 262 // minimum of distanz from 'currentPosition' to the next static Checkpoint 263 263 } … … 271 271 RaceCheckPoint* SpaceRaceController::adjustNextPoint() 272 272 { 273 if (currentRaceCheckpoint_ == NULL) // no Adjust possible273 if (currentRaceCheckpoint_ == nullptr) // no Adjust possible 274 274 275 275 { … … 289 289 RaceCheckPoint* SpaceRaceController::findCheckpoint(int index) const 290 290 { 291 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)292 if ( this->checkpoints_[i]->getCheckpointIndex() == index)293 return this->checkpoints_[i];294 return NULL;291 for (RaceCheckPoint* checkpoint : this->checkpoints_) 292 if (checkpoint->getCheckpointIndex() == index) 293 return checkpoint; 294 return nullptr; 295 295 } 296 296 … … 299 299 orxout()<<"add VCP at"<<virtualCheckPointPosition.x<<", "<<virtualCheckPointPosition.y<<", "<<virtualCheckPointPosition.z<<endl; 300 300 RaceCheckPoint* newTempRaceCheckPoint; 301 for (ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it!= ObjectList<SpaceRaceManager>::end(); ++it) 301 ObjectList<SpaceRaceManager> list; 302 for (ObjectList<SpaceRaceManager>::iterator it = list.begin(); it!= list.end(); ++it) 302 303 { 303 304 newTempRaceCheckPoint = new RaceCheckPoint((*it)); … … 347 348 void SpaceRaceController::tick(float dt) 348 349 { 349 if (this->getControllableEntity() == NULL || this->getControllableEntity()->getPlayer() == NULL)350 if (this->getControllableEntity() == nullptr || this->getControllableEntity()->getPlayer() == nullptr ) 350 351 { 351 352 //orxout()<< this->getControllableEntity() << " in tick"<<endl; … … 414 415 btScalar radiusObject; 415 416 416 for ( std::vector<StaticEntity*>::const_iterator it = allObjects.begin(); it != allObjects.end(); ++it)417 { 418 for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != 0; everyShape++)419 { 420 btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape();421 if(currentShape == NULL)417 for (StaticEntity* object : allObjects) 418 { 419 for (int everyShape=0; object->getAttachedCollisionShape(everyShape) != nullptr; everyShape++) 420 { 421 btCollisionShape* currentShape = object->getAttachedCollisionShape(everyShape)->getCollisionShape(); 422 if(currentShape == nullptr) 422 423 continue; 423 424 … … 444 445 for (std::vector<StaticEntity*>::iterator it = allObjects.begin(); it != allObjects.end(); ++it) 445 446 { 446 for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != 0; everyShape++)447 for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape) != nullptr; everyShape++) 447 448 { 448 449 btCollisionShape* currentShape = (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape(); 449 if(currentShape == NULL)450 if(currentShape == nullptr) 450 451 continue; 451 452 … … 488 489 std::vector<StaticEntity*> problematicObjects; 489 490 490 for (ObjectList<StaticEntity>::iterator it = ObjectList<StaticEntity>::begin(); it!= ObjectList<StaticEntity>::end(); ++it) 491 { 492 493 if (dynamic_cast<RaceCheckPoint*>(*it) != NULL) 491 ObjectList<StaticEntity> list; 492 for (ObjectList<StaticEntity>::iterator it = list.begin(); it!= list.end(); ++it) 493 { 494 495 if (dynamic_cast<RaceCheckPoint*>(*it) != nullptr) 494 496 { 495 497 continue; … … 537 539 // btVector3 positionObject; 538 540 // btScalar radiusObject; 539 // if((*it)== NULL)541 // if((*it)==nullptr) 540 542 // { orxout()<<"Problempoint 1.1"<<endl; continue;} 541 543 // //TODO: Probably it points on a wrong object 542 // for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!= 0; everyShape++)544 // for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=nullptr; everyShape++) 543 545 // { 544 // if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()== NULL)546 // if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==nullptr) 545 547 // { continue;} 546 548 // … … 570 572 // btVector3 positionObject; 571 573 // btScalar radiusObject; 572 // if((*it)== NULL)574 // if((*it)==nullptr) 573 575 // { orxout()<<"Problempoint 1"<<endl; continue;} 574 // for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!= 0; everyShape++)576 // for (int everyShape=0; (*it)->getAttachedCollisionShape(everyShape)!=nullptr; everyShape++) 575 577 // { 576 // if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()== NULL)578 // if((*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()==nullptr) 577 579 // { orxout()<<"Problempoint 2.2"<<endl; continue;} 578 580 // (*it)->getAttachedCollisionShape(everyShape)->getCollisionShape()->getBoundingSphere(positionObject,radiusObject); -
code/trunk/src/modules/gametypes/SpaceRaceController.h
r10262 r11071 42 42 SpaceRaceController(Context* context); 43 43 virtual ~SpaceRaceController(); 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void tick(float dt) ;44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 45 virtual void tick(float dt) override; 46 46 47 47 private: -
code/trunk/src/modules/gametypes/SpaceRaceManager.cc
r10624 r11071 54 54 SpaceRaceManager::~SpaceRaceManager() 55 55 { 56 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)57 this->checkpoints_[i]->destroy();56 for (RaceCheckPoint* checkpoint : this->checkpoints_) 57 checkpoint->destroy(); 58 58 } 59 59 … … 71 71 this->players_ = this->race_->getPlayers(); 72 72 73 if (this->checkpoints_[0] != NULL&& !this->firstcheckpointvisible_)73 if (this->checkpoints_[0] != nullptr && !this->firstcheckpointvisible_) 74 74 { 75 75 this->checkpoints_[0]->setRadarVisibility(true); … … 77 77 } 78 78 79 for ( std::map< PlayerInfo*, Player>::iterator it = players_.begin(); it != players_.end(); ++it)79 for (const auto& mapEntry : players_) 80 80 { 81 81 82 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)82 for (RaceCheckPoint* checkpoint : this->checkpoints_) 83 83 { 84 if ( this->checkpoints_[i]->playerWasHere(it->first)){85 this->checkpointReached( this->checkpoints_[i], it->first /*this->checkpoints_[i]->getPlayer()*/);84 if (checkpoint->playerWasHere(mapEntry.first)){ 85 this->checkpointReached(checkpoint, mapEntry.first /*this->checkpoints_[i]->getPlayer()*/); 86 86 } 87 87 } … … 100 100 return this->checkpoints_[index]; 101 101 else 102 return 0;102 return nullptr; 103 103 } 104 104 … … 113 113 RaceCheckPoint* SpaceRaceManager::findCheckpoint(int index) const 114 114 { 115 for ( size_t i = 0; i < this->checkpoints_.size(); ++i)116 if ( this->checkpoints_[i]->getCheckpointIndex() == index)117 return this->checkpoints_[i];118 return 0;115 for (RaceCheckPoint* checkpoint : this->checkpoints_) 116 if (checkpoint->getCheckpointIndex() == index) 117 return checkpoint; 118 return nullptr; 119 119 } 120 120 121 121 bool SpaceRaceManager::reachedValidCheckpoint(RaceCheckPoint* oldCheckpoint, RaceCheckPoint* newCheckpoint, PlayerInfo* player) const 122 122 { 123 if (oldCheckpoint != NULL)123 if (oldCheckpoint != nullptr) 124 124 { 125 125 // the player already visited an old checkpoint; see which checkpoints are possible now 126 126 const std::set<int>& possibleCheckpoints = oldCheckpoint->getNextCheckpoints(); 127 for ( std::set<int>::const_iterator it = possibleCheckpoints.begin(); it != possibleCheckpoints.end(); ++it)128 if (this->findCheckpoint( *it) == newCheckpoint)127 for (int possibleCheckpoint : possibleCheckpoints) 128 if (this->findCheckpoint(possibleCheckpoint) == newCheckpoint) 129 129 return true; 130 130 return false; … … 179 179 { 180 180 const std::set<int>& oldVisible = oldCheckpoint->getNextCheckpoints(); 181 for ( std::set<int>::const_iterator it = oldVisible.begin(); it != oldVisible.end(); ++it)182 this->findCheckpoint( *it)->setRadarVisibility(false);181 for (int checkpointIndex : oldVisible) 182 this->findCheckpoint(checkpointIndex)->setRadarVisibility(false); 183 183 } 184 184 … … 188 188 189 189 const std::set<int>& newVisible = newCheckpoint->getNextCheckpoints(); 190 for ( std::set<int>::const_iterator it = newVisible.begin(); it != newVisible.end(); ++it)191 this->findCheckpoint( *it)->setRadarVisibility(true);190 for (int checkpointIndex : newVisible) 191 this->findCheckpoint(checkpointIndex)->setRadarVisibility(true); 192 192 } 193 193 } -
code/trunk/src/modules/gametypes/SpaceRaceManager.h
r9667 r11071 58 58 virtual ~SpaceRaceManager() ; 59 59 60 v oid XMLPort(Element& xmlelement, XMLPort::Mode mode);60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 61 61 62 62 void addCheckpoint(RaceCheckPoint* checkpoint); … … 69 69 std::vector<RaceCheckPoint*> getAllCheckpoints(); 70 70 71 v oid tick(float dt);71 virtual void tick(float dt) override; 72 72 73 73 protected: -
code/trunk/src/modules/hover/FlagHUD.cc
r11043 r11071 48 48 RegisterObject(FlagHUD); 49 49 50 this->hoverGame_ = NULL;50 this->hoverGame_ = nullptr; 51 51 this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() 52 52 .createOverlayElement("Panel", "FlagHUD_Panel_" + getUniqueNumberString())); … … 101 101 else 102 102 { 103 this->hoverGame_ = 0;103 this->hoverGame_ = nullptr; 104 104 } 105 105 } -
code/trunk/src/modules/hover/FlagHUD.h
r11041 r11071 47 47 virtual ~FlagHUD(); 48 48 49 virtual void tick(float dt) ;50 virtual void changedOwner() ;49 virtual void tick(float dt) override; 50 virtual void changedOwner() override; 51 51 52 52 void setFlagCount(int flagCount); -
code/trunk/src/modules/hover/Hover.cc
r11043 r11071 48 48 RegisterObject(Hover); 49 49 50 this->origin_ = NULL;50 this->origin_ = nullptr; 51 51 this->numberOfFlags_ = 1; 52 52 this->firstTick_ = true; -
code/trunk/src/modules/hover/Hover.h
r11043 r11071 50 50 Hover(Context* context); 51 51 52 virtual void tick(float dt) ;52 virtual void tick(float dt) override; 53 53 54 54 void setOrigin(HoverOrigin* origin) -
code/trunk/src/modules/hover/HoverFlag.cc
r11043 r11071 49 49 RegisterObject(HoverFlag); 50 50 51 this->model_ = NULL;52 this->cs_ = NULL;51 this->model_ = nullptr; 52 this->cs_ = nullptr; 53 53 this->collided_ = false; 54 54 55 55 this->enableCollisionCallback(); 56 56 this->setCollisionResponse(true); 57 this->setCollisionType( Static);57 this->setCollisionType(CollisionType::Static); 58 58 } 59 59 -
code/trunk/src/modules/hover/HoverFlag.h
r11042 r11071 51 51 void init(int xCoordinate, int yCoordinate, int cellSize); 52 52 53 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) ;53 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 54 54 55 55 inline bool getCollided() const -
code/trunk/src/modules/hover/HoverOrigin.cc
r11040 r11071 58 58 void HoverOrigin::checkGametype() 59 59 { 60 if (getGametype() != NULL&& this->getGametype()->isA(Class(Hover)))60 if (getGametype() != nullptr && this->getGametype()->isA(Class(Hover))) 61 61 { 62 62 Hover* hoverGametype = orxonox_cast<Hover*>(this->getGametype()); -
code/trunk/src/modules/hover/HoverOrigin.h
r11041 r11071 108 108 public: 109 109 HoverOrigin(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Hover. 110 virtual ~HoverOrigin() {}111 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method to create a HoverOrigin through XML.110 virtual ~HoverOrigin() = default; 111 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a HoverOrigin through XML. 112 112 113 113 inline void setNumCells(int numCells) -
code/trunk/src/modules/hover/HoverShip.h
r11041 r11071 44 44 HoverShip(Context* context); 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 /// sets this ships jumpBoost … … 53 53 { return this->jumpBoost_; } 54 54 55 virtual void moveFrontBack(const Vector2& value) ;55 virtual void moveFrontBack(const Vector2& value) override; 56 56 57 virtual void moveRightLeft(const Vector2& value) ;57 virtual void moveRightLeft(const Vector2& value) override; 58 58 59 virtual void moveUpDown(const Vector2& value) ;59 virtual void moveUpDown(const Vector2& value) override; 60 60 61 virtual void rotateYaw(const Vector2& value) ;61 virtual void rotateYaw(const Vector2& value) override; 62 62 63 virtual void rotatePitch(const Vector2& value) ;63 virtual void rotatePitch(const Vector2& value) override; 64 64 65 virtual void rotateRoll(const Vector2& value) ;65 virtual void rotateRoll(const Vector2& value) override; 66 66 67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 68 68 69 virtual void boost(bool bBoost) ;69 virtual void boost(bool bBoost) override; 70 70 71 71 private: -
code/trunk/src/modules/hover/HoverWall.cc
r11043 r11071 46 46 RegisterObject(HoverWall); 47 47 48 this->model_ = NULL;49 this->cs_ = NULL;48 this->model_ = nullptr; 49 this->cs_ = nullptr; 50 50 51 51 this->enableCollisionCallback(); 52 52 this->setCollisionResponse(true); 53 this->setCollisionType( Static);53 this->setCollisionType(CollisionType::Static); 54 54 } 55 55 -
code/trunk/src/modules/hover/TimeHUD.cc
r11043 r11071 47 47 this->time_ = 0.0f; 48 48 this->running_ = false; 49 this->hoverGame_ = 0;49 this->hoverGame_ = nullptr; 50 50 setRunning(true); 51 51 } … … 98 98 else 99 99 { 100 this->hoverGame_ = 0;100 this->hoverGame_ = nullptr; 101 101 } 102 102 } -
code/trunk/src/modules/hover/TimeHUD.h
r11041 r11071 45 45 TimeHUD(Context* context); 46 46 47 virtual void tick(float dt) ;48 virtual void changedOwner() ;47 virtual void tick(float dt) override; 48 virtual void changedOwner() override; 49 49 50 50 /// sets if the clock is running -
code/trunk/src/modules/invader/Invader.cc
r11052 r11071 61 61 RegisterObject(Invader); 62 62 this->numberOfBots_ = 0; //sets number of default bots temporarly to 0 63 this->center_ = 0;63 this->center_ = nullptr; 64 64 bEndGame = false; 65 65 lives = 3; … … 78 78 { 79 79 level++; 80 if (getPlayer() != NULL)80 if (getPlayer() != nullptr) 81 81 { 82 82 for (int i = 0; i < 7; i++) … … 103 103 InvaderShip* Invader::getPlayer() 104 104 { 105 if (player == NULL)105 if (player == nullptr) 106 106 { 107 for ( ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)108 player = *it;107 for (InvaderShip* ship : ObjectList<InvaderShip>()) 108 player = ship; 109 109 } 110 110 return player; … … 113 113 void Invader::spawnEnemy() 114 114 { 115 if (getPlayer() == NULL)115 if (getPlayer() == nullptr) 116 116 return; 117 117 … … 134 134 newPawn->setPosition(player->getPosition() + Vector3(500.f + 100 * i, 0, float(rand())/RAND_MAX * 400 - 200)); 135 135 } 136 } 137 138 void Invader::setCenterpoint(InvaderCenterPoint* center) 139 { 140 this->center_ = center; 136 141 } 137 142 … … 160 165 this->bForceSpawn_ = true; 161 166 162 if (this->center_ == NULL) // abandon mission!167 if (this->center_ == nullptr) // abandon mission! 163 168 { 164 169 orxout(internal_error) << "Invader: No Centerpoint specified." << endl; -
code/trunk/src/modules/invader/Invader.h
r10624 r11071 39 39 40 40 #include "gametypes/Deathmatch.h" 41 42 #include "InvaderCenterPoint.h"43 44 41 #include "tools/Timer.h" 45 42 … … 52 49 Invader(Context* context); 53 50 54 virtual void start() ;55 virtual void end() ;56 virtual void addBots(unsigned int amount) {} //<! overwrite function in order to bypass the addbots command51 virtual void start() override; 52 virtual void end() override; 53 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 57 54 58 55 void spawnEnemy(); 59 56 60 void setCenterpoint(InvaderCenterPoint* center) 61 { this->center_ = center; } 57 void setCenterpoint(InvaderCenterPoint* center); 62 58 63 59 int getLives(){return this->lives;} -
code/trunk/src/modules/invader/InvaderCenterPoint.cc
r10624 r11071 49 49 } 50 50 51 void InvaderCenterPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)52 {53 SUPER(InvaderCenterPoint, XMLPort, xmlelement, mode);54 }55 56 51 void InvaderCenterPoint::checkGametype() 57 52 { 58 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Invader)))53 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Invader))) 59 54 { 60 55 Invader* InvaderGametype = orxonox_cast<Invader*>(this->getGametype()); -
code/trunk/src/modules/invader/InvaderCenterPoint.h
r10624 r11071 47 47 InvaderCenterPoint(Context* context); //checks whether the gametype is actually Invader. 48 48 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);50 51 49 private: 52 50 void checkGametype(); -
code/trunk/src/modules/invader/InvaderEnemy.cc
r10625 r11071 32 32 */ 33 33 34 #include "invader/InvaderPrereqs.h"35 34 #include "InvaderEnemy.h" 35 36 #include "core/CoreIncludes.h" 37 #include "Invader.h" 36 38 #include "InvaderShip.h" 37 39 … … 54 56 removeHealth(2000); 55 57 56 if (player != NULL)58 if (player != nullptr) 57 59 { 58 60 float newZ = 2/(pow(abs(getPosition().x - player->getPosition().x) * 0.01f, 2) + 1) * (player->getPosition().z - getPosition().z); … … 62 64 } 63 65 64 inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)66 inline bool InvaderEnemy::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 65 67 { 66 68 if(orxonox_cast<InvaderShip*>(otherObject)) … … 71 73 Invader* InvaderEnemy::getGame() 72 74 { 73 if (game == NULL)75 if (game == nullptr) 74 76 { 75 for ( ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)76 game = *it;77 for (Invader* invader : ObjectList<Invader>()) 78 game = invader; 77 79 } 78 80 return game; … … 82 84 { 83 85 Pawn::damage(damage, healthdamage, shielddamage, originator, cs); 84 if (getGame() && orxonox_cast<InvaderShip*>(originator) != NULL&& getHealth() <= 0)86 if (getGame() && orxonox_cast<InvaderShip*>(originator) != nullptr && getHealth() <= 0) 85 87 getGame()->addPoints(42); 86 88 } -
code/trunk/src/modules/invader/InvaderEnemy.h
r10625 r11071 37 37 #include "invader/InvaderPrereqs.h" 38 38 39 #include "worldentities/pawns/ SpaceShip.h"39 #include "worldentities/pawns/Pawn.h" 40 40 41 41 namespace orxonox … … 46 46 InvaderEnemy(Context* context); 47 47 48 virtual void tick(float dt) ;49 virtual bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);50 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) ;48 virtual void tick(float dt) override; 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 50 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override; 51 51 virtual void setPlayer(InvaderShip* player){this->player = player;} 52 52 -
code/trunk/src/modules/invader/InvaderEnemyShooter.cc
r10628 r11071 32 32 */ 33 33 34 #include "invader/InvaderPrereqs.h"35 34 #include "InvaderEnemyShooter.h" 36 // #include "worldentities/pawns/SpaceShip.h" 35 36 #include "core/CoreIncludes.h" 37 #include "core/command/Executor.h" 38 #include "Invader.h" 39 #include "InvaderShip.h" 37 40 38 41 namespace orxonox … … 56 59 removeHealth(2000); 57 60 58 if (player != NULL)61 if (player != nullptr) 59 62 { 60 63 float distPlayer = player->getPosition().z - getPosition().z; … … 74 77 { 75 78 Pawn::damage(damage, healthdamage, shielddamage, originator, cs); 76 if (getGame() && orxonox_cast<InvaderShip*>(originator) != NULL&& getHealth() <= 0)79 if (getGame() && orxonox_cast<InvaderShip*>(originator) != nullptr && getHealth() <= 0) 77 80 getGame()->addPoints(3*42); 78 81 } -
code/trunk/src/modules/invader/InvaderEnemyShooter.h
r10626 r11071 47 47 InvaderEnemyShooter(Context* context); 48 48 49 virtual void tick(float dt) ;50 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) ;49 virtual void tick(float dt) override; 50 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override; 51 51 protected: 52 52 void shoot(); -
code/trunk/src/modules/invader/InvaderHUDinfo.cc
r10624 r11071 30 30 #include "core/XMLPort.h" 31 31 #include "util/Convert.h" 32 //#include "Invader.h"32 #include "Invader.h" 33 33 34 34 namespace orxonox … … 40 40 RegisterObject(InvaderHUDinfo); 41 41 42 this->InvaderGame = 0;42 this->InvaderGame = nullptr; 43 43 this->bShowLives_ = false; 44 44 this->bShowLevel_ = false; … … 132 132 else 133 133 { 134 this->InvaderGame = 0;134 this->InvaderGame = nullptr; 135 135 } 136 136 } -
code/trunk/src/modules/invader/InvaderHUDinfo.h
r9957 r11071 40 40 InvaderHUDinfo(Context* context); 41 41 42 virtual void tick(float dt) ;43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;44 virtual void changedOwner() ;42 virtual void tick(float dt) override; 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 44 virtual void changedOwner() override; 45 45 46 46 inline void setShowLives(bool value) -
code/trunk/src/modules/invader/InvaderShip.cc
r10624 r11071 37 37 #include "core/XMLPort.h" 38 38 #include "Invader.h" 39 #include "InvaderEnemy.h" 40 #include "graphics/Camera.h" 41 #include "weapons/projectiles/Projectile.h" 39 42 40 43 namespace orxonox … … 92 95 // Camera 93 96 Camera* camera = this->getCamera(); 94 if (camera != NULL)97 if (camera != nullptr) 95 98 { 96 99 camera->setPosition(Vector3(-pos.z, -posforeward, 0)); … … 139 142 isFireing = bBoost; 140 143 } 141 inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint) 144 void InvaderShip::rotateRoll(const Vector2& value) 145 { 146 if (getGame()) 147 if (getGame()->bEndGame) 148 getGame()->end(); 149 } 150 inline bool InvaderShip::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 142 151 { 143 152 // orxout() << "touch!!! " << endl; //<< otherObject << " at " << contactPoint; … … 145 154 Projectile* shot = orxonox_cast<Projectile*>(otherObject); 146 155 // ensure that this gets only called once per enemy. 147 if (enemy != NULL&& lastEnemy != enemy)156 if (enemy != nullptr && lastEnemy != enemy) 148 157 { 149 158 lastEnemy = enemy; … … 156 165 } 157 166 // was shot, decrease multiplier 158 else if (shot != NULL&& lastShot != shot)167 else if (shot != nullptr && lastShot != shot) 159 168 { 160 if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != NULL)169 if (getGame() && orxonox_cast<InvaderEnemy*>(shot->getShooter()) != nullptr) 161 170 { 162 171 if (getGame()->multiplier > 1) … … 173 182 Invader* InvaderShip::getGame() 174 183 { 175 if (game == NULL)184 if (game == nullptr) 176 185 { 177 for ( ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)178 game = *it;186 for (Invader* invader : ObjectList<Invader>()) 187 game = invader; 179 188 } 180 189 return game; -
code/trunk/src/modules/invader/InvaderShip.h
r10624 r11071 37 37 #include "invader/InvaderPrereqs.h" 38 38 39 #include "weapons/WeaponsPrereqs.h" 39 40 #include "worldentities/pawns/SpaceShip.h" 40 #include "graphics/Camera.h"41 #include "weapons/projectiles/Projectile.h"42 41 43 42 namespace orxonox … … 48 47 InvaderShip(Context* context); 49 48 50 virtual void tick(float dt) ;49 virtual void tick(float dt) override; 51 50 52 51 // overwrite for 2d movement 53 virtual void moveFrontBack(const Vector2& value) ;54 virtual void moveRightLeft(const Vector2& value) ;52 virtual void moveFrontBack(const Vector2& value) override; 53 virtual void moveRightLeft(const Vector2& value) override; 55 54 56 55 // Starts or stops fireing 57 virtual void boost(bool bBoost) ;56 virtual void boost(bool bBoost) override; 58 57 59 58 //no rotation! 60 virtual void rotateYaw(const Vector2& value) {};61 virtual void rotatePitch(const Vector2& value) {};59 virtual void rotateYaw(const Vector2& value) override{}; 60 virtual void rotatePitch(const Vector2& value) override{}; 62 61 //return to main menu if game has ended. 63 virtual void rotateRoll(const Vector2& value) {if (getGame()) if (getGame()->bEndGame) getGame()->end();};62 virtual void rotateRoll(const Vector2& value) override; 64 63 65 64 virtual void updateLevel(); 66 65 67 virtual inline bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);66 virtual inline bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 68 67 69 68 protected: 70 virtual void death() ;69 virtual void death() override; 71 70 private: 72 71 Invader* getGame(); -
code/trunk/src/modules/invader/InvaderWeapon.h
r9943 r11071 35 35 #define _InvaderWeapon_H__ 36 36 37 #include "invader/InvaderPrereqs.h" 38 39 #include "weapons/WeaponsPrereqs.h" 37 40 #include "weapons/weaponmodes/HsW01.h" 38 #include "weapons/WeaponsPrereqs.h"39 40 #include "tools/Timer.h"41 41 42 42 namespace orxonox … … 48 48 virtual ~InvaderWeapon(); 49 49 protected: 50 virtual void shot() ;50 virtual void shot() override; 51 51 WeakPtr<Projectile> projectile; 52 52 }; -
code/trunk/src/modules/invader/InvaderWeaponEnemy.cc
r9945 r11071 34 34 #include "InvaderWeaponEnemy.h" 35 35 36 #include "core/CoreIncludes.h" 37 #include "weapons/projectiles/Projectile.h" 38 36 39 namespace orxonox 37 40 { -
code/trunk/src/modules/invader/InvaderWeaponEnemy.h
r9943 r11071 35 35 #define _InvaderWeaponEnemy_H__ 36 36 37 // #include "weapons/weaponmodes/HsW01.h"38 // #include "weapons/WeaponsPrereqs.h" 39 #include " invader/InvaderWeapon.h"37 #include "invader/InvaderPrereqs.h" 38 39 #include "InvaderWeapon.h" 40 40 #include "tools/Timer.h" 41 41 … … 47 47 InvaderWeaponEnemy(Context* context); 48 48 protected: 49 virtual void shot() ;49 virtual void shot() override; 50 50 }; 51 51 } -
code/trunk/src/modules/jump/Jump.cc
r10262 r11071 34 34 #include "Jump.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/EventIncludes.h" 37 #include "core/command/Executor.h" 38 #include "core/config/ConfigValueIncludes.h" 39 #include "gamestates/GSLevel.h" 40 #include "chat/ChatManager.h" 36 41 37 #include "JumpCenterpoint.h" 42 38 #include "JumpPlatform.h" … … 56 52 #include "JumpBoots.h" 57 53 #include "JumpShield.h" 54 55 #include "gamestates/GSLevel.h" 58 56 #include "infos/PlayerInfo.h" 57 #include "graphics/Camera.h" 59 58 60 59 namespace orxonox … … 66 65 RegisterObject(Jump); 67 66 68 center_ = 0;69 figure_ = 0;70 camera = 0;67 center_ = nullptr; 68 figure_ = nullptr; 69 camera = nullptr; 71 70 setHUDTemplate("JumpHUD"); 72 73 setConfigValues();74 71 } 75 72 … … 86 83 SUPER(Jump, tick, dt); 87 84 88 if (figure_ != NULL)85 if (figure_ != nullptr) 89 86 { 90 87 Vector3 figurePosition = figure_->getPosition(); … … 101 98 if (screenShiftSinceLastUpdate_ > center_->getSectionLength()) 102 99 { 103 if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == false && figure_->rocketActive_ == false&& addAdventure(adventureNumber_) == true)100 if (sectionNumber_ > 2 && sectionNumber_%4 == 0 && rand()%2 == 0 && figure_->propellerActive_ == nullptr && figure_->rocketActive_ == nullptr && addAdventure(adventureNumber_) == true) 104 101 { 105 102 screenShiftSinceLastUpdate_ -= 2*center_->getSectionLength(); … … 133 130 134 131 135 if (camera != NULL)132 if (camera != nullptr) 136 133 { 137 134 Vector3 cameraPosition = Vector3(0, totalScreenShift_, 0); … … 144 141 } 145 142 146 ObjectList<JumpPlatform>::iterator beginPlatform = ObjectList<JumpPlatform>::begin(); 147 ObjectList<JumpPlatform>::iterator endPlatform = ObjectList<JumpPlatform>::end(); 148 ObjectList<JumpPlatform>::iterator itPlatform = beginPlatform; 143 ObjectList<JumpPlatform> listPlatform; 144 ObjectList<JumpPlatform>::iterator itPlatform = listPlatform.begin(); 149 145 Vector3 platformPosition; 150 146 151 while (itPlatform != endPlatform)147 while (itPlatform != listPlatform.end()) 152 148 { 153 149 platformPosition = itPlatform->getPosition(); … … 166 162 167 163 // Deleted deactivated platforms 168 ObjectList<JumpPlatformDisappear>::iterator beginDisappear = ObjectList<JumpPlatformDisappear>::begin(); 169 ObjectList<JumpPlatformDisappear>::iterator endDisappear = ObjectList<JumpPlatformDisappear>::end(); 170 ObjectList<JumpPlatformDisappear>::iterator itDisappear = beginDisappear; 171 172 while (itDisappear != endDisappear) 164 ObjectList<JumpPlatformDisappear> listDisappear; 165 ObjectList<JumpPlatformDisappear>::iterator itDisappear = listDisappear.begin(); 166 167 while (itDisappear != listDisappear.end()) 173 168 { 174 169 if (!itDisappear->isActive()) … … 185 180 } 186 181 187 ObjectList<JumpPlatformTimer>::iterator beginTimer = ObjectList<JumpPlatformTimer>::begin(); 188 ObjectList<JumpPlatformTimer>::iterator endTimer = ObjectList<JumpPlatformTimer>::end(); 189 ObjectList<JumpPlatformTimer>::iterator itTimer = beginTimer; 190 191 while (itTimer != endTimer) 182 ObjectList<JumpPlatformTimer> listTimer; 183 ObjectList<JumpPlatformTimer>::iterator itTimer = listTimer.begin(); 184 185 while (itTimer != listTimer.end()) 192 186 { 193 187 if (!itTimer->isActive()) … … 204 198 } 205 199 206 ObjectList<JumpProjectile>::iterator beginProjectile = ObjectList<JumpProjectile>::begin(); 207 ObjectList<JumpProjectile>::iterator endProjectile = ObjectList<JumpProjectile>::end(); 208 ObjectList<JumpProjectile>::iterator itProjectile = beginProjectile; 200 ObjectList<JumpProjectile> listProjectile; 201 ObjectList<JumpProjectile>::iterator itProjectile = listProjectile.begin(); 209 202 Vector3 projectilePosition; 210 203 211 while (itProjectile != endProjectile)204 while (itProjectile != listProjectile.end()) 212 205 { 213 206 projectilePosition = itProjectile->getPosition(); … … 225 218 } 226 219 227 ObjectList<JumpEnemy>::iterator beginEnemy = ObjectList<JumpEnemy>::begin(); 228 ObjectList<JumpEnemy>::iterator endEnemy = ObjectList<JumpEnemy>::end(); 229 ObjectList<JumpEnemy>::iterator itEnemy = beginEnemy; 220 ObjectList<JumpEnemy> listEnemy; 221 ObjectList<JumpEnemy>::iterator itEnemy = listEnemy.begin(); 230 222 Vector3 enemyPosition; 231 223 232 while (itEnemy != endEnemy)224 while (itEnemy != listEnemy.end()) 233 225 { 234 226 enemyPosition = itEnemy->getPosition(); … … 246 238 } 247 239 248 ObjectList<JumpItem>::iterator beginItem = ObjectList<JumpItem>::begin(); 249 ObjectList<JumpItem>::iterator endItem = ObjectList<JumpItem>::end(); 250 ObjectList<JumpItem>::iterator itItem = beginItem; 240 ObjectList<JumpItem> listItem; 241 ObjectList<JumpItem>::iterator itItem = listItem.begin(); 251 242 Vector3 itemPosition; 252 243 253 while (itItem != endItem)244 while (itItem != listItem.end()) 254 245 { 255 246 itemPosition = itItem->getPosition(); … … 273 264 void Jump::cleanup() 274 265 { 275 camera = 0;266 camera = nullptr; 276 267 } 277 268 278 269 void Jump::start() 279 270 { 280 if (center_ != NULL) // There needs to be a JumpCenterpoint, i.e. the area the game takes place.281 { 282 if (figure_ == NULL)271 if (center_ != nullptr) // There needs to be a JumpCenterpoint, i.e. the area the game takes place. 272 { 273 if (figure_ == nullptr) 283 274 { 284 275 figure_ = new JumpFigure(center_->getContext()); … … 301 292 Deathmatch::start(); 302 293 303 if (figure_ != NULL)294 if (figure_ != nullptr) 304 295 { 305 296 camera = figure_->getCamera(); … … 328 319 assert(player); 329 320 330 if (figure_->getPlayer() == NULL)321 if (figure_->getPlayer() == nullptr) 331 322 { 332 323 player->startControl(figure_); … … 337 328 PlayerInfo* Jump::getPlayer() const 338 329 { 339 if (this->figure_ != NULL)330 if (this->figure_ != nullptr) 340 331 { 341 332 return this->figure_->getPlayer(); … … 343 334 else 344 335 { 345 return 0;336 return nullptr; 346 337 } 347 338 } … … 349 340 void Jump::addPlatform(JumpPlatform* newPlatform, std::string platformTemplate, float xPosition, float zPosition) 350 341 { 351 if (newPlatform != NULL && center_ != NULL)342 if (newPlatform != nullptr && center_ != nullptr) 352 343 { 353 344 newPlatform->addTemplate(platformTemplate); … … 417 408 { 418 409 JumpProjectile* newProjectile = new JumpProjectile(center_->getContext()); 419 if (newProjectile != NULL && center_ != NULL)410 if (newProjectile != nullptr && center_ != nullptr) 420 411 { 421 412 newProjectile->addTemplate(center_->getProjectileTemplate()); … … 430 421 { 431 422 JumpSpring* newSpring = new JumpSpring(center_->getContext()); 432 if (newSpring != NULL && center_ != NULL)423 if (newSpring != nullptr && center_ != nullptr) 433 424 { 434 425 newSpring->addTemplate(center_->getSpringTemplate()); … … 443 434 { 444 435 JumpSpring* newSpring = new JumpSpring(center_->getContext()); 445 if (newSpring != NULL && center_ != NULL)436 if (newSpring != nullptr && center_ != nullptr) 446 437 { 447 438 newSpring->addTemplate(center_->getSpringTemplate()); … … 456 447 { 457 448 JumpRocket* newRocket = new JumpRocket(center_->getContext()); 458 if (newRocket != NULL && center_ != NULL)449 if (newRocket != nullptr && center_ != nullptr) 459 450 { 460 451 newRocket->addTemplate(center_->getRocketTemplate()); … … 469 460 { 470 461 JumpRocket* newRocket = new JumpRocket(center_->getContext()); 471 if (newRocket != NULL && center_ != NULL)462 if (newRocket != nullptr && center_ != nullptr) 472 463 { 473 464 newRocket->addTemplate(center_->getRocketTemplate()); … … 482 473 { 483 474 JumpPropeller* newPropeller = new JumpPropeller(center_->getContext()); 484 if (newPropeller != NULL && center_ != NULL)475 if (newPropeller != nullptr && center_ != nullptr) 485 476 { 486 477 newPropeller->addTemplate(center_->getPropellerTemplate()); … … 495 486 { 496 487 JumpPropeller* newPropeller = new JumpPropeller(center_->getContext()); 497 if (newPropeller != NULL && center_ != NULL)488 if (newPropeller != nullptr && center_ != nullptr) 498 489 { 499 490 newPropeller->addTemplate(center_->getPropellerTemplate()); … … 508 499 { 509 500 JumpBoots* newBoots = new JumpBoots(center_->getContext()); 510 if (newBoots != NULL && center_ != NULL)501 if (newBoots != nullptr && center_ != nullptr) 511 502 { 512 503 newBoots->addTemplate(center_->getBootsTemplate()); … … 521 512 { 522 513 JumpBoots* newBoots = new JumpBoots(center_->getContext()); 523 if (newBoots != NULL && center_ != NULL)514 if (newBoots != nullptr && center_ != nullptr) 524 515 { 525 516 newBoots->addTemplate(center_->getBootsTemplate()); … … 534 525 { 535 526 JumpShield* newShield = new JumpShield(center_->getContext()); 536 if (newShield != NULL && center_ != NULL)527 if (newShield != nullptr && center_ != nullptr) 537 528 { 538 529 newShield->addTemplate(center_->getShieldTemplate()); … … 547 538 { 548 539 JumpShield* newShield = new JumpShield(center_->getContext()); 549 if (newShield != NULL && center_ != NULL)540 if (newShield != nullptr && center_ != nullptr) 550 541 { 551 542 newShield->addTemplate(center_->getShieldTemplate()); … … 560 551 { 561 552 JumpEnemy* newEnemy = new JumpEnemy(center_->getContext()); 562 if (newEnemy != NULL && center_ != NULL)553 if (newEnemy != nullptr && center_ != nullptr) 563 554 { 564 555 switch (type) … … 619 610 const int numJ = 4; 620 611 621 enum PlatformType622 { 623 PLATFORM_EMPTY, PLATFORM_STATIC, PLATFORM_HMOVE, PLATFORM_VMOVE, PLATFORM_DISAPPEAR, PLATFORM_TIMER, PLATFORM_FAKE612 enum class PlatformType 613 { 614 EMPTY, STATIC, HMOVE, VMOVE, DISAPPEAR, TIMER, FAKE 624 615 }; 625 616 626 enum ItemType627 { 628 ITEM_NOTHING, ITEM_SPRING, ITEM_PROPELLER, ITEM_ROCKET, ITEM_BOOTS, ITEM_SHIELD617 enum class ItemType 618 { 619 NOTHING, SPRING, PROPELLER, ROCKET, BOOTS, SHIELD 629 620 }; 630 621 … … 640 631 for (int j = 0; j < numJ; ++j) 641 632 { 642 matrix[i][j].type = P LATFORM_EMPTY;633 matrix[i][j].type = PlatformType::EMPTY; 643 634 matrix[i][j].done = false; 644 635 } … … 646 637 PlatformType platformtype1; 647 638 PlatformType platformtype2; 648 ItemType itemType = I TEM_NOTHING;639 ItemType itemType = ItemType::NOTHING; 649 640 650 641 if (rand()%2 == 0) 651 642 { 652 itemType = I TEM_SPRING;643 itemType = ItemType::SPRING; 653 644 } 654 645 else if (rand()%2 == 0 && sectionNumber_ > 3) … … 657 648 { 658 649 case 0: 659 itemType = I TEM_PROPELLER;650 itemType = ItemType::PROPELLER; 660 651 break; 661 652 case 1: 662 itemType = I TEM_ROCKET;653 itemType = ItemType::ROCKET; 663 654 break; 664 655 case 2: 665 itemType = I TEM_BOOTS;656 itemType = ItemType::BOOTS; 666 657 break; 667 658 case 3: 668 itemType = I TEM_SHIELD;659 itemType = ItemType::SHIELD; 669 660 break; 670 661 default: … … 676 667 { 677 668 case 0: 678 platformtype1 = P LATFORM_STATIC;679 platformtype2 = P LATFORM_STATIC;669 platformtype1 = PlatformType::STATIC; 670 platformtype2 = PlatformType::STATIC; 680 671 break; 681 672 case 1: 682 platformtype1 = P LATFORM_STATIC;683 platformtype2 = P LATFORM_STATIC;673 platformtype1 = PlatformType::STATIC; 674 platformtype2 = PlatformType::STATIC; 684 675 break; 685 676 case 2: 686 platformtype1 = P LATFORM_STATIC;687 platformtype2 = P LATFORM_HMOVE;677 platformtype1 = PlatformType::STATIC; 678 platformtype2 = PlatformType::HMOVE; 688 679 break; 689 680 case 3: 690 platformtype1 = P LATFORM_STATIC;691 platformtype2 = P LATFORM_DISAPPEAR;681 platformtype1 = PlatformType::STATIC; 682 platformtype2 = PlatformType::DISAPPEAR; 692 683 break; 693 684 case 4: 694 platformtype1 = P LATFORM_STATIC;695 platformtype2 = P LATFORM_VMOVE;685 platformtype1 = PlatformType::STATIC; 686 platformtype2 = PlatformType::VMOVE; 696 687 break; 697 688 case 5: 698 platformtype1 = P LATFORM_STATIC;699 platformtype2 = P LATFORM_TIMER;689 platformtype1 = PlatformType::STATIC; 690 platformtype2 = PlatformType::TIMER; 700 691 break; 701 692 case 6: 702 platformtype1 = P LATFORM_HMOVE;703 platformtype2 = P LATFORM_STATIC;693 platformtype1 = PlatformType::HMOVE; 694 platformtype2 = PlatformType::STATIC; 704 695 break; 705 696 case 7: 706 platformtype1 = P LATFORM_HMOVE;707 platformtype2 = P LATFORM_HMOVE;697 platformtype1 = PlatformType::HMOVE; 698 platformtype2 = PlatformType::HMOVE; 708 699 break; 709 700 case 8: 710 platformtype1 = P LATFORM_HMOVE;711 platformtype2 = P LATFORM_HMOVE;701 platformtype1 = PlatformType::HMOVE; 702 platformtype2 = PlatformType::HMOVE; 712 703 break; 713 704 case 9: 714 platformtype1 = P LATFORM_HMOVE;715 platformtype2 = P LATFORM_DISAPPEAR;705 platformtype1 = PlatformType::HMOVE; 706 platformtype2 = PlatformType::DISAPPEAR; 716 707 break; 717 708 case 10: 718 platformtype1 = P LATFORM_HMOVE;719 platformtype2 = P LATFORM_VMOVE;709 platformtype1 = PlatformType::HMOVE; 710 platformtype2 = PlatformType::VMOVE; 720 711 break; 721 712 case 11: 722 platformtype1 = P LATFORM_HMOVE;723 platformtype2 = P LATFORM_TIMER;713 platformtype1 = PlatformType::HMOVE; 714 platformtype2 = PlatformType::TIMER; 724 715 break; 725 716 case 12: 726 platformtype1 = P LATFORM_DISAPPEAR;727 platformtype2 = P LATFORM_STATIC;717 platformtype1 = PlatformType::DISAPPEAR; 718 platformtype2 = PlatformType::STATIC; 728 719 break; 729 720 case 13: 730 platformtype1 = P LATFORM_DISAPPEAR;731 platformtype2 = P LATFORM_HMOVE;721 platformtype1 = PlatformType::DISAPPEAR; 722 platformtype2 = PlatformType::HMOVE; 732 723 break; 733 724 case 14: 734 platformtype1 = P LATFORM_DISAPPEAR;735 platformtype2 = P LATFORM_DISAPPEAR;725 platformtype1 = PlatformType::DISAPPEAR; 726 platformtype2 = PlatformType::DISAPPEAR; 736 727 break; 737 728 case 15: 738 platformtype1 = P LATFORM_DISAPPEAR;739 platformtype2 = P LATFORM_DISAPPEAR;729 platformtype1 = PlatformType::DISAPPEAR; 730 platformtype2 = PlatformType::DISAPPEAR; 740 731 break; 741 732 case 16: 742 platformtype1 = P LATFORM_DISAPPEAR;743 platformtype2 = P LATFORM_VMOVE;733 platformtype1 = PlatformType::DISAPPEAR; 734 platformtype2 = PlatformType::VMOVE; 744 735 break; 745 736 case 17: 746 platformtype1 = P LATFORM_DISAPPEAR;747 platformtype2 = P LATFORM_TIMER;737 platformtype1 = PlatformType::DISAPPEAR; 738 platformtype2 = PlatformType::TIMER; 748 739 break; 749 740 case 18: 750 platformtype1 = P LATFORM_VMOVE;751 platformtype2 = P LATFORM_STATIC;741 platformtype1 = PlatformType::VMOVE; 742 platformtype2 = PlatformType::STATIC; 752 743 break; 753 744 case 19: 754 platformtype1 = P LATFORM_VMOVE;755 platformtype2 = P LATFORM_HMOVE;745 platformtype1 = PlatformType::VMOVE; 746 platformtype2 = PlatformType::HMOVE; 756 747 break; 757 748 case 20: 758 platformtype1 = P LATFORM_VMOVE;759 platformtype2 = P LATFORM_DISAPPEAR;749 platformtype1 = PlatformType::VMOVE; 750 platformtype2 = PlatformType::DISAPPEAR; 760 751 break; 761 752 case 21: 762 platformtype1 = P LATFORM_VMOVE;763 platformtype2 = P LATFORM_VMOVE;753 platformtype1 = PlatformType::VMOVE; 754 platformtype2 = PlatformType::VMOVE; 764 755 break; 765 756 case 22: 766 platformtype1 = P LATFORM_VMOVE;767 platformtype2 = P LATFORM_VMOVE;757 platformtype1 = PlatformType::VMOVE; 758 platformtype2 = PlatformType::VMOVE; 768 759 break; 769 760 case 23: 770 platformtype1 = P LATFORM_VMOVE;771 platformtype2 = P LATFORM_TIMER;761 platformtype1 = PlatformType::VMOVE; 762 platformtype2 = PlatformType::TIMER; 772 763 break; 773 764 case 24: 774 platformtype1 = P LATFORM_TIMER;775 platformtype2 = P LATFORM_STATIC;765 platformtype1 = PlatformType::TIMER; 766 platformtype2 = PlatformType::STATIC; 776 767 break; 777 768 case 25: 778 platformtype1 = P LATFORM_TIMER;779 platformtype2 = P LATFORM_HMOVE;769 platformtype1 = PlatformType::TIMER; 770 platformtype2 = PlatformType::HMOVE; 780 771 break; 781 772 case 26: 782 platformtype1 = P LATFORM_TIMER;783 platformtype2 = P LATFORM_DISAPPEAR;773 platformtype1 = PlatformType::TIMER; 774 platformtype2 = PlatformType::DISAPPEAR; 784 775 break; 785 776 case 27: 786 platformtype1 = P LATFORM_TIMER;787 platformtype2 = P LATFORM_VMOVE;777 platformtype1 = PlatformType::TIMER; 778 platformtype2 = PlatformType::VMOVE; 788 779 break; 789 780 case 28: 790 platformtype1 = P LATFORM_TIMER;791 platformtype2 = P LATFORM_TIMER;781 platformtype1 = PlatformType::TIMER; 782 platformtype2 = PlatformType::TIMER; 792 783 break; 793 784 default: 794 platformtype1 = P LATFORM_TIMER;795 platformtype2 = P LATFORM_TIMER;785 platformtype1 = PlatformType::TIMER; 786 platformtype2 = PlatformType::TIMER; 796 787 break; 797 788 } … … 816 807 if (platformtype1 == platformtype2 && sectionNumber_ > 10 && rand()%2 == 0) 817 808 { 818 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;819 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;809 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 810 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 820 811 } 821 812 … … 825 816 if (rand()%2 == 0) 826 817 { 827 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;828 } 829 else 830 { 831 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;818 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 819 } 820 else 821 { 822 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 832 823 } 833 824 } … … 836 827 if (rand()%2 == 0) 837 828 { 838 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;839 } 840 else 841 { 842 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;829 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 830 } 831 else 832 { 833 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 843 834 } 844 835 if (rand()%2 == 0) 845 836 { 846 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;847 } 848 else 849 { 850 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;837 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 838 } 839 else 840 { 841 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 851 842 } 852 843 } … … 855 846 if (rand()%2 == 0) 856 847 { 857 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;858 } 859 else 860 { 861 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;848 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 849 } 850 else 851 { 852 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 862 853 } 863 854 if (rand()%2 == 0) 864 855 { 865 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;866 } 867 else 868 { 869 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;856 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 857 } 858 else 859 { 860 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 870 861 } 871 862 if (rand()%2 == 0) 872 863 { 873 matrix[rand()%numI][rand()%numJ].type = P LATFORM_EMPTY;874 } 875 else 876 { 877 matrix[rand()%numI][rand()%numJ].type = P LATFORM_FAKE;864 matrix[rand()%numI][rand()%numJ].type = PlatformType::EMPTY; 865 } 866 else 867 { 868 matrix[rand()%numI][rand()%numJ].type = PlatformType::FAKE; 878 869 } 879 870 } … … 898 889 switch(matrix[i][j].type) 899 890 { 900 case P LATFORM_EMPTY:891 case PlatformType::EMPTY: 901 892 matrix[i][j].done = true; 902 893 break; 903 case P LATFORM_STATIC:894 case PlatformType::STATIC: 904 895 xPosition = randomXPosition(numJ, j); 905 896 zPosition = sectionBegin + i*sectionLength/numI; … … 907 898 matrix[i][j].done = true; 908 899 break; 909 case P LATFORM_FAKE:900 case PlatformType::FAKE: 910 901 xPosition = randomXPosition(numJ, j); 911 902 zPosition = sectionBegin + i*sectionLength/numI; … … 913 904 matrix[i][j].done = true; 914 905 break; 915 case P LATFORM_TIMER:906 case PlatformType::TIMER: 916 907 xPosition = randomXPosition(numJ, j); 917 908 zPosition = sectionBegin + i*sectionLength/numI; … … 919 910 matrix[i][j].done = true; 920 911 break; 921 case P LATFORM_DISAPPEAR:912 case PlatformType::DISAPPEAR: 922 913 xPosition = randomXPosition(numJ, j); 923 914 zPosition = sectionBegin + i*sectionLength/numI; … … 925 916 matrix[i][j].done = true; 926 917 break; 927 case P LATFORM_HMOVE:918 case PlatformType::HMOVE: 928 919 xVelocity = randomSpeed(); 929 if (j <= numJ-3 && matrix[i][j+1].type == P LATFORM_HMOVE && matrix[i][j+2].type == PLATFORM_HMOVE && rand()%2 == 0)920 if (j <= numJ-3 && matrix[i][j+1].type == PlatformType::HMOVE && matrix[i][j+2].type == PlatformType::HMOVE && rand()%2 == 0) 930 921 { 931 922 leftBoundary = randomXPositionLeft(numJ, j); … … 938 929 matrix[i][j+2].done = true; 939 930 } 940 else if (j <= numJ-2 && matrix[i][j+1].type == P LATFORM_HMOVE && rand()%2 == 0)931 else if (j <= numJ-2 && matrix[i][j+1].type == PlatformType::HMOVE && rand()%2 == 0) 941 932 { 942 933 leftBoundary = randomXPositionLeft(numJ, j); … … 958 949 } 959 950 break; 960 case P LATFORM_VMOVE:951 case PlatformType::VMOVE: 961 952 zVelocity = randomSpeed(); 962 if (i <= numI-3 && matrix[i+1][j].type == P LATFORM_VMOVE && matrix[i+2][j].type == PLATFORM_VMOVE && rand()%2 == 0)953 if (i <= numI-3 && matrix[i+1][j].type == PlatformType::VMOVE && matrix[i+2][j].type == PlatformType::VMOVE && rand()%2 == 0) 963 954 { 964 955 lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd); … … 971 962 matrix[i+2][j].done = true; 972 963 } 973 else if (i <= numI-2 && matrix[i+1][j].type == P LATFORM_VMOVE && rand()%2 == 0)964 else if (i <= numI-2 && matrix[i+1][j].type == PlatformType::VMOVE && rand()%2 == 0) 974 965 { 975 966 lowerBoundary = randomZPositionLower(numI, i, sectionBegin, sectionEnd); … … 1009 1000 switch (itemType) 1010 1001 { 1011 case I TEM_ROCKET:1002 case ItemType::ROCKET: 1012 1003 addRocket(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1013 1004 break; 1014 case I TEM_PROPELLER:1005 case ItemType::PROPELLER: 1015 1006 addPropeller(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1016 1007 break; 1017 case I TEM_BOOTS:1008 case ItemType::BOOTS: 1018 1009 addBoots(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1019 1010 break; 1020 case I TEM_SHIELD:1011 case ItemType::SHIELD: 1021 1012 addShield(0.0, randomPosition(sectionBegin, sectionBegin + sectionLength), -fieldWidth/2, fieldWidth/2, 0.0, 0.0, randomSpeed(), 0.0); 1022 1013 break; … … 1029 1020 switch (itemType) 1030 1021 { 1031 case I TEM_ROCKET:1022 case ItemType::ROCKET: 1032 1023 addRocket(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1033 1024 break; 1034 case I TEM_PROPELLER:1025 case ItemType::PROPELLER: 1035 1026 addPropeller(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1036 1027 break; 1037 case I TEM_BOOTS:1028 case ItemType::BOOTS: 1038 1029 addBoots(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1039 1030 break; 1040 case I TEM_SHIELD:1031 case ItemType::SHIELD: 1041 1032 addShield(randomPosition(-fieldWidth/2, fieldWidth/2), sectionBegin + sectionLength/2, 0.0, 0.0, sectionBegin, sectionEnd, 0.0, randomSpeed()); 1042 1033 break; … … 1054 1045 switch (itemType) 1055 1046 { 1056 case I TEM_SPRING:1047 case ItemType::SPRING: 1057 1048 addSpring(itemPlatform); 1058 1049 break; 1059 case I TEM_ROCKET:1050 case ItemType::ROCKET: 1060 1051 addRocket(itemPlatform); 1061 1052 break; 1062 case I TEM_PROPELLER:1053 case ItemType::PROPELLER: 1063 1054 addPropeller(itemPlatform); 1064 1055 break; 1065 case I TEM_BOOTS:1056 case ItemType::BOOTS: 1066 1057 addBoots(itemPlatform); 1067 1058 break; 1068 case I TEM_SHIELD:1059 case ItemType::SHIELD: 1069 1060 addShield(itemPlatform); 1070 1061 break; … … 1273 1264 float Jump::getFuel() const 1274 1265 { 1275 if (this->figure_ != NULL)1276 { 1277 if (this->figure_->rocketActive_ != NULL)1266 if (this->figure_ != nullptr) 1267 { 1268 if (this->figure_->rocketActive_ != nullptr) 1278 1269 { 1279 1270 return this->figure_->rocketActive_->getFuelState(); 1280 1271 } 1281 else if (this->figure_->propellerActive_ != NULL)1272 else if (this->figure_->propellerActive_ != nullptr) 1282 1273 { 1283 1274 return this->figure_->propellerActive_->getFuelState(); 1284 1275 } 1285 else if (this->figure_->shieldActive_ != NULL)1276 else if (this->figure_->shieldActive_ != nullptr) 1286 1277 { 1287 1278 return this->figure_->shieldActive_->getFuelState(); 1288 1279 } 1289 else if (this->figure_->bootsActive_ != NULL)1280 else if (this->figure_->bootsActive_ != nullptr) 1290 1281 { 1291 1282 return this->figure_->bootsActive_->getFuelState(); … … 1300 1291 return figure_->dead_; 1301 1292 } 1293 1294 void Jump::setCenterpoint(JumpCenterpoint* center) 1295 { 1296 center_ = center; 1297 } 1298 1302 1299 } -
code/trunk/src/modules/jump/Jump.h
r10262 r11071 31 31 32 32 #include "jump/JumpPrereqs.h" 33 #include "tools/Timer.h"34 #include "graphics/Camera.h"35 33 #include "gametypes/Deathmatch.h" 36 #include "JumpCenterpoint.h"37 #include <list>38 34 39 35 namespace orxonox … … 44 40 Jump(Context* context); 45 41 virtual ~Jump(); 46 virtual void tick(float dt) ;47 virtual void start() ;48 virtual void end() ;49 virtual void spawnPlayer(PlayerInfo* player) ;42 virtual void tick(float dt) override; 43 virtual void start() override; 44 virtual void end() override; 45 virtual void spawnPlayer(PlayerInfo* player) override; 50 46 int getScore(PlayerInfo* player) const; 51 47 float getFuel() const; 52 48 bool getDead(PlayerInfo* player) const; 53 void setCenterpoint(JumpCenterpoint* center) 54 { center_ = center; } 49 void setCenterpoint(JumpCenterpoint* center); 55 50 PlayerInfo* getPlayer() const; 56 51 -
code/trunk/src/modules/jump/JumpBoots.cc
r10262 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h"38 #include "graphics/Model.h"39 #include "gametypes/Gametype.h"40 41 37 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 38 46 39 namespace orxonox … … 67 60 } 68 61 69 void JumpBoots::XMLPort(Element& xmlelement, XMLPort::Mode mode)70 {71 SUPER(JumpBoots, XMLPort, xmlelement, mode);72 }73 74 62 void JumpBoots::tick(float dt) 75 63 { … … 78 66 Vector3 rocketPosition = getWorldPosition(); 79 67 80 if (attachedToFigure_ == false && figure_ != NULL)68 if (attachedToFigure_ == false && figure_ != nullptr) 81 69 { 82 70 Vector3 figurePosition = figure_->getWorldPosition(); -
code/trunk/src/modules/jump/JumpBoots.h
r10262 r11071 30 30 #define _JumpBoots_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 #include "util/Math.h" 34 #include "worldentities/MovableEntity.h" 35 32 #include "JumpPrereqs.h" 33 #include "JumpItem.h" 36 34 37 35 namespace orxonox … … 42 40 JumpBoots(Context* context); 43 41 virtual ~JumpBoots(); 44 virtual void tick(float dt); 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 46 virtual void touchFigure(); 42 virtual void tick(float dt) override; 43 virtual void touchFigure() override; 47 44 virtual float getFuelState(); 48 45 protected: -
code/trunk/src/modules/jump/JumpCenterpoint.cc
r10624 r11071 33 33 34 34 #include "JumpCenterpoint.h" 35 35 36 #include "core/CoreIncludes.h" 36 37 #include "core/XMLPort.h" … … 82 83 void JumpCenterpoint::checkGametype() 83 84 { 84 if (getGametype() != NULL&& this->getGametype()->isA(Class(Jump)))85 if (getGametype() != nullptr && this->getGametype()->isA(Class(Jump))) 85 86 { 86 87 Jump* jumpGametype = orxonox_cast<Jump*>(this->getGametype()); -
code/trunk/src/modules/jump/JumpCenterpoint.h
r10624 r11071 31 31 32 32 #include "jump/JumpPrereqs.h" 33 34 #include <string>35 36 #include <util/Math.h>37 38 33 #include "worldentities/StaticEntity.h" 39 34 … … 113 108 JumpCenterpoint(Context* context); //!< Constructor. Registers and initializes the object and checks whether the gametype is actually Jump. 114 109 virtual ~JumpCenterpoint() {} 115 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method to create a JumpCenterpoint through XML.110 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a JumpCenterpoint through XML. 116 111 void setPlatformStaticTemplate(const std::string& balltemplate) 117 112 { this->platformStaticTemplate_ = balltemplate; } -
code/trunk/src/modules/jump/JumpEnemy.cc
r10624 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h" 38 #include "graphics/Model.h" 39 #include "gametypes/Gametype.h" 40 37 #include "core/XMLPort.h" 41 38 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 39 46 40 namespace orxonox … … 57 51 58 52 dead_ = false; 59 figure_ = 0;53 figure_ = nullptr; 60 54 width_ = 0.0; 61 55 height_ = 0.0; … … 125 119 Vector3 enemyPosition = getPosition(); 126 120 127 if (figure_ != NULL)121 if (figure_ != nullptr) 128 122 { 129 123 Vector3 figurePosition = figure_->getPosition(); -
code/trunk/src/modules/jump/JumpEnemy.h
r10624 r11071 37 37 38 38 #include "jump/JumpPrereqs.h" 39 40 #include "util/Math.h"41 42 39 #include "worldentities/MovableEntity.h" 43 44 40 45 41 namespace orxonox … … 50 46 JumpEnemy(Context* context); 51 47 virtual ~JumpEnemy(); 52 virtual void tick(float dt) ;53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void tick(float dt) override; 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 54 50 void setFieldDimension(float width, float height) 55 51 { this->fieldWidth_ = width; this->fieldHeight_ = height; } -
code/trunk/src/modules/jump/JumpFigure.cc
r10262 r11071 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/XMLPort.h" 38 #include "graphics/Model.h" 39 #include "JumpRocket.h" 40 #include "JumpPropeller.h" 41 #include "JumpBoots.h" 42 #include "JumpShield.h" 38 43 39 44 namespace orxonox … … 46 51 47 52 // initialize variables 48 leftHand_ = NULL;49 rightHand_ = NULL;53 leftHand_ = nullptr; 54 rightHand_ = nullptr; 50 55 fieldHeight_ = 0; 51 56 fieldWidth_ = 0; … … 70 75 animateHands_ = false; 71 76 turnUp_ = false; 72 rocketActive_ = NULL;73 propellerActive_ = NULL;74 bootsActive_ = NULL;75 shieldActive_ = NULL;77 rocketActive_ = nullptr; 78 propellerActive_ = nullptr; 79 bootsActive_ = nullptr; 80 shieldActive_ = nullptr; 76 81 rocketSpeed_ = 0.0; 77 82 propellerSpeed_ = 0.0; … … 106 111 // Move up/down 107 112 Vector3 velocity = getVelocity(); 108 if (rocketActive_ != NULL)113 if (rocketActive_ != nullptr) 109 114 { 110 115 velocity.z = rocketSpeed_; 111 116 } 112 else if (propellerActive_ != NULL)117 else if (propellerActive_ != nullptr) 113 118 { 114 119 velocity.z = propellerSpeed_; … … 139 144 } 140 145 141 if (leftHand_ != NULL)146 if (leftHand_ != nullptr) 142 147 { 143 148 leftHand_->setOrientation(Vector3(0.0, 1.0, 0.0), Degree(-handAngle_)); 144 149 } 145 if (rightHand_ != NULL)150 if (rightHand_ != nullptr) 146 151 { 147 152 rightHand_->setOrientation(Vector3(0.0, 1.0, 0.0), Degree(handAngle_)); … … 207 212 { 208 213 Vector3 velocity = getVelocity(); 209 if (bootsActive_ == NULL)214 if (bootsActive_ == nullptr) 210 215 { 211 216 velocity.z = 1.2f*jumpSpeed_; … … 234 239 void JumpFigure::CollisionWithEnemy(JumpEnemy* enemy) 235 240 { 236 if (rocketActive_ == NULL && propellerActive_ == NULL && shieldActive_ == NULL)241 if (rocketActive_ == nullptr && propellerActive_ == nullptr && shieldActive_ == nullptr) 237 242 { 238 243 dead_ = true; … … 242 247 bool JumpFigure::StartRocket(JumpRocket* rocket) 243 248 { 244 if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL)249 if (rocketActive_ == nullptr && propellerActive_ == nullptr && bootsActive_ == nullptr) 245 250 { 246 251 attach(rocket); … … 261 266 detach(rocket); 262 267 rocket->destroy(); 263 rocketActive_ = NULL;268 rocketActive_ = nullptr; 264 269 } 265 270 266 271 bool JumpFigure::StartPropeller(JumpPropeller* propeller) 267 272 { 268 if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL)273 if (rocketActive_ == nullptr && propellerActive_ == nullptr && bootsActive_ == nullptr) 269 274 { 270 275 attach(propeller); … … 285 290 detach(propeller); 286 291 propeller->destroy(); 287 propellerActive_ = NULL;292 propellerActive_ = nullptr; 288 293 } 289 294 290 295 bool JumpFigure::StartBoots(JumpBoots* boots) 291 296 { 292 if (rocketActive_ == NULL && propellerActive_ == NULL && bootsActive_ == NULL)297 if (rocketActive_ == nullptr && propellerActive_ == nullptr && bootsActive_ == nullptr) 293 298 { 294 299 attach(boots); … … 309 314 detach(boots); 310 315 boots->destroy(); 311 bootsActive_ = NULL;316 bootsActive_ = nullptr; 312 317 } 313 318 314 319 bool JumpFigure::StartShield(JumpShield* shield) 315 320 { 316 if (shieldActive_ == false)321 if (shieldActive_ == nullptr) 317 322 { 318 323 attach(shield); … … 333 338 detach(shield); 334 339 shield->destroy(); 335 shieldActive_ = NULL;340 shieldActive_ = nullptr; 336 341 } 337 342 -
code/trunk/src/modules/jump/JumpFigure.h
r10262 r11071 40 40 JumpFigure(Context* context); //!< Constructor. Registers and initializes the object. 41 41 virtual ~JumpFigure() {} 42 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;43 virtual void tick(float dt) ;44 virtual void moveFrontBack(const Vector2& value) ; //!< Overloaded the function to steer the bat up and down.45 virtual void moveRightLeft(const Vector2& value) ; //!< Overloaded the function to steer the bat up and down.46 virtual void rotateYaw(const Vector2& value) ;47 virtual void rotatePitch(const Vector2& value) ;48 virtual void rotateRoll(const Vector2& value) ;42 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 43 virtual void tick(float dt) override; 44 virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 45 virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 46 virtual void rotateYaw(const Vector2& value) override; 47 virtual void rotatePitch(const Vector2& value) override; 48 virtual void rotateRoll(const Vector2& value) override; 49 49 void fire(unsigned int firemode); 50 virtual void fired(unsigned int firemode) ;50 virtual void fired(unsigned int firemode) override; 51 51 virtual void JumpFromPlatform(JumpPlatform* platform); 52 52 virtual void JumpFromSpring(JumpSpring* spring); -
code/trunk/src/modules/jump/JumpItem.cc
r10624 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h" 38 #include "graphics/Model.h" 39 #include "gametypes/Gametype.h" 40 37 #include "core/XMLPort.h" 41 38 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 39 46 40 namespace orxonox … … 54 48 attachedToFigure_ = false; 55 49 56 figure_ = 0;50 figure_ = nullptr; 57 51 height_ = 0.0; 58 52 width_ = 0.0; -
code/trunk/src/modules/jump/JumpItem.h
r10624 r11071 37 37 38 38 #include "jump/JumpPrereqs.h" 39 40 #include "util/Math.h"41 42 39 #include "worldentities/MovableEntity.h" 43 40 … … 50 47 JumpItem(Context* context); 51 48 virtual ~JumpItem(); 52 virtual void tick(float dt) ;53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual void tick(float dt) override; 50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 54 51 virtual void setProperties(float newLeftBoundary, float newRightBoundary, float newLowerBoundary, float newUpperBoundary, float newHSpeed, float newVSpeed); 55 52 virtual void setFigure(JumpFigure* newFigure); -
code/trunk/src/modules/jump/JumpPlatform.cc
r10632 r11071 36 36 #include "core/CoreIncludes.h" 37 37 #include "core/GameMode.h" 38 #include "graphics/Model.h" 39 #include "gametypes/Gametype.h" 40 38 #include "core/XMLPort.h" 39 #include "sound/WorldSound.h" 41 40 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 41 46 42 namespace orxonox … … 52 48 RegisterObject(JumpPlatform); 53 49 54 figure_ = 0;50 figure_ = nullptr; 55 51 56 52 setPosition(Vector3(0,0,0)); … … 90 86 Vector3 platformPosition = this->getPosition(); 91 87 92 if (figure_ != NULL)88 if (figure_ != nullptr) 93 89 { 94 90 Vector3 figurePosition = figure_->getPosition(); -
code/trunk/src/modules/jump/JumpPlatform.h
r10632 r11071 36 36 #define _JumpPlatform_H__ 37 37 38 #include "jump/JumpPrereqs.h" 39 #include "util/Math.h" 38 #include "JumpPrereqs.h" 40 39 #include "worldentities/MovableEntity.h" 41 40 … … 47 46 JumpPlatform(Context* context); 48 47 virtual ~JumpPlatform(); 49 virtual void tick(float dt) ;50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void tick(float dt) override; 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 51 50 void setFigure(JumpFigure* newFigure); 52 51 virtual void touchFigure(); -
code/trunk/src/modules/jump/JumpPlatformDisappear.cc
r10262 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h"38 39 #include "gametypes/Gametype.h"40 41 37 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 38 46 39 namespace orxonox … … 58 51 { 59 52 60 }61 62 void JumpPlatformDisappear::XMLPort(Element& xmlelement, XMLPort::Mode mode)63 {64 SUPER(JumpPlatformDisappear, XMLPort, xmlelement, mode);65 }66 67 void JumpPlatformDisappear::tick(float dt)68 {69 SUPER(JumpPlatformDisappear, tick, dt);70 53 } 71 54 -
code/trunk/src/modules/jump/JumpPlatformDisappear.h
r10262 r11071 36 36 #define _JumpPlatformDisappear_H__ 37 37 38 #include "jump/JumpPrereqs.h" 39 #include "util/Math.h" 40 #include "worldentities/MovableEntity.h" 38 #include "JumpPrereqs.h" 39 #include "JumpPlatform.h" 41 40 42 41 namespace orxonox … … 47 46 JumpPlatformDisappear(Context* context); 48 47 virtual ~JumpPlatformDisappear(); 49 virtual void tick(float dt);50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);51 48 virtual void setProperties(bool active); 52 49 virtual bool isActive(); 53 virtual void touchFigure() ;50 virtual void touchFigure() override; 54 51 55 52 protected: -
code/trunk/src/modules/jump/JumpPlatformFake.cc
r10262 r11071 33 33 34 34 #include "JumpPlatformFake.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "gametypes/Gametype.h"38 #include "JumpFigure.h"39 #include "sound/WorldSound.h"40 #include "core/XMLPort.h"41 37 42 38 namespace orxonox … … 53 49 54 50 } 55 56 void JumpPlatformFake::XMLPort(Element& xmlelement, XMLPort::Mode mode)57 {58 SUPER(JumpPlatformFake, XMLPort, xmlelement, mode);59 }60 61 void JumpPlatformFake::tick(float dt)62 {63 SUPER(JumpPlatformFake, tick, dt);64 }65 66 51 } -
code/trunk/src/modules/jump/JumpPlatformFake.h
r10262 r11071 36 36 #define _JumpPlatformFake_H__ 37 37 38 #include "jump/JumpPrereqs.h" 39 40 #include "util/Math.h" 41 42 #include "worldentities/MovableEntity.h" 43 38 #include "JumpPrereqs.h" 39 #include "JumpPlatform.h" 44 40 45 41 namespace orxonox … … 50 46 JumpPlatformFake(Context* context); 51 47 virtual ~JumpPlatformFake(); 52 virtual void tick(float dt);53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);54 48 }; 55 49 } -
code/trunk/src/modules/jump/JumpPlatformHMove.cc
r10262 r11071 33 33 34 34 #include "JumpPlatformHMove.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "gametypes/Gametype.h"38 37 #include "JumpFigure.h" 39 #include "sound/WorldSound.h"40 #include "core/XMLPort.h"41 38 42 39 namespace orxonox … … 54 51 { 55 52 56 }57 58 void JumpPlatformHMove::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(JumpPlatformHMove, XMLPort, xmlelement, mode);61 53 } 62 54 -
code/trunk/src/modules/jump/JumpPlatformHMove.h
r10262 r11071 30 30 #define _JumpPlatformHMove_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 34 #include "util/Math.h" 35 36 #include "worldentities/MovableEntity.h" 37 32 #include "JumpPrereqs.h" 33 #include "JumpPlatform.h" 38 34 39 35 namespace orxonox … … 45 41 JumpPlatformHMove(Context* context); 46 42 virtual ~JumpPlatformHMove(); 47 virtual void tick(float dt); 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 43 virtual void tick(float dt) override; 49 44 virtual void setProperties(float leftBoundary, float rightBoundary, float speed); 50 virtual void touchFigure() ;45 virtual void touchFigure() override; 51 46 52 47 protected: -
code/trunk/src/modules/jump/JumpPlatformStatic.cc
r10262 r11071 33 33 34 34 #include "JumpPlatformStatic.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "gametypes/Gametype.h"38 37 #include "JumpFigure.h" 39 #include "sound/WorldSound.h"40 #include "core/XMLPort.h"41 38 42 39 namespace orxonox … … 55 52 } 56 53 57 //xml port for loading sounds58 void JumpPlatformStatic::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(JumpPlatformStatic, XMLPort, xmlelement, mode);61 }62 63 void JumpPlatformStatic::tick(float dt)64 {65 SUPER(JumpPlatformStatic, tick, dt);66 }67 68 54 void JumpPlatformStatic::touchFigure() 69 55 { -
code/trunk/src/modules/jump/JumpPlatformStatic.h
r10262 r11071 30 30 #define _JumpPlatformStatic_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 34 #include "util/Math.h" 35 36 #include "worldentities/MovableEntity.h" 37 32 #include "JumpPrereqs.h" 33 #include "JumpPlatform.h" 38 34 39 35 namespace orxonox … … 45 41 virtual ~JumpPlatformStatic(); 46 42 47 virtual void tick(float dt); 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 49 50 virtual void touchFigure(); 43 virtual void touchFigure() override; 51 44 }; 52 45 } -
code/trunk/src/modules/jump/JumpPlatformTimer.cc
r10262 r11071 33 33 34 34 #include "JumpPlatformTimer.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/ GameMode.h"37 #include "g ametypes/Gametype.h"37 #include "core/XMLPort.h" 38 #include "graphics/ParticleSpawner.h" 38 39 #include "JumpFigure.h" 39 #include "sound/WorldSound.h"40 #include "core/XMLPort.h"41 40 42 41 namespace orxonox … … 48 47 RegisterObject(JumpPlatformTimer); 49 48 50 particleSpawner_ = NULL;49 particleSpawner_ = nullptr; 51 50 52 51 setProperties(3.0); … … 72 71 73 72 time_ -= dt; 74 if (time_ < effectStartTime_ && particleSpawner_ == NULL)73 if (time_ < effectStartTime_ && particleSpawner_ == nullptr) 75 74 { 76 75 -
code/trunk/src/modules/jump/JumpPlatformTimer.h
r10262 r11071 36 36 #define _JumpPlatformTimer_H__ 37 37 38 #include "jump/JumpPrereqs.h" 39 40 #include "util/Math.h" 41 42 #include "worldentities/MovableEntity.h" 43 #include "graphics/ParticleSpawner.h" 44 38 #include "JumpPrereqs.h" 39 #include "JumpPlatform.h" 45 40 46 41 namespace orxonox … … 51 46 JumpPlatformTimer(Context* context); 52 47 virtual ~JumpPlatformTimer(); 53 virtual void tick(float dt) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void tick(float dt) override; 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 50 virtual void setProperties(float time); 56 51 virtual bool isActive(void); 57 virtual void touchFigure() ;52 virtual void touchFigure() override; 58 53 59 54 void setEffectPath(const std::string& effectPath) -
code/trunk/src/modules/jump/JumpPlatformVMove.cc
r10262 r11071 33 33 34 34 #include "JumpPlatformVMove.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "gametypes/Gametype.h"38 37 #include "JumpFigure.h" 39 #include "sound/WorldSound.h"40 #include "core/XMLPort.h"41 38 42 39 namespace orxonox … … 54 51 { 55 52 56 }57 58 void JumpPlatformVMove::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(JumpPlatformVMove, XMLPort, xmlelement, mode);61 53 } 62 54 -
code/trunk/src/modules/jump/JumpPlatformVMove.h
r10262 r11071 30 30 #define _JumpPlatformVMove_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 #include "util/Math.h" 34 #include "worldentities/MovableEntity.h" 32 #include "JumpPrereqs.h" 33 #include "JumpPlatform.h" 35 34 36 35 namespace orxonox … … 41 40 JumpPlatformVMove(Context* context); 42 41 virtual ~JumpPlatformVMove(); 43 virtual void tick(float dt); 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 42 virtual void tick(float dt) override; 45 43 virtual void setProperties(float leftBoundary, float rightBoundary, float speed); 46 virtual void touchFigure() ;44 virtual void touchFigure() override; 47 45 48 46 protected: -
code/trunk/src/modules/jump/JumpProjectile.cc
r10624 r11071 33 33 34 34 #include "JumpProjectile.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "graphics/Model.h"38 #include "gametypes/Gametype.h"39 37 #include "JumpFigure.h" 40 #include "sound/WorldSound.h" 41 #include "core/XMLPort.h" 38 #include "JumpEnemy.h" 42 39 43 40 namespace orxonox … … 49 46 RegisterObject(JumpProjectile); 50 47 51 figure_ = 0;48 figure_ = nullptr; 52 49 setPosition(Vector3(0,0,0)); 53 50 setVelocity(Vector3(0,0,250.0)); … … 60 57 } 61 58 62 void JumpProjectile::XMLPort(Element& xmlelement, XMLPort::Mode mode)63 {64 SUPER(JumpProjectile, XMLPort, xmlelement, mode);65 }66 67 59 void JumpProjectile::tick(float dt) 68 60 { … … 71 63 Vector3 projectilePosition = getPosition(); 72 64 73 for ( ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it)65 for (JumpEnemy* enemy : ObjectList<JumpEnemy>()) 74 66 { 75 Vector3 enemyPosition = it->getPosition();76 float enemyWidth = it->getWidth();77 float enemyHeight = it->getHeight();67 Vector3 enemyPosition = enemy->getPosition(); 68 float enemyWidth = enemy->getWidth(); 69 float enemyHeight = enemy->getHeight(); 78 70 79 71 if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight) 80 72 { 81 it->dead_ = true;73 enemy->dead_ = true; 82 74 } 83 75 } -
code/trunk/src/modules/jump/JumpProjectile.h
r10624 r11071 43 43 virtual ~JumpProjectile(); 44 44 45 virtual void tick(float dt); 46 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 45 virtual void tick(float dt) override; 48 46 49 47 void setFieldDimension(float width, float height) -
code/trunk/src/modules/jump/JumpPropeller.cc
r10262 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h"38 #include "graphics/Model.h"39 #include "gametypes/Gametype.h"40 41 37 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 38 46 39 namespace orxonox … … 67 60 } 68 61 69 void JumpPropeller::XMLPort(Element& xmlelement, XMLPort::Mode mode)70 {71 SUPER(JumpPropeller, XMLPort, xmlelement, mode);72 }73 74 62 void JumpPropeller::tick(float dt) 75 63 { … … 78 66 Vector3 PropellerPosition = getWorldPosition(); 79 67 80 if (attachedToFigure_ == false && figure_ != NULL)68 if (attachedToFigure_ == false && figure_ != nullptr) 81 69 { 82 70 Vector3 figurePosition = figure_->getWorldPosition(); -
code/trunk/src/modules/jump/JumpPropeller.h
r10262 r11071 30 30 #define _JumpPropeller_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 34 #include "util/Math.h" 35 36 #include "worldentities/MovableEntity.h" 37 32 #include "JumpPrereqs.h" 33 #include "JumpItem.h" 38 34 39 35 namespace orxonox … … 44 40 JumpPropeller(Context* context); 45 41 virtual ~JumpPropeller(); 46 virtual void tick(float dt); 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 virtual void touchFigure(); 42 virtual void tick(float dt) override; 43 virtual void touchFigure() override; 49 44 virtual float getFuelState(); 50 45 protected: -
code/trunk/src/modules/jump/JumpRocket.cc
r10262 r11071 33 33 34 34 #include "JumpRocket.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "graphics/Model.h"38 #include "gametypes/Gametype.h"39 37 #include "JumpFigure.h" 40 #include "sound/WorldSound.h"41 #include "core/XMLPort.h"42 38 43 39 namespace orxonox … … 64 60 } 65 61 66 void JumpRocket::XMLPort(Element& xmlelement, XMLPort::Mode mode)67 {68 SUPER(JumpRocket, XMLPort, xmlelement, mode);69 }70 71 62 void JumpRocket::tick(float dt) 72 63 { … … 75 66 Vector3 rocketPosition = getWorldPosition(); 76 67 77 if (attachedToFigure_ == false && figure_ != NULL)68 if (attachedToFigure_ == false && figure_ != nullptr) 78 69 { 79 70 Vector3 figurePosition = figure_->getWorldPosition(); -
code/trunk/src/modules/jump/JumpRocket.h
r10262 r11071 30 30 #define _JumpRocket_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 #include "util/Math.h" 34 #include "worldentities/MovableEntity.h" 32 #include "JumpPrereqs.h" 33 #include "JumpItem.h" 35 34 36 35 namespace orxonox … … 41 40 JumpRocket(Context* context); 42 41 virtual ~JumpRocket(); 43 virtual void tick(float dt); 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 45 virtual void touchFigure(); 42 virtual void tick(float dt) override; 43 virtual void touchFigure() override; 46 44 virtual float getFuelState(); 47 45 protected: -
code/trunk/src/modules/jump/JumpScore.cc
r10624 r11071 33 33 34 34 #include "JumpScore.h" 35 35 36 #include "core/CoreIncludes.h" 36 37 #include "core/XMLPort.h" … … 38 39 #include "infos/PlayerInfo.h" 39 40 #include "Jump.h" 40 #include "sound/WorldSound.h"41 41 42 42 namespace orxonox … … 48 48 RegisterObject(JumpScore); 49 49 50 owner_ = NULL;50 owner_ = nullptr; 51 51 showScore_ = false; 52 52 showFuel_ = false; … … 73 73 SUPER(JumpScore, tick, dt); 74 74 75 if (owner_ != NULL)75 if (owner_ != nullptr) 76 76 { 77 77 if (!owner_->hasEnded()) … … 79 79 player_ = owner_->getPlayer(); 80 80 81 if (player_ != NULL)81 if (player_ != nullptr) 82 82 { 83 83 if (showScore_ == true) … … 116 116 SUPER(JumpScore, changedOwner); 117 117 118 if (this->getOwner() != NULL&& this->getOwner()->getGametype())118 if (this->getOwner() != nullptr && this->getOwner()->getGametype()) 119 119 { 120 120 this->owner_ = orxonox_cast<Jump*>(this->getOwner()->getGametype()); … … 122 122 else 123 123 { 124 this->owner_ = NULL;124 this->owner_ = nullptr; 125 125 } 126 126 } -
code/trunk/src/modules/jump/JumpScore.h
r10262 r11071 44 44 virtual ~JumpScore(); 45 45 46 virtual void tick(float dt) ;47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void changedOwner() ;46 virtual void tick(float dt) override; 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 48 virtual void changedOwner() override; 49 49 50 50 void setShowScore(const bool showScore) -
code/trunk/src/modules/jump/JumpShield.cc
r10262 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/GameMode.h"38 #include "graphics/Model.h"39 #include "gametypes/Gametype.h"40 41 37 #include "JumpFigure.h" 42 43 #include "sound/WorldSound.h"44 #include "core/XMLPort.h"45 38 46 39 namespace orxonox … … 67 60 } 68 61 69 void JumpShield::XMLPort(Element& xmlelement, XMLPort::Mode mode)70 {71 SUPER(JumpShield, XMLPort, xmlelement, mode);72 }73 74 62 void JumpShield::tick(float dt) 75 63 { … … 78 66 Vector3 shieldPosition = getWorldPosition(); 79 67 80 if (attachedToFigure_ == false && figure_ != NULL)68 if (attachedToFigure_ == false && figure_ != nullptr) 81 69 { 82 70 Vector3 figurePosition = figure_->getWorldPosition(); -
code/trunk/src/modules/jump/JumpShield.h
r10262 r11071 30 30 #define _JumpShield_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 34 #include "util/Math.h" 35 36 #include "worldentities/MovableEntity.h" 37 32 #include "JumpPrereqs.h" 33 #include "JumpItem.h" 38 34 39 35 namespace orxonox … … 44 40 JumpShield(Context* context); 45 41 virtual ~JumpShield(); 46 virtual void tick(float dt); 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 48 virtual void touchFigure(); 42 virtual void tick(float dt) override; 43 virtual void touchFigure() override; 49 44 virtual float getFuelState(); 50 45 protected: -
code/trunk/src/modules/jump/JumpSpring.cc
r10262 r11071 33 33 34 34 #include "JumpSpring.h" 35 35 36 #include "core/CoreIncludes.h" 36 #include "core/GameMode.h"37 #include "graphics/Model.h"38 #include "gametypes/Gametype.h"39 37 #include "JumpFigure.h" 40 #include "sound/WorldSound.h"41 #include "core/XMLPort.h"42 38 43 39 namespace orxonox … … 63 59 } 64 60 65 void JumpSpring::XMLPort(Element& xmlelement, XMLPort::Mode mode)66 {67 SUPER(JumpSpring, XMLPort, xmlelement, mode);68 }69 70 61 void JumpSpring::tick(float dt) 71 62 { … … 80 71 Vector3 springPosition = getWorldPosition(); 81 72 82 if (figure_ != NULL)73 if (figure_ != nullptr) 83 74 { 84 75 Vector3 figurePosition = figure_->getWorldPosition(); … … 103 94 void JumpSpring::accelerateFigure() 104 95 { 105 if (figure_ != 0)96 if (figure_ != nullptr) 106 97 { 107 98 figure_->JumpFromSpring(this); -
code/trunk/src/modules/jump/JumpSpring.h
r10262 r11071 30 30 #define _JumpSpring_H__ 31 31 32 #include "jump/JumpPrereqs.h" 33 34 #include "util/Math.h" 35 36 #include "worldentities/MovableEntity.h" 37 32 #include "JumpPrereqs.h" 33 #include "JumpItem.h" 38 34 39 35 namespace orxonox … … 44 40 JumpSpring(Context* context); 45 41 virtual ~JumpSpring(); 46 virtual void tick(float dt); 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 42 virtual void tick(float dt) override; 48 43 virtual void accelerateFigure(); 49 virtual void touchFigure() ;44 virtual void touchFigure() override; 50 45 protected: 51 46 float stretch_; -
code/trunk/src/modules/mini4dgame/Mini4Dgame.cc
r10624 r11071 66 66 RegisterObject(Mini4Dgame); 67 67 68 this->board_ = 0;68 this->board_ = nullptr; 69 69 70 70 // Set the type of Bots for this particular Gametype. … … 88 88 void Mini4Dgame::cleanup() 89 89 { 90 if(this->board_ != NULL)// Destroy the board, if present.90 if(this->board_ != nullptr)// Destroy the board, if present. 91 91 { 92 92 //this->board_->destroy(); 93 this->board_ = 0;93 this->board_ = nullptr; 94 94 } 95 95 } … … 101 101 void Mini4Dgame::start() 102 102 { 103 if (this->board_ != NULL) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place.103 if (this->board_ != nullptr) // There needs to be a Mini4DgameCenterpoint, i.e. the area the game takes place. 104 104 { 105 105 /* 106 if (this->board_ == NULL)106 if (this->board_ == nullptr) 107 107 { 108 108 this->board_ = new Mini4DgameBoard(this->board_->getContext()); … … 155 155 { 156 156 // first spawn human players to assign always the left bat to the player in singleplayer 157 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)158 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))159 this->spawnPlayer( it->first);157 for (const auto& mapEntry : this->players_) 158 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 159 this->spawnPlayer(mapEntry.first); 160 160 // now spawn bots 161 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)162 if (! it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))163 this->spawnPlayer( it->first);161 for (const auto& mapEntry : this->players_) 162 if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 163 this->spawnPlayer(mapEntry.first); 164 164 } 165 165 … … 174 174 assert(player); 175 175 176 if(false)//this->player_ == NULL)176 if(false)//this->player_ == nullptr) 177 177 { 178 178 //this->player_ = player; … … 183 183 void Mini4Dgame::undoStone()//Vector4 move, const int playerColor) 184 184 { 185 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard> ::begin();185 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin(); 186 186 it->undoMove(); 187 187 } … … 191 191 { 192 192 Mini4DgamePosition move = Mini4DgamePosition(x,y,z,w); 193 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard> ::begin();193 ObjectList<Mini4DgameBoard>::iterator it = ObjectList<Mini4DgameBoard>().begin(); 194 194 it->makeMove(move); 195 195 } -
code/trunk/src/modules/mini4dgame/Mini4Dgame.h
r10230 r11071 41 41 namespace orxonox 42 42 { 43 44 namespace mini4DgamePlayerColor45 {46 enum color47 {48 none,49 red,50 blue,51 green52 };53 }54 55 43 /** 56 44 @brief … … 65 53 virtual ~Mini4Dgame(); //!< Destructor. Cleans up, if initialized. 66 54 67 virtual void start(void) ; //!< Starts the Mini4Dgame minigame.68 virtual void end(void) ; ///!< Ends the Mini4Dgame minigame.55 virtual void start(void) override; //!< Starts the Mini4Dgame minigame. 56 virtual void end(void) override; ///!< Ends the Mini4Dgame minigame. 69 57 70 virtual void spawnPlayer(PlayerInfo* player) ; //!< Spawns the input player.58 virtual void spawnPlayer(PlayerInfo* player) override; //!< Spawns the input player. 71 59 72 60 void setGameboard(Mini4DgameBoard* board) … … 84 72 85 73 protected: 86 virtual void spawnPlayersIfRequested() ; //!< Spawns player.74 virtual void spawnPlayersIfRequested() override; //!< Spawns player. 87 75 88 76 -
code/trunk/src/modules/mini4dgame/Mini4DgameAI.cc
r10230 r11071 60 60 61 61 this->setConfigValues(); 62 this->center_ = 0;62 this->center_ = nullptr; 63 63 } 64 64 … … 104 104 for(int k=0;k<4;k++){ 105 105 for(int l=0;l<4;l++){ 106 if (this->board_[i][j][k][l]== mini4DgamePlayerColor::none)106 if (this->board_[i][j][k][l]==Mini4DgamePlayerColor::none) 107 107 possibleMoves.push_back(Vector4(i,j,k,l)); 108 108 } … … 112 112 return possibleMoves; 113 113 } 114 115 /**116 @brief117 Is called each tick.118 Implements the behavior of the PongAI (i.e. its intelligence).119 @param dt120 The time that has elapsed since the last tick.121 */122 void Mini4DgameAI::tick(float dt)123 {124 125 }126 114 } -
code/trunk/src/modules/mini4dgame/Mini4DgameAI.h
r10230 r11071 39 39 #include <list> 40 40 41 #include "tools/interfaces/Tickable.h"42 43 41 #include "controllers/Controller.h" 44 42 #include "Mini4DgameCenterpoint.h" … … 55 53 Oliver Richter 56 54 */ 57 class _Mini4DgameExport Mini4DgameAI : public Controller , public Tickable55 class _Mini4DgameExport Mini4DgameAI : public Controller 58 56 { 59 57 public: … … 73 71 Vector4 makeMove(float timeout); 74 72 75 76 virtual void tick(float dt);77 78 73 void setCenterpoint(Mini4DgameCenterpoint* center) 79 74 { this->center_ = center; } … … 81 76 protected: 82 77 83 std::list<std::pair<Timer*, char> 78 std::list<std::pair<Timer*, char>> reactionTimers_; //!< A list of reaction timers and the directions that take effect when their timer expires. 84 79 Mini4DgameCenterpoint* center_; 85 80 … … 88 83 std::list<Vector4> getPossibleMoves(); 89 84 void copyBoard(); 90 mini4DgamePlayerColor::color board_[4][4][4][4];85 Mini4DgamePlayerColor board_[4][4][4][4]; 91 86 }; 92 87 } -
code/trunk/src/modules/mini4dgame/Mini4DgameBoard.cc
r10624 r11071 40 40 #include "graphics/BlinkingBillboard.h" 41 41 42 #include "core/XMLPort.h"43 44 42 #include "Mini4Dgame.h" 45 43 … … 63 61 for(int k=0;k<4;k++){ 64 62 for(int l=0;l<4;l++){ 65 this->board[i][j][k][l]= mini4DgamePlayerColor::none;66 this->blinkingBillboards[i][j][k][l] = 0;63 this->board[i][j][k][l]=Mini4DgamePlayerColor::none; 64 this->blinkingBillboards[i][j][k][l] = nullptr; 67 65 } 68 66 } … … 71 69 this->player_toggle_ = false; 72 70 this->checkGametype(); 73 }74 75 76 //xml port for loading sounds77 void Mini4DgameBoard::XMLPort(Element& xmlelement, XMLPort::Mode mode)78 {79 SUPER(Mini4DgameBoard, XMLPort, xmlelement, mode);80 71 } 81 72 … … 88 79 return (move.x<4 && move.y<4 && move.z<4 && move.w<4 89 80 && move.x>=0 && move.y>=0 && move.z>=0 && move.w>=0 90 && this->board[move.x][move.y][move.z][move.w] == mini4DgamePlayerColor::none);81 && this->board[move.x][move.y][move.z][move.w] == Mini4DgamePlayerColor::none); 91 82 } 92 83 … … 95 86 const Mini4DgamePosition& move = moves.back(); 96 87 moves.pop_back(); 97 this->board[move.x][move.y][move.z][move.w] = mini4DgamePlayerColor::none;88 this->board[move.x][move.y][move.z][move.w] = Mini4DgamePlayerColor::none; 98 89 this->blinkingBillboards[move.x][move.y][move.z][move.w]->destroy(); 99 this->blinkingBillboards[move.x][move.y][move.z][move.w] = 0;90 this->blinkingBillboards[move.x][move.y][move.z][move.w] = nullptr; 100 91 if(player_toggle_){ 101 92 this->player_toggle_ = false; … … 124 115 125 116 moves.push_back(move); 126 mini4DgamePlayerColor::color playerColor = mini4DgamePlayerColor::none;117 Mini4DgamePlayerColor playerColor = Mini4DgamePlayerColor::none; 127 118 if(player_toggle_){ 128 playerColor = mini4DgamePlayerColor::blue;119 playerColor = Mini4DgamePlayerColor::blue; 129 120 this->player_toggle_ = false; 130 121 }else{ 131 playerColor = mini4DgamePlayerColor::green;122 playerColor = Mini4DgamePlayerColor::green; 132 123 this->player_toggle_ = true; 133 124 } 134 125 135 this->board[move.x][move.y][move.z][move.w] = (mini4DgamePlayerColor::color)playerColor;126 this->board[move.x][move.y][move.z][move.w] = playerColor; 136 127 137 128 BlinkingBillboard* bb = new BlinkingBillboard(this->getContext()); … … 155 146 156 147 switch(playerColor){ 157 case mini4DgamePlayerColor::red:148 case Mini4DgamePlayerColor::red: 158 149 bb->setColour(ColourValue(1,0,0)); break; 159 case mini4DgamePlayerColor::green:150 case Mini4DgamePlayerColor::green: 160 151 bb->setColour(ColourValue(0,1,0)); break; 161 case mini4DgamePlayerColor::blue:152 case Mini4DgamePlayerColor::blue: 162 153 bb->setColour(ColourValue(0,0,1)); break; 163 154 default: break; … … 169 160 170 161 Mini4DgameWinner winner = this->getWinner(); 171 if(winner.color_ != mini4DgamePlayerColor::none)162 if(winner.color_ != Mini4DgamePlayerColor::none) 172 163 { 173 164 orxout(user_status) << "Mini4Dgame: win!!!!!!!" << endl; … … 197 188 { 198 189 Mini4DgameWinner winner; 199 winner.color_ = mini4DgamePlayerColor::none;190 winner.color_ = Mini4DgamePlayerColor::none; 200 191 201 192 //check diagonals rows-columns-height-numbers 202 193 for(int i=1; i<4; i++) 203 194 { 204 if(this->board[i][i][i][i]== mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i])195 if(this->board[i][i][i][i]==Mini4DgamePlayerColor::none || this->board[0][0][0][0] != this->board[i][i][i][i]) 205 196 break; 206 197 if(i==3) … … 218 209 for(int i=1; i<4; i++) 219 210 { 220 if(this->board[3-i][i][i][i]== mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i])211 if(this->board[3-i][i][i][i]==Mini4DgamePlayerColor::none || this->board[3][0][0][0] != this->board[3-i][i][i][i]) 221 212 break; 222 213 if(i==3) … … 234 225 for(int i=1; i<4; i++) 235 226 { 236 if(this->board[i][3-i][i][i]== mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i])227 if(this->board[i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[0][3][0][0] != this->board[i][3-i][i][i]) 237 228 break; 238 229 if(i==3) … … 250 241 for(int i=1; i<4; i++) 251 242 { 252 if(this->board[i][i][3-i][i]== mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i])243 if(this->board[i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][0][3][0] != this->board[i][i][3-i][i]) 253 244 break; 254 245 if(i==3) … … 266 257 for(int i=1; i<4; i++) 267 258 { 268 if(this->board[i][i][i][3-i]== mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i])259 if(this->board[i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][0][3] != this->board[i][i][i][3-i]) 269 260 break; 270 261 if(i==3) … … 282 273 for(int i=1; i<4; i++) 283 274 { 284 if(this->board[3-i][3-i][i][i]== mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i])275 if(this->board[3-i][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[3][3][0][0] != this->board[3-i][3-i][i][i]) 285 276 break; 286 277 if(i==3) … … 298 289 for(int i=1; i<4; i++) 299 290 { 300 if(this->board[3-i][i][3-i][i]== mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i])291 if(this->board[3-i][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[3][0][3][0] != this->board[3-i][i][3-i][i]) 301 292 break; 302 293 if(i==3) … … 314 305 for(int i=1; i<4; i++) 315 306 { 316 if(this->board[3-i][i][i][3-i]== mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i])307 if(this->board[3-i][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[3][0][0][3] != this->board[3-i][i][i][3-i]) 317 308 break; 318 309 if(i==3) … … 334 325 for(int i=1; i<4; i++) 335 326 { 336 if(this->board[i][i][i][l]== mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l])327 if(this->board[i][i][i][l]==Mini4DgamePlayerColor::none || this->board[0][0][0][l] != this->board[i][i][i][l]) 337 328 break; 338 329 if(i==3) … … 350 341 for(int i=1; i<4; i++) 351 342 { 352 if(this->board[3-i][i][i][l]== mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l])343 if(this->board[3-i][i][i][l]==Mini4DgamePlayerColor::none || this->board[3][0][0][l] != this->board[3-i][i][i][l]) 353 344 break; 354 345 if(i==3) … … 366 357 for(int i=1; i<4; i++) 367 358 { 368 if(this->board[i][3-i][i][l]== mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l])359 if(this->board[i][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[0][3][0][l] != this->board[i][3-i][i][l]) 369 360 break; 370 361 if(i==3) … … 382 373 for(int i=1; i<4; i++) 383 374 { 384 if(this->board[i][i][3-i][l]== mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l])375 if(this->board[i][i][3-i][l]==Mini4DgamePlayerColor::none || this->board[0][0][3][l] != this->board[i][i][3-i][l]) 385 376 break; 386 377 if(i==3) … … 403 394 for(int i=1; i<4; i++) 404 395 { 405 if(this->board[i][i][l][i]== mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i])396 if(this->board[i][i][l][i]==Mini4DgamePlayerColor::none || this->board[0][0][l][0] != this->board[i][i][l][i]) 406 397 break; 407 398 if(i==3) … … 419 410 for(int i=1; i<4; i++) 420 411 { 421 if(this->board[3-i][i][l][i]== mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i])412 if(this->board[3-i][i][l][i]==Mini4DgamePlayerColor::none || this->board[3][0][l][0] != this->board[3-i][i][l][i]) 422 413 break; 423 414 if(i==3) … … 435 426 for(int i=1; i<4; i++) 436 427 { 437 if(this->board[i][3-i][l][i]== mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i])428 if(this->board[i][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[0][3][l][0] != this->board[i][3-i][l][i]) 438 429 break; 439 430 if(i==3) … … 451 442 for(int i=1; i<4; i++) 452 443 { 453 if(this->board[i][i][l][3-i]== mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i])444 if(this->board[i][i][l][3-i]==Mini4DgamePlayerColor::none || this->board[0][0][l][3] != this->board[i][i][l][3-i]) 454 445 break; 455 446 if(i==3) … … 472 463 for(int i=1; i<4; i++) 473 464 { 474 if(this->board[i][l][i][i]== mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i])465 if(this->board[i][l][i][i]==Mini4DgamePlayerColor::none || this->board[0][l][0][0] != this->board[i][l][i][i]) 475 466 break; 476 467 if(i==3) … … 488 479 for(int i=1; i<4; i++) 489 480 { 490 if(this->board[3-i][l][i][i]== mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i])481 if(this->board[3-i][l][i][i]==Mini4DgamePlayerColor::none || this->board[3][l][0][0] != this->board[3-i][l][i][i]) 491 482 break; 492 483 if(i==3) … … 504 495 for(int i=1; i<4; i++) 505 496 { 506 if(this->board[i][l][3-i][i]== mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i])497 if(this->board[i][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[0][l][3][0] != this->board[i][l][3-i][i]) 507 498 break; 508 499 if(i==3) … … 520 511 for(int i=1; i<4; i++) 521 512 { 522 if(this->board[i][l][i][3-i]== mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i])513 if(this->board[i][l][i][3-i]==Mini4DgamePlayerColor::none || this->board[0][l][0][3] != this->board[i][l][i][3-i]) 523 514 break; 524 515 if(i==3) … … 541 532 for(int i=1; i<4; i++) 542 533 { 543 if(this->board[l][i][i][i]== mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i])534 if(this->board[l][i][i][i]==Mini4DgamePlayerColor::none || this->board[l][0][0][0] != this->board[l][i][i][i]) 544 535 break; 545 536 if(i==3) … … 557 548 for(int i=1; i<4; i++) 558 549 { 559 if(this->board[l][3-i][i][i]== mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i])550 if(this->board[l][3-i][i][i]==Mini4DgamePlayerColor::none || this->board[l][3][0][0] != this->board[l][3-i][i][i]) 560 551 break; 561 552 if(i==3) … … 573 564 for(int i=1; i<4; i++) 574 565 { 575 if(this->board[l][i][3-i][i]== mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i])566 if(this->board[l][i][3-i][i]==Mini4DgamePlayerColor::none || this->board[l][0][3][0] != this->board[l][i][3-i][i]) 576 567 break; 577 568 if(i==3) … … 589 580 for(int i=1; i<4; i++) 590 581 { 591 if(this->board[l][i][i][3-i]== mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i])582 if(this->board[l][i][i][3-i]==Mini4DgamePlayerColor::none || this->board[l][0][0][3] != this->board[l][i][i][3-i]) 592 583 break; 593 584 if(i==3) … … 611 602 for(int i=1; i<4; i++) 612 603 { 613 if(this->board[i][i][k][l]== mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l])604 if(this->board[i][i][k][l]==Mini4DgamePlayerColor::none || this->board[0][0][k][l] != this->board[i][i][k][l]) 614 605 break; 615 606 if(i==3) … … 627 618 for(int i=1; i<4; i++) 628 619 { 629 if(this->board[3-i][i][k][l]== mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l])620 if(this->board[3-i][i][k][l]==Mini4DgamePlayerColor::none || this->board[3][0][k][l] != this->board[3-i][i][k][l]) 630 621 break; 631 622 if(i==3) … … 644 635 for(int i=1; i<4; i++) 645 636 { 646 if(this->board[i][k][i][l]== mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l])637 if(this->board[i][k][i][l]==Mini4DgamePlayerColor::none || this->board[0][k][0][l] != this->board[i][k][i][l]) 647 638 break; 648 639 if(i==3) … … 660 651 for(int i=1; i<4; i++) 661 652 { 662 if(this->board[3-i][k][i][l]== mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l])653 if(this->board[3-i][k][i][l]==Mini4DgamePlayerColor::none || this->board[3][k][0][l] != this->board[3-i][k][i][l]) 663 654 break; 664 655 if(i==3) … … 677 668 for(int i=1; i<4; i++) 678 669 { 679 if(this->board[i][k][l][i]== mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i])670 if(this->board[i][k][l][i]==Mini4DgamePlayerColor::none || this->board[0][k][l][0] != this->board[i][k][l][i]) 680 671 break; 681 672 if(i==3) … … 693 684 for(int i=1; i<4; i++) 694 685 { 695 if(this->board[3-i][k][l][i]== mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i])686 if(this->board[3-i][k][l][i]==Mini4DgamePlayerColor::none || this->board[3][k][l][0] != this->board[3-i][k][l][i]) 696 687 break; 697 688 if(i==3) … … 710 701 for(int i=1; i<4; i++) 711 702 { 712 if(this->board[k][i][i][l]== mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l])703 if(this->board[k][i][i][l]==Mini4DgamePlayerColor::none || this->board[k][0][0][l] != this->board[k][i][i][l]) 713 704 break; 714 705 if(i==3) … … 726 717 for(int i=1; i<4; i++) 727 718 { 728 if(this->board[k][3-i][i][l]== mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l])719 if(this->board[k][3-i][i][l]==Mini4DgamePlayerColor::none || this->board[k][3][0][l] != this->board[k][3-i][i][l]) 729 720 break; 730 721 if(i==3) … … 743 734 for(int i=1; i<4; i++) 744 735 { 745 if(this->board[k][i][l][i]== mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i])736 if(this->board[k][i][l][i]==Mini4DgamePlayerColor::none || this->board[k][0][l][0] != this->board[k][i][l][i]) 746 737 break; 747 738 if(i==3) … … 759 750 for(int i=1; i<4; i++) 760 751 { 761 if(this->board[k][3-i][l][i]== mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i])752 if(this->board[k][3-i][l][i]==Mini4DgamePlayerColor::none || this->board[k][3][l][0] != this->board[k][3-i][l][i]) 762 753 break; 763 754 if(i==3) … … 776 767 for(int i=1; i<4; i++) 777 768 { 778 if(this->board[k][l][i][i]== mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i])769 if(this->board[k][l][i][i]==Mini4DgamePlayerColor::none || this->board[k][l][0][0] != this->board[k][l][i][i]) 779 770 break; 780 771 if(i==3) … … 792 783 for(int i=1; i<4; i++) 793 784 { 794 if(this->board[k][l][3-i][i]== mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i])785 if(this->board[k][l][3-i][i]==Mini4DgamePlayerColor::none || this->board[k][l][3][0] != this->board[k][l][3-i][i]) 795 786 break; 796 787 if(i==3) … … 813 804 for(int k=0;k<4;k++){ 814 805 for(int l=0;l<4;l++){ 815 if(this->board[0][j][k][l]!= mini4DgamePlayerColor::none806 if(this->board[0][j][k][l]!= Mini4DgamePlayerColor::none 816 807 && this->board[0][j][k][l]==this->board[1][j][k][l] 817 808 && this->board[1][j][k][l]==this->board[2][j][k][l] … … 835 826 for(int k=0;k<4;k++){ 836 827 for(int l=0;l<4;l++){ 837 if(this->board[i][0][k][l]!= mini4DgamePlayerColor::none828 if(this->board[i][0][k][l]!= Mini4DgamePlayerColor::none 838 829 && this->board[i][0][k][l]==this->board[i][1][k][l] 839 830 && this->board[i][1][k][l]==this->board[i][2][k][l] … … 857 848 for(int j=0;j<4;j++){ 858 849 for(int l=0;l<4;l++){ 859 if(this->board[i][j][0][l]!= mini4DgamePlayerColor::none850 if(this->board[i][j][0][l]!= Mini4DgamePlayerColor::none 860 851 && this->board[i][j][0][l]==this->board[i][j][1][l] 861 852 && this->board[i][j][1][l]==this->board[i][j][2][l] … … 879 870 for(int j=0;j<4;j++){ 880 871 for(int k=0;k<4;k++){ 881 if(this->board[i][j][k][0]!= mini4DgamePlayerColor::none872 if(this->board[i][j][k][0]!= Mini4DgamePlayerColor::none 882 873 && this->board[i][j][k][0]==this->board[i][j][k][1] 883 874 && this->board[i][j][k][1]==this->board[i][j][k][2] … … 905 896 void Mini4DgameBoard::checkGametype() 906 897 { 907 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Mini4Dgame)))898 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Mini4Dgame))) 908 899 { 909 900 Mini4Dgame* Mini4DgameGametype = orxonox_cast<Mini4Dgame*>(this->getGametype()); -
code/trunk/src/modules/mini4dgame/Mini4DgameBoard.h
r10624 r11071 42 42 namespace orxonox 43 43 { 44 enum class Mini4DgamePlayerColor 45 { 46 none, 47 red, 48 blue, 49 green 50 }; 44 51 45 52 struct Mini4DgamePosition … … 58 65 int winningHeight[4]; 59 66 int winningNumber[4]; 60 intcolor_;67 Mini4DgamePlayerColor color_; 61 68 }; 62 69 … … 74 81 //virtual ~Mini4DgameBoard(); 75 82 76 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);77 78 83 bool isValidMove(const Mini4DgamePosition& move); 79 84 void undoMove(); … … 88 93 bool player_toggle_; 89 94 BlinkingBillboard* blinkingBillboards[4][4][4][4]; 90 intboard[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number]95 Mini4DgamePlayerColor board[4][4][4][4]; //!< The logical board where the game takes place. board[row][column][height][number] 91 96 }; 92 97 } -
code/trunk/src/modules/notifications/NotificationDispatcher.cc
r10624 r11071 113 113 // TODO: Needed? 114 114 const std::string message = this->createNotificationMessage(); 115 NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::local);115 NotificationListener::sendNotification(message, this->getSender(), NotificationMessageType::info, NotificationSendMode::local); 116 116 117 117 // Broadcast … … 144 144 const std::string message = this->createNotificationMessage(); 145 145 // TODO: Make the type configurable. 146 NotificationListener::sendNotification(message, this->getSender(), notificationMessageType::info, notificationSendMode::network, clientId);146 NotificationListener::sendNotification(message, this->getSender(), NotificationMessageType::info, NotificationSendMode::network, clientId); 147 147 } 148 148 else if(GameMode::isServer()) … … 177 177 178 178 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 179 PlayerInfo* player = NULL;179 PlayerInfo* player = nullptr; 180 180 181 181 // If the trigger is a PlayerTrigger. 182 if(pTrigger != NULL)182 if(pTrigger != nullptr) 183 183 { 184 184 if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 190 190 return false; 191 191 192 if(player == NULL)192 if(player == nullptr) 193 193 { 194 194 orxout(verbose, context::notifications) << "The NotificationDispatcher was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl; -
code/trunk/src/modules/notifications/NotificationDispatcher.h
r9667 r11071 79 79 virtual ~NotificationDispatcher(); //!< Destructor. 80 80 81 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a NotificationDispatcher object through XML.82 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;81 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a NotificationDispatcher object through XML. 82 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 83 83 84 84 /** -
code/trunk/src/modules/notifications/NotificationManager.cc
r10624 r11071 69 69 { 70 70 // Destroys all Notifications. 71 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it!= this->allNotificationsList_.end(); it++)72 it->second->destroy();71 for(const auto& mapEntry : this->allNotificationsList_) 72 mapEntry.second->destroy(); 73 73 this->allNotificationsList_.clear(); 74 74 … … 106 106 Returns true if successful. 107 107 */ 108 bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type)108 bool NotificationManager::registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type) 109 109 { 110 110 // TODO: Do something with the type. … … 124 124 Returns true if the command was successfully executed. 125 125 */ 126 bool NotificationManager::executeCommand( notificationCommand::Valuecommand, const std::string& sender)126 bool NotificationManager::executeCommand(NotificationCommand command, const std::string& sender) 127 127 { 128 128 bool commandExecuted = false; 129 if(command == notificationCommand::clear)129 if(command == NotificationCommand::clear) 130 130 { 131 131 if(this->commandClear(sender)) … … 152 152 bool executed = false; 153 153 // Clear all NotificationQueues that have the input sender as target. 154 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.155 { 156 const std::set<std::string>& set = it->second->getTargetsSet();154 for(const auto& mapEntry : this->queues_) // Iterate through all NotificationQueues. 155 { 156 const std::set<std::string>& set = mapEntry.second->getTargetsSet(); 157 157 // If either the sender is 'all', the NotificationQueue has as target all or the NotificationQueue has the input sender as a target. 158 158 if(all || set.find(NotificationListener::ALL) != set.end() || set.find(sender) != set.end()) 159 executed = it->second->tidy() || executed;159 executed = mapEntry.second->tidy() || executed; 160 160 } 161 161 … … 187 187 188 188 // Insert the Notification in all NotificationQueues that have its sender as target. 189 for( std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) // Iterate through all NotificationQueues.190 { 191 const std::set<std::string>& set = it->second->getTargetsSet();189 for(const auto& mapEntry : this->queues_) // Iterate through all NotificationQueues. 190 { 191 const std::set<std::string>& set = mapEntry.second->getTargetsSet(); 192 192 bool bAll = set.find(NotificationListener::ALL) != set.end(); 193 193 // If either the Notification has as sender 'all', the NotificationQueue displays all Notifications or the NotificationQueue has the sender of the Notification as target. … … 195 195 { 196 196 if(!bAll) 197 this->notificationLists_[ it->second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue.198 it->second->update(notification, time); // Update the NotificationQueue.197 this->notificationLists_[mapEntry.second->getName()]->insert(std::pair<std::time_t, Notification*>(time, notification)); // Insert the Notification in the notifications list of the current NotificationQueue. 198 mapEntry.second->update(notification, time); // Update the NotificationQueue. 199 199 } 200 200 } … … 334 334 // If all senders are the target of the NotificationQueue, then the list of Notifications for that specific NotificationQueue is the same as the list of all Notifications. 335 335 bool bAll = set.find(NotificationListener::ALL) != set.end(); 336 std::multimap<std::time_t, Notification*>* map = NULL;336 std::multimap<std::time_t, Notification*>* map = nullptr; 337 337 if(bAll) 338 338 this->notificationLists_[queue->getName()] = &this->allNotificationsList_; … … 345 345 346 346 // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationQueue. 347 for( std::multimap<std::time_t, Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++)348 { 349 if(!bAll && set.find( it->second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target.350 map->insert(std::pair<std::time_t, Notification*>( it->first, it->second));347 for(const auto& mapEntry : this->allNotificationsList_) 348 { 349 if(!bAll && set.find(mapEntry.second->getSender()) != set.end()) // Checks whether the listener has the sender of the current Notification as target. 350 map->insert(std::pair<std::time_t, Notification*>(mapEntry.first, mapEntry.second)); 351 351 } 352 352 … … 395 395 The name of the NotificationQueue. 396 396 @return 397 Returns a pointer to the NotificationQueue with the input name. Returns NULLif no NotificationQueue with such a name exists.397 Returns a pointer to the NotificationQueue with the input name. Returns nullptr if no NotificationQueue with such a name exists. 398 398 */ 399 399 NotificationQueue* NotificationManager::getQueue(const std::string & name) 400 400 { 401 401 std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.find(name); 402 // Returns NULLif no such NotificationQueue exists.402 // Returns nullptr if no such NotificationQueue exists. 403 403 if(it == this->queues_.end()) 404 return NULL;404 return nullptr; 405 405 406 406 return (*it).second; … … 437 437 438 438 */ 439 Notification::Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type)439 Notification::Notification(const std::string& message, const std::string& sender, NotificationMessageType type) 440 440 { 441 441 this->initialize(); -
code/trunk/src/modules/notifications/NotificationManager.h
r9667 r11071 62 62 { 63 63 public: 64 Notification(const std::string& message, const std::string& sender, notificationMessageType::Value type);64 Notification(const std::string& message, const std::string& sender, NotificationMessageType type); 65 65 virtual ~Notification(); 66 66 … … 89 89 @return Returns an enum with the type of the Notification. 90 90 */ 91 inline notificationMessageType::Value getType(void) const91 inline NotificationMessageType getType(void) const 92 92 { return this->type_; } 93 93 … … 95 95 std::string message_; //!< The Notification message. 96 96 std::string sender_; //!< The sender of the notification. 97 notificationMessageType::Value type_; //!< The type of the notification.97 NotificationMessageType type_; //!< The type of the notification. 98 98 99 99 void initialize(void); //!< Registers the object and sets some default values. … … 120 120 virtual ~NotificationManager(); 121 121 122 virtual void preDestroy(void) ; // Is called before the object is destroyed.122 virtual void preDestroy(void) override; // Is called before the object is destroyed. 123 123 124 124 /** … … 128 128 static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export 129 129 130 virtual bool registerNotification(const std::string& message, const std::string& sender, notificationMessageType::Value type);131 virtual bool executeCommand( notificationCommand::Value command, const std::string& sender);130 virtual bool registerNotification(const std::string& message, const std::string& sender, NotificationMessageType type) override; 131 virtual bool executeCommand(NotificationCommand command, const std::string& sender) override; 132 132 133 133 bool registerNotification(Notification* notification); // Registers a Notification within the NotificationManager. -
code/trunk/src/modules/notifications/NotificationQueue.cc
r9667 r11071 206 206 { 207 207 // Add all Notifications that have been created after this NotificationQueue was created. 208 for( std::multimap<std::time_t, Notification*>::iterator it = notifications->begin(); it != notifications->end(); it++)208 for(const auto& mapEntry : *notifications) 209 209 { 210 if( it->first >= this->creationTime_)211 this->push( it->second, it->first);210 if(mapEntry.first >= this->creationTime_) 211 this->push(mapEntry.second, mapEntry.first); 212 212 } 213 213 } … … 336 336 this->ordering_.clear(); 337 337 // Delete all NotificationContainers in the list. 338 for( std::vector<NotificationContainer*>::iterator it = this->notifications_.begin(); it != this->notifications_.end(); it++)339 delete *it;338 for(NotificationContainer* notification : this->notifications_) 339 delete notification; 340 340 341 341 this->notifications_.clear(); … … 426 426 bool first = true; 427 427 // Iterate through the set of targets. 428 for( std::set<std::string>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)428 for(const std::string& target : this->targets_) 429 429 { 430 430 if(!first) … … 432 432 else 433 433 first = false; 434 stream << *it;434 stream << target; 435 435 } 436 436 -
code/trunk/src/modules/notifications/NotificationQueue.h
r9667 r11071 97 97 virtual ~NotificationQueue(); 98 98 99 virtual void tick(float dt) ; // To update from time to time.100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;101 102 virtual void changedName(void) ;99 virtual void tick(float dt) override; // To update from time to time. 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 101 102 virtual void changedName(void) override; 103 103 104 104 void update(void); // Updates the NotificationQueue. -
code/trunk/src/modules/notifications/NotificationQueueCEGUI.cc
r10258 r11071 290 290 The name of the NotificationQueueCEGUI to be got. 291 291 @return 292 Returns a pointer to the NotificationQueueCEGUI, or NULLif it doesn't exist.292 Returns a pointer to the NotificationQueueCEGUI, or nullptr if it doesn't exist. 293 293 */ 294 294 /*static*/ NotificationQueueCEGUI* NotificationQueueCEGUI::getQueue(const std::string& name) 295 295 { 296 296 NotificationQueue* queue = NotificationManager::getInstance().getQueue(name); 297 if(queue == NULL|| !queue->isA(Class(NotificationQueueCEGUI)))298 return NULL;297 if(queue == nullptr || !queue->isA(Class(NotificationQueueCEGUI))) 298 return nullptr; 299 299 return static_cast<NotificationQueueCEGUI*>(queue); 300 300 } -
code/trunk/src/modules/notifications/NotificationQueueCEGUI.h
r9667 r11071 73 73 virtual ~NotificationQueueCEGUI(); 74 74 75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 76 76 77 virtual void changedName(void) ;77 virtual void changedName(void) override; 78 78 79 79 void destroy(bool noGraphics = false); // Destroys the NotificationQueue. … … 136 136 void registerVariables(); 137 137 138 virtual void create(void) ; // Creates the NotificationQueue in lua.138 virtual void create(void) override; // Creates the NotificationQueue in lua. 139 139 140 virtual void notificationPushed(Notification* notification) ; // Is called by the NotificationQueue when a Notification was pushed141 virtual void notificationPopped(void) ; // Is called by the NotificationQueue when a Notification was popped.142 virtual void notificationRemoved(unsigned int index) ; // Is called when a Notification was removed.140 virtual void notificationPushed(Notification* notification) override; // Is called by the NotificationQueue when a Notification was pushed 141 virtual void notificationPopped(void) override; // Is called by the NotificationQueue when a Notification was popped. 142 virtual void notificationRemoved(unsigned int index) override; // Is called when a Notification was removed. 143 143 144 virtual void clear(bool noGraphics = false) ; // Clears the NotificationQueue by removing all NotificationContainers.144 virtual void clear(bool noGraphics = false) override; // Clears the NotificationQueue by removing all NotificationContainers. 145 145 146 146 protected: -
code/trunk/src/modules/objects/Attacher.cc
r9667 r11071 40 40 RegisterObject(Attacher); 41 41 42 this->target_ = 0;42 this->target_ = nullptr; 43 43 } 44 44 … … 61 61 SUPER(Attacher, changedActivity); 62 62 63 for ( std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)64 (*it)->setActive(this->isActive());63 for (WorldEntity* object : this->objects_) 64 object->setActive(this->isActive()); 65 65 } 66 66 … … 69 69 SUPER(Attacher, changedVisibility); 70 70 71 for ( std::list<WorldEntity*>::iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)72 (*it)->setVisible(this->isVisible());71 for (WorldEntity* object : this->objects_) 72 object->setVisible(this->isVisible()); 73 73 } 74 74 … … 83 83 { 84 84 unsigned int i = 0; 85 for ( std::list<WorldEntity*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)85 for (WorldEntity* object : this->objects_) 86 86 { 87 87 if (i == index) 88 return (*it);88 return object; 89 89 90 90 ++i; 91 91 } 92 return 0;92 return nullptr; 93 93 } 94 94 … … 96 96 { 97 97 this->targetname_ = target; 98 this->target_ = 0;98 this->target_ = nullptr; 99 99 100 100 if (this->targetname_.empty()) 101 101 return; 102 102 103 for ( ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)103 for (WorldEntity* worldEntity : ObjectList<WorldEntity>()) 104 104 { 105 if ( it->getName() == this->targetname_)105 if (worldEntity->getName() == this->targetname_) 106 106 { 107 this->target_ = *it;108 this->attachToParent( *it);107 this->target_ = worldEntity; 108 this->attachToParent(worldEntity); 109 109 } 110 110 } -
code/trunk/src/modules/objects/Attacher.h
r9667 r11071 51 51 virtual ~Attacher() {} 52 52 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 54 54 55 virtual void processEvent(Event& event) ;56 virtual void changedActivity() ;57 virtual void changedVisibility() ;55 virtual void processEvent(Event& event) override; 56 virtual void changedActivity() override; 57 virtual void changedVisibility() override; 58 58 59 59 void addObject(WorldEntity* object); … … 64 64 { return this->targetname_; } 65 65 66 v oid loadedNewXMLName(BaseObject* object);66 virtual void loadedNewXMLName(BaseObject* object) override; 67 67 68 68 private: -
code/trunk/src/modules/objects/ForceField.cc
r9945 r11071 67 67 this->setMassDiameter(0); //! We allow point-masses 68 68 this->setLength(2000); 69 this->mode_ = forceFieldMode::tube;69 this->mode_ = ForceFieldMode::tube; 70 70 71 71 this->registerVariables(); … … 115 115 void ForceField::tick(float dt) 116 116 { 117 if(this->mode_ == forceFieldMode::tube)118 { 119 // Iterate over all objects that could possibly be affected by the ForceField. 120 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)117 if(this->mode_ == ForceFieldMode::tube) 118 { 119 // Iterate over all objects that could possibly be affected by the ForceField. 120 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 121 121 { 122 122 // The direction of the orientation of the force field. … … 125 125 126 126 // Vector from the center of the force field to the object its acting on. 127 Vector3 distanceVector = it->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));127 Vector3 distanceVector = mobileEntity->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction)); 128 128 129 129 // The object is outside a ball around the center with radius length/2 of the ForceField. … … 132 132 133 133 // The distance of the object form the orientation vector. (Or rather the smallest distance from the orientation vector) 134 float distanceFromDirectionVector = (( it->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();134 float distanceFromDirectionVector = ((mobileEntity->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length(); 135 135 136 136 // If the object in a tube of radius 'radius' around the direction of orientation. … … 140 140 // Apply a force to the object in the direction of the orientation. 141 141 // The force is highest when the object is directly on the direction vector, with a linear decrease, finally reaching zero, when distanceFromDirectionVector = radius. 142 it->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);143 } 144 } 145 else if(this->mode_ == forceFieldMode::sphere)146 { 147 // Iterate over all objects that could possibly be affected by the ForceField. 148 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)149 { 150 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();142 mobileEntity->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction); 143 } 144 } 145 else if(this->mode_ == ForceFieldMode::sphere) 146 { 147 // Iterate over all objects that could possibly be affected by the ForceField. 148 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 149 { 150 Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition(); 151 151 float distance = distanceVector.length(); 152 152 // If the object is within 'radius' distance. … … 155 155 distanceVector.normalise(); 156 156 // Apply a force proportional to the velocity, with highest force at the origin of the sphere, linear decreasing until reaching a distance of 'radius' from the origin, where the force reaches zero. 157 it->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);158 } 159 } 160 } 161 else if(this->mode_ == forceFieldMode::invertedSphere)162 { 163 // Iterate over all objects that could possibly be affected by the ForceField. 164 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)165 { 166 Vector3 distanceVector = this->getWorldPosition() - it->getWorldPosition();157 mobileEntity->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector); 158 } 159 } 160 } 161 else if(this->mode_ == ForceFieldMode::invertedSphere) 162 { 163 // Iterate over all objects that could possibly be affected by the ForceField. 164 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 165 { 166 Vector3 distanceVector = this->getWorldPosition() - mobileEntity->getWorldPosition(); 167 167 float distance = distanceVector.length(); 168 168 // If the object is within 'radius' distance and no more than 'length' away from the boundary of the sphere. … … 172 172 distanceVector.normalise(); 173 173 // Apply a force proportional to the velocity, with highest force at the boundary of the sphere, linear decreasing until reaching a distance of 'radius-length' from the origin, where the force reaches zero. 174 it->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);175 } 176 } 177 } 178 else if(this->mode_ == forceFieldMode::newtonianGravity)179 { 180 // Iterate over all objects that could possibly be affected by the ForceField. 181 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)182 { 183 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();174 mobileEntity->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector); 175 } 176 } 177 } 178 else if(this->mode_ == ForceFieldMode::newtonianGravity) 179 { 180 // Iterate over all objects that could possibly be affected by the ForceField. 181 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 182 { 183 Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition(); 184 184 float distance = distanceVector.length(); 185 185 // If the object is within 'radius' distance and especially further away than massRadius_ … … 197 197 198 198 // Note: this so called force is actually an acceleration! 199 it->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);200 } 201 } 202 } 203 else if(this->mode_ == forceFieldMode::homogen)204 { 205 // Iterate over all objects that could possibly be affected by the ForceField. 206 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)207 { 208 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();199 mobileEntity->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector); 200 } 201 } 202 } 203 else if(this->mode_ == ForceFieldMode::homogen) 204 { 205 // Iterate over all objects that could possibly be affected by the ForceField. 206 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 207 { 208 Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition(); 209 209 float distance = distanceVector.length(); 210 210 if (distance < this->radius_ && distance > this->massRadius_) … … 212 212 // Add a Acceleration in forceDirection_. 213 213 // Vector3(0,0,0) is the direction, where the force should work. 214 it->addAcceleration(forceDirection_ , Vector3(0,0,0));214 mobileEntity->addAcceleration(forceDirection_ , Vector3(0,0,0)); 215 215 } 216 216 } … … 227 227 { 228 228 if(mode == ForceField::modeTube_s) 229 this->mode_ = forceFieldMode::tube;229 this->mode_ = ForceFieldMode::tube; 230 230 else if(mode == ForceField::modeSphere_s) 231 this->mode_ = forceFieldMode::sphere;231 this->mode_ = ForceFieldMode::sphere; 232 232 else if(mode == ForceField::modeInvertedSphere_s) 233 this->mode_ = forceFieldMode::invertedSphere;233 this->mode_ = ForceFieldMode::invertedSphere; 234 234 else if(mode == ForceField::modeNewtonianGravity_s) 235 this->mode_ = forceFieldMode::newtonianGravity;235 this->mode_ = ForceFieldMode::newtonianGravity; 236 236 237 237 else if(mode == ForceField::modeHomogen_s) 238 this->mode_ = forceFieldMode::homogen;238 this->mode_ = ForceFieldMode::homogen; 239 239 240 240 else 241 241 { 242 242 orxout(internal_warning) << "Wrong mode '" << mode << "' in ForceField. Setting to 'tube'." << endl; 243 this->mode_ = forceFieldMode::tube;243 this->mode_ = ForceFieldMode::tube; 244 244 } 245 245 } … … 255 255 switch(this->mode_) 256 256 { 257 case forceFieldMode::tube:257 case ForceFieldMode::tube: 258 258 return ForceField::modeTube_s; 259 case forceFieldMode::sphere:259 case ForceFieldMode::sphere: 260 260 return ForceField::modeSphere_s; 261 case forceFieldMode::invertedSphere:261 case ForceFieldMode::invertedSphere: 262 262 return ForceField::modeInvertedSphere_s; 263 case forceFieldMode::newtonianGravity:263 case ForceFieldMode::newtonianGravity: 264 264 return ForceField::modeNewtonianGravity_s; 265 265 266 case forceFieldMode::homogen:266 case ForceFieldMode::homogen: 267 267 return ForceField::modeHomogen_s; 268 268 -
code/trunk/src/modules/objects/ForceField.h
r10622 r11071 52 52 @ingroup Objects 53 53 */ 54 namespace forceFieldMode 55 { 56 enum Value { 57 tube, //!< The ForceField has a tube shape. 58 sphere, //!< The ForceField has a spherical shape. 59 invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior. 60 newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies. 61 homogen //!< Local homogenous Force field with changeable direction for the Space Station 62 }; 63 } 54 enum class ForceFieldMode { 55 tube, //!< The ForceField has a tube shape. 56 sphere, //!< The ForceField has a spherical shape. 57 invertedSphere, //!< The ForceField has a spherical shape but "inverted" behavior. 58 newtonianGravity, //!< The ForceField imitates Newtonian gravitation for use in stellar bodies. 59 homogen //!< Local homogenous Force field with changeable direction for the Space Station 60 }; 64 61 65 62 /** … … 92 89 virtual ~ForceField(); 93 90 94 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Creates a ForceField object through XML.91 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates a ForceField object through XML. 95 92 void registerVariables(); //!< Registers the variables that should get synchronised over the network 96 virtual void tick(float dt) ; //!< A method that is called every tick.93 virtual void tick(float dt) override; //!< A method that is called every tick. 97 94 98 95 … … 172 169 float massRadius_; //!< The radius of the stellar body for the Newtonian ForceField. 173 170 float halfLength_; //!< Half of the length of the ForceField. 174 intmode_; //!< The mode of the ForceField.171 ForceFieldMode mode_; //!< The mode of the ForceField. 175 172 176 173 //! Gravitational constant for Newtonian ForceFields. -
code/trunk/src/modules/objects/Planet.h
r10624 r11071 52 52 virtual ~Planet(); 53 53 54 virtual void tick(float dt) ;54 virtual void tick(float dt) override; 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 57 58 virtual void changedVisibility() ;58 virtual void changedVisibility() override; 59 59 60 60 inline void setMeshSource(const std::string& meshname) -
code/trunk/src/modules/objects/Script.cc
r10624 r11071 140 140 141 141 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 142 PlayerInfo* player = NULL;142 PlayerInfo* player = nullptr; 143 143 144 144 // If the trigger is a PlayerTrigger. 145 if(pTrigger != NULL)145 if(pTrigger != nullptr) 146 146 { 147 147 if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 153 153 return false; 154 154 155 if(player == NULL) //TODO: Will this ever happen? If not, change in NotificationDispatcher as well.155 if(player == nullptr) //TODO: Will this ever happen? If not, change in NotificationDispatcher as well. 156 156 { 157 157 orxout(internal_warning) << "The Script was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 196 196 { 197 197 const std::map<unsigned int, PlayerInfo*> clients = PlayerManager::getInstance().getClients(); 198 for( std::map<unsigned int, PlayerInfo*>::const_iterator it = clients.begin(); it != clients.end(); it++)198 for(const auto& mapEntry : clients) 199 199 { 200 callStaticNetworkFunction(&Script::executeHelper, it->first, this->getCode(), this->getMode(), this->getNeedsGraphics());200 callStaticNetworkFunction(&Script::executeHelper, mapEntry.first, this->getCode(), this->getMode(), this->getNeedsGraphics()); 201 201 if(this->times_ != Script::INF) // Decrement the number of remaining executions. 202 202 { -
code/trunk/src/modules/objects/Script.h
r9667 r11071 51 51 @brief The mode a specific @ref orxonox::Script "Script" is in. 52 52 */ 53 namespaceScriptMode53 enum class ScriptMode 54 54 { 55 enum Value 56 { 57 normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor". 58 lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua. 59 }; 60 } 55 normal, //!< The @ref orxonox::Script "Scripts'" code is executed through the @ref orxonox::CommandExecutor "CommandExecutor". 56 lua //!< The @ref orxonox::Script "Scripts'" code is executed through lua. 57 }; 61 58 62 59 /** … … 98 95 virtual ~Script(); 99 96 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a Script object through XML.101 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Creates a port that can be used to channel events and react to them.97 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Script object through XML. 98 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates a port that can be used to channel events and react to them. 102 99 103 100 bool trigger(bool triggered, BaseObject* trigger); //!< Is called when an event comes in trough the event port. … … 168 165 { return this->forAll_; } 169 166 170 virtual void clientConnected(unsigned int clientId) ; //!< Callback that is called when a new client has connected.171 virtual void clientDisconnected(unsigned int clientid) {}167 virtual void clientConnected(unsigned int clientId) override; //!< Callback that is called when a new client has connected. 168 virtual void clientDisconnected(unsigned int clientid) override {} 172 169 173 170 private: … … 178 175 179 176 std::string code_; //!< The code that is executed by this Script. 180 ScriptMode ::Valuemode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua.177 ScriptMode mode_; //!< The mode the Script is in. Determines whether the code is executed the normal way or in lua. 181 178 std::string modeStr_; //!< The mode the Script is in, as a string. Is used for networking purposes. 182 179 bool onLoad_; //!< Whether the Scripts code is executed upon loading (creation) of this Script. … … 193 190 @param mode The mode of the Script. 194 191 */ 195 inline void setMode(ScriptMode ::Valuemode)192 inline void setMode(ScriptMode mode) 196 193 { this->mode_ = mode; } 197 194 }; -
code/trunk/src/modules/objects/SpaceBoundaries.cc
r10624 r11071 59 59 this->pawnsIn_.clear(); 60 60 61 for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)61 for(BillboardAdministration& billboard : this->billboards_) 62 62 { 63 if( current->billy != NULL)64 { 65 delete current->billy;63 if( billboard.billy != nullptr) 64 { 65 delete billboard.billy; 66 66 } 67 67 } … … 73 73 { 74 74 pawnsIn_.clear(); 75 for(ObjectList<Pawn>::iterator current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current) 76 { 77 Pawn* currentPawn = *current; 75 for(Pawn* currentPawn : ObjectList<Pawn>()) 76 { 78 77 if( this->reaction_ == 0 ) 79 78 { … … 127 126 void SpaceBoundaries::setBillboardOptions(Billboard *billy) 128 127 { 129 if(billy != NULL)128 if(billy != nullptr) 130 129 { 131 130 billy->setMaterial("Grid"); … … 138 137 void SpaceBoundaries::removeAllBillboards() 139 138 { 140 for( std::vector<BillboardAdministration>::iterator current = this->billboards_.begin(); current != this->billboards_.end(); current++)141 { 142 current->usedYet = false;143 current->billy->setVisible(false);139 for(BillboardAdministration& billboard : this->billboards_) 140 { 141 billboard.usedYet = false; 142 billboard.billy->setVisible(false); 144 143 } 145 144 } … … 208 207 float distance; 209 208 bool humanItem; 210 for( std::list<WeakPtr<Pawn> >::iterator current = pawnsIn_.begin(); current != pawnsIn_.end(); current++ ) 211 { 212 Pawn* currentPawn = *current; 209 for(Pawn* currentPawn : pawnsIn_) 210 { 213 211 if( currentPawn && currentPawn->getNode() ) 214 212 { … … 250 248 float SpaceBoundaries::computeDistance(WorldEntity *item) 251 249 { 252 if(item != NULL)250 if(item != nullptr) 253 251 { 254 252 Vector3 itemPosition = item->getWorldPosition(); … … 310 308 bool SpaceBoundaries::isHumanPlayer(Pawn *item) 311 309 { 312 if(item != NULL)310 if(item != nullptr) 313 311 { 314 312 if(item->getPlayer()) -
code/trunk/src/modules/objects/SpaceBoundaries.h
r9667 r11071 93 93 int getReaction(); 94 94 95 v oid XMLPort(Element& xmlelement, XMLPort::Mode mode);95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 96 96 97 v oid tick(float dt);97 virtual void tick(float dt) override; 98 98 99 99 private: … … 101 101 102 102 // Variabeln:: 103 std::list<WeakPtr<Pawn> 103 std::list<WeakPtr<Pawn>> pawnsIn_; //!< List of the pawns that this instance of SpaceBoundaries has to handle. 104 104 105 105 std::vector<BillboardAdministration> billboards_; -
code/trunk/src/modules/objects/Turret.cc
r10622 r11071 278 278 //slower the closer it is to the destination 279 279 Quaternion drot = Quaternion::nlerp(dt*this->rotationThrust_/20.f, Quaternion::IDENTITY, this->rotation_); 280 this->rotate(drot, WorldEntity:: World);280 this->rotate(drot, WorldEntity::TransformSpace::World); 281 281 this->rotation_ = Quaternion::IDENTITY; 282 282 } -
code/trunk/src/modules/objects/Turret.h
r11052 r11071 61 61 virtual ~Turret(); 62 62 63 virtual void rotatePitch(const Vector2& value) ;64 virtual void rotateYaw(const Vector2& value) ;65 virtual void rotateRoll(const Vector2& value) ;63 virtual void rotatePitch(const Vector2& value) override; 64 virtual void rotateYaw(const Vector2& value) override; 65 virtual void rotateRoll(const Vector2& value) override; 66 66 virtual float isInRange(const WorldEntity* target); 67 67 virtual void aimAtPosition(const Vector3 &position); 68 68 69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;70 virtual void tick(float dt) ;69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 70 virtual void tick(float dt) override; 71 71 72 72 /** @brief Sets the maximum distance the turret is allowed to shoot. @param radius The distance*/ -
code/trunk/src/modules/objects/controllers/TeamTargetProxy.cc
r10262 r11071 28 28 29 29 #include "TeamTargetProxy.h" 30 #include "core/CoreIncludes.h" 30 31 #include "worldentities/ControllableEntity.h" 31 32 #include "worldentities/pawns/Pawn.h" -
code/trunk/src/modules/objects/controllers/TurretController.cc
r10622 r11071 30 30 #include "worldentities/pawns/Pawn.h" 31 31 #include "objects/Turret.h" 32 #include "core/object/ObjectList.h" 33 #include "core/CoreIncludes.h" 32 34 33 35 namespace orxonox … … 81 83 { 82 84 this->forgetTarget(); 83 turret->setTarget( 0);85 turret->setTarget(nullptr); 84 86 } 85 87 … … 99 101 float minScore = FLT_MAX; 100 102 float tempScore; 101 Pawn* minScorePawn = 0; 102 103 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 104 { 105 Pawn* entity = orxonox_cast<Pawn*>(*it); 106 if (!entity || FormationController::sameTeam(turret, entity, this->getGametype())) 103 Pawn* minScorePawn = nullptr; 104 105 for (Pawn* pawn : ObjectList<Pawn>()) 106 { 107 if (!pawn || FormationController::sameTeam(turret, pawn, this->getGametype())) 107 108 continue; 108 tempScore = turret->isInRange( entity);109 tempScore = turret->isInRange(pawn); 109 110 if(tempScore != -1.f) 110 111 { … … 112 113 { 113 114 minScore = tempScore; 114 minScorePawn = entity;115 minScorePawn = pawn; 115 116 } 116 117 } -
code/trunk/src/modules/objects/eventsystem/EventDispatcher.cc
r9667 r11071 45 45 { 46 46 if (this->isInitialized()) 47 for ( std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)48 (*it)->destroy();47 for (BaseObject* target : this->targets_) 48 target->destroy(); 49 49 } 50 50 … … 61 61 void EventDispatcher::processEvent(Event& event) 62 62 { 63 for ( std::list<BaseObject*>::iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)64 (*it)->processEvent(event);63 for (BaseObject* target : this->targets_) 64 target->processEvent(event); 65 65 } 66 66 … … 73 73 { 74 74 unsigned int i = 0; 75 for ( std::list<BaseObject*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); ++it)75 for (BaseObject* target : this->targets_) 76 76 { 77 77 if (i == index) 78 return (*it);78 return target; 79 79 ++i; 80 80 } 81 return 0;81 return nullptr; 82 82 } 83 83 } -
code/trunk/src/modules/objects/eventsystem/EventFilter.cc
r9667 r11071 70 70 { 71 71 bool success = false; 72 for ( std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)72 for (EventName* name : this->names_) 73 73 { 74 if ( (*it)->getName() == event.name_)74 if (name->getName() == event.name_) 75 75 { 76 76 success = true; … … 96 96 { 97 97 unsigned int i = 0; 98 for ( std::list<BaseObject*>::const_iterator it = this->sources_.begin(); it != this->sources_.end(); ++it)98 for (BaseObject* source : this->sources_) 99 99 { 100 100 if (i == index) 101 return (*it);101 return source; 102 102 ++i; 103 103 } 104 return 0;104 return nullptr; 105 105 } 106 106 … … 113 113 { 114 114 unsigned int i = 0; 115 for ( std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)115 for (EventName* name : this->names_) 116 116 { 117 117 if (i == index) 118 return (*it);118 return name; 119 119 ++i; 120 120 } 121 return 0;121 return nullptr; 122 122 } 123 123 } -
code/trunk/src/modules/objects/eventsystem/EventListener.cc
r9667 r11071 78 78 return; 79 79 80 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)81 if ( it->getName() == this->eventName_)82 this->addEventSource( *it, "");80 for (BaseObject* object : ObjectList<BaseObject>()) 81 if (object->getName() == this->eventName_) 82 this->addEventSource(object, ""); 83 83 } 84 84 -
code/trunk/src/modules/objects/eventsystem/EventTarget.cc
r9667 r11071 73 73 this->target_ = name; 74 74 75 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)76 if ( it->getName() == this->target_)77 this->addEventTarget( *it);75 for (BaseObject* object : ObjectList<BaseObject>()) 76 if (object->getName() == this->target_) 77 this->addEventTarget(object); 78 78 } 79 79 -
code/trunk/src/modules/objects/triggers/CheckPoint.cc
r10624 r11071 56 56 57 57 this->setRadarObjectColour(ColourValue::Green); 58 this->setRadarObjectShape(RadarViewable:: Dot);58 this->setRadarObjectShape(RadarViewable::Shape::Dot); 59 59 this->setRadarVisibility(false); 60 60 -
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.cc
r10624 r11071 58 58 59 59 this->distance_ = 100.0f; 60 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::off);60 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off); 61 61 this->targetName_ = ""; 62 62 this->beaconMask_.exclude(Class(BaseObject)); … … 97 97 { 98 98 99 std::queue<MultiTriggerState*>* queue = NULL;99 std::queue<MultiTriggerState*>* queue = nullptr; 100 100 101 101 // Check for objects that were in range but no longer are. Iterate through all objects, that are in range. 102 for(std::set<WeakPtr<WorldEntity> 102 for(std::set<WeakPtr<WorldEntity>>::iterator it = this->range_.begin(); it != this->range_.end(); ) 103 103 { 104 104 WorldEntity* entity = *it; 105 105 106 106 // If the entity no longer exists. 107 if(entity == NULL)107 if(entity == nullptr) 108 108 { 109 109 this->range_.erase(it++); … … 118 118 119 119 // If no queue has been created, yet. 120 if(queue == NULL)120 if(queue == nullptr) 121 121 queue = new std::queue<MultiTriggerState*>(); 122 122 … … 136 136 ClassTreeMask targetMask = this->getTargetMask(); 137 137 // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons. 138 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)138 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 139 139 targetMask = this->beaconMask_; 140 140 … … 145 145 146 146 // If the DistanceMultiTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it. 147 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)147 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 148 148 { 149 149 if(entity->getName() != this->targetName_) … … 155 155 156 156 // If the DistanceMultiTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it. 157 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::exclude)157 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::exclude) 158 158 { 159 159 160 const std::set<WorldEntity*> attached = entity->getAttachedObjects();160 const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects(); 161 161 bool found = false; 162 for( std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)162 for(WorldEntity* attachedObject : attachedObjects) 163 163 { 164 if( (*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)164 if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_) 165 165 { 166 166 found = true; … … 182 182 183 183 // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached. 184 if(this->beaconMode_ == distanceMultiTriggerBeaconMode::identify)184 if(this->beaconMode_ == DistanceMultiTriggerBeaconMode::identify) 185 185 entity = entity->getParent(); 186 186 187 187 // If no queue has been created, yet. 188 if(queue == NULL)188 if(queue == nullptr) 189 189 queue = new std::queue<MultiTriggerState*>(); 190 190 … … 206 206 The mode as an enum. 207 207 */ 208 void DistanceMultiTrigger::setBeaconModeDirect( distanceMultiTriggerBeaconMode::Value mode)208 void DistanceMultiTrigger::setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode) 209 209 { 210 210 this->beaconMode_ = mode; … … 221 221 switch(this->getBeaconModeDirect()) 222 222 { 223 case distanceMultiTriggerBeaconMode::off :223 case DistanceMultiTriggerBeaconMode::off : 224 224 return DistanceMultiTrigger::beaconModeOff_s; 225 case distanceMultiTriggerBeaconMode::identify:225 case DistanceMultiTriggerBeaconMode::identify: 226 226 return DistanceMultiTrigger::beaconModeIdentify_s; 227 case distanceMultiTriggerBeaconMode::exclude:227 case DistanceMultiTriggerBeaconMode::exclude: 228 228 return DistanceMultiTrigger::beaconModeExlcude_s; 229 229 default : … … 242 242 { 243 243 if(mode == DistanceMultiTrigger::beaconModeOff_s) 244 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::off);244 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::off); 245 245 else if(mode == DistanceMultiTrigger::beaconModeIdentify_s) 246 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::identify);246 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::identify); 247 247 else if(mode == DistanceMultiTrigger::beaconModeExlcude_s) 248 this->setBeaconModeDirect( distanceMultiTriggerBeaconMode::exclude);248 this->setBeaconModeDirect(DistanceMultiTriggerBeaconMode::exclude); 249 249 else 250 250 orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceMultiTrigger." << endl; … … 261 261 bool DistanceMultiTrigger::addToRange(WorldEntity* entity) 262 262 { 263 std::pair<std::set<WeakPtr<WorldEntity> 263 std::pair<std::set<WeakPtr<WorldEntity>>::iterator, bool> pair = this->range_.insert(entity); 264 264 return pair.second; 265 265 } -
code/trunk/src/modules/objects/triggers/DistanceMultiTrigger.h
r10624 r11071 55 55 @ingroup MultiTrigger 56 56 */ 57 namespace distanceMultiTriggerBeaconMode 58 { 59 enum Value { 60 off, //!< The DistanceMultiTrigger is not in <em>beacon-mode</em>. 61 identify, //!< The DistanceTrigger is in <em>identify-mode</em>. 62 exclude //!< The DistanceTrigger is in <em>exclude-mode</em>. 63 }; 64 } 57 enum class DistanceMultiTriggerBeaconMode { 58 off, //!< The DistanceMultiTrigger is not in <em>beacon-mode</em>. 59 identify, //!< The DistanceTrigger is in <em>identify-mode</em>. 60 exclude //!< The DistanceTrigger is in <em>exclude-mode</em>. 61 }; 65 62 66 63 /** … … 113 110 { return this->distance_; } 114 111 115 void setBeaconModeDirect( distanceMultiTriggerBeaconMode::Value mode); // Set the beacon mode.112 void setBeaconModeDirect(DistanceMultiTriggerBeaconMode mode); // Set the beacon mode. 116 113 /** 117 114 @brief Get the beacon mode. 118 115 @return Returns the mode as an enum. 119 116 */ 120 inline distanceMultiTriggerBeaconMode::Value getBeaconModeDirect(void) const117 inline DistanceMultiTriggerBeaconMode getBeaconModeDirect(void) const 121 118 { return this->beaconMode_; } 122 119 void setBeaconMode(const std::string& mode); // Set the beacon mode. … … 149 146 float distance_; //!< The distance at which the DistanceMultiTrigger triggers. 150 147 151 distanceMultiTriggerBeaconMode::Value beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in.148 DistanceMultiTriggerBeaconMode beaconMode_; //!< The beacon mode, the DistanceMultiTrigger is in. 152 149 std::string targetName_; //!< The target name, used in <em>single-target</em> mode. 153 150 ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons. 154 151 155 std::set<WeakPtr<WorldEntity> 152 std::set<WeakPtr<WorldEntity>> range_; //!< The set of entities that currently are in range of the DistanceMultiTrigger. 156 153 157 154 }; -
code/trunk/src/modules/objects/triggers/DistanceTrigger.cc
r10624 r11071 106 106 this->setForPlayer(true); 107 107 108 if (targetId == NULL)108 if (targetId == nullptr) 109 109 { 110 110 orxout(internal_error, context::triggers) << "\"" << targetStr << "\" is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ')' << endl; … … 147 147 { 148 148 // Check whether there is a cached object, it still exists and whether it is still in range, if so nothing further needs to be done. 149 if(this->cache_ != NULL)149 if(this->cache_ != nullptr) 150 150 { 151 151 if((this->cache_->getWorldPosition() - this->getWorldPosition()).length() < this->distance_) … … 158 158 ClassTreeMask targetMask = this->targetMask_; 159 159 // If we are in identify-mode another target mask has to be applies to find the DistanceTriggerBeacons. 160 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)160 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 161 161 targetMask = this->beaconMask_; 162 162 … … 167 167 168 168 // If the DistanceTrigger is in identify-mode and the DistanceTriggerBeacon attached to the object has the wrong name we ignore it. 169 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)169 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 170 170 { 171 171 if(entity->getName() != this->targetName_) … … 177 177 178 178 // If the DistanceTrigger is in exclude mode and the DistanceTriggerBeacon attached to the object has the right name, we ignore it. 179 if(this->beaconMode_ == distanceTriggerBeaconMode::exclude)179 if(this->beaconMode_ == DistanceTriggerBeaconMode::exclude) 180 180 { 181 181 182 const std::set<WorldEntity*> attached = entity->getAttachedObjects();182 const std::set<WorldEntity*> attachedObjects = entity->getAttachedObjects(); 183 183 bool found = false; 184 for( std::set<WorldEntity*>::const_iterator it = attached.begin(); it != attached.end(); it++)184 for(WorldEntity* attachedObject : attachedObjects) 185 185 { 186 if( (*it)->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(*it)->getName() == this->targetName_)186 if(attachedObject->isA(ClassIdentifier<DistanceTriggerBeacon>::getIdentifier()) && static_cast<DistanceTriggerBeacon*>(attachedObject)->getName() == this->targetName_) 187 187 { 188 188 found = true; … … 202 202 { 203 203 // Change the entity to the parent of the DistanceTriggerBeacon (if in identify-mode), which is the entity to which the beacon is attached. 204 if(this->beaconMode_ == distanceTriggerBeaconMode::identify)204 if(this->beaconMode_ == DistanceTriggerBeaconMode::identify) 205 205 entity = entity->getParent(); 206 206 207 207 Pawn* pawn = orxonox_cast<Pawn*>(entity); 208 if(pawn != NULL)208 if(pawn != nullptr) 209 209 this->setTriggeringPawn(pawn); 210 210 else 211 orxout(internal_warning, context::triggers) << "Pawn was NULL." << endl;211 orxout(internal_warning, context::triggers) << "Pawn was nullptr." << endl; 212 212 } 213 213 … … 228 228 The mode as an enum. 229 229 */ 230 void DistanceTrigger::setBeaconModeDirect( distanceTriggerBeaconMode::Value mode)230 void DistanceTrigger::setBeaconModeDirect(DistanceTriggerBeaconMode mode) 231 231 { 232 232 this->beaconMode_ = mode; … … 243 243 switch(this->getBeaconModeDirect()) 244 244 { 245 case distanceTriggerBeaconMode::off :245 case DistanceTriggerBeaconMode::off : 246 246 return DistanceTrigger::beaconModeOff_s; 247 case distanceTriggerBeaconMode::identify:247 case DistanceTriggerBeaconMode::identify: 248 248 return DistanceTrigger::beaconModeIdentify_s; 249 case distanceTriggerBeaconMode::exclude:249 case DistanceTriggerBeaconMode::exclude: 250 250 return DistanceTrigger::beaconModeExlcude_s; 251 251 default : … … 264 264 { 265 265 if(mode == DistanceTrigger::beaconModeOff_s) 266 this->setBeaconModeDirect( distanceTriggerBeaconMode::off);266 this->setBeaconModeDirect(DistanceTriggerBeaconMode::off); 267 267 else if(mode == DistanceTrigger::beaconModeIdentify_s) 268 this->setBeaconModeDirect( distanceTriggerBeaconMode::identify);268 this->setBeaconModeDirect(DistanceTriggerBeaconMode::identify); 269 269 else if(mode == DistanceTrigger::beaconModeExlcude_s) 270 this->setBeaconModeDirect( distanceTriggerBeaconMode::exclude);270 this->setBeaconModeDirect(DistanceTriggerBeaconMode::exclude); 271 271 else 272 272 orxout(internal_error, context::triggers) << "Invalid beacon mode in DistanceTrigger." << endl; … … 282 282 Returns true if it is triggered ,false if not. 283 283 */ 284 bool DistanceTrigger::isTriggered(TriggerMode ::Valuemode)284 bool DistanceTrigger::isTriggered(TriggerMode mode) 285 285 { 286 286 if (Trigger::isTriggered(mode)) -
code/trunk/src/modules/objects/triggers/DistanceTrigger.h
r9667 r11071 55 55 @ingroup NormalTrigger 56 56 */ 57 namespace distanceTriggerBeaconMode 58 { 59 enum Value { 60 off, 61 identify, 62 exclude 63 }; 64 } 57 enum class DistanceTriggerBeaconMode { 58 off, 59 identify, 60 exclude 61 }; 65 62 66 63 /** … … 118 115 { return this->distance_; } 119 116 120 void setBeaconModeDirect( distanceTriggerBeaconMode::Value mode); // Set the beacon mode.117 void setBeaconModeDirect(DistanceTriggerBeaconMode mode); // Set the beacon mode. 121 118 /** 122 119 @brief Get the beacon mode. 123 120 @return Returns the mode as an enum. 124 121 */ 125 inline distanceTriggerBeaconMode::Value getBeaconModeDirect(void) const122 inline DistanceTriggerBeaconMode getBeaconModeDirect(void) const 126 123 { return this->beaconMode_; } 127 124 void setBeaconMode(const std::string& mode); // Set the beacon mode. … … 144 141 145 142 protected: 146 virtual bool isTriggered(TriggerMode ::Value mode); // Check whether the DistanceTrigger is triggered.143 virtual bool isTriggered(TriggerMode mode) override; // Check whether the DistanceTrigger is triggered. 147 144 /** 148 145 @brief Notifies interested parties about a change of the DistanceTrigger's target mask. … … 160 157 float distance_; //!< The range of the DistanceTrigger. 161 158 162 distanceTriggerBeaconMode::Value beaconMode_; //!< The beacon mode.159 DistanceTriggerBeaconMode beaconMode_; //!< The beacon mode. 163 160 std::string targetName_; //!< The name a DistanceTriggerBeacon needs to have to make the DistanceTrigger react to it if in beacon-mode. 164 161 ClassTreeMask beaconMask_; //!< A mask, that only accepts DistanceTriggerBeacons. -
code/trunk/src/modules/objects/triggers/EventMultiTrigger.cc
r9667 r11071 96 96 { 97 97 // If the originator is a MultiTriggerContainer, the event originates from a MultiTrigger and thus the event only triggers the EventMultiTrigger for the originator that caused the MultiTrigger to trigger. 98 if(originator != NULL&& originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier()))98 if(originator != nullptr && originator->isA(ClassIdentifier<MultiTriggerContainer>::getIdentifier())) 99 99 { 100 100 MultiTriggerContainer* container = static_cast<MultiTriggerContainer*>(originator); -
code/trunk/src/modules/objects/triggers/EventTrigger.cc
r9667 r11071 79 79 It should be triggered if it is triggered according just to its sub-triggers and if the last event that came in was an event that changed from not triggered to triggered. 80 80 */ 81 bool EventTrigger::isTriggered(TriggerMode ::Valuemode)81 bool EventTrigger::isTriggered(TriggerMode mode) 82 82 { 83 83 if (Trigger::isTriggered(mode)) -
code/trunk/src/modules/objects/triggers/EventTrigger.h
r9667 r11071 84 84 85 85 protected: 86 virtual bool isTriggered(TriggerMode ::Value mode); // Check whether the EventTrigger should be triggered.86 virtual bool isTriggered(TriggerMode mode) override; // Check whether the EventTrigger should be triggered. 87 87 88 88 private: -
code/trunk/src/modules/objects/triggers/MultiTrigger.cc
r11020 r11071 124 124 // Let the MultiTrigger return the states that trigger and process the new states if there are any. 125 125 std::queue<MultiTriggerState*>* queue = this->letTrigger(); 126 if(queue != NULL)126 if(queue != nullptr) 127 127 { 128 128 while(queue->size() > 0) 129 129 { 130 130 MultiTriggerState* state = queue->front(); 131 // If the state is NULL. (This really shouldn't happen)132 if(state == NULL)131 // If the state is nullptr. (This really shouldn't happen) 132 if(state == nullptr) 133 133 { 134 orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was NULL. State ignored." << endl;134 orxout(internal_error, context::triggers) << "In MultiTrigger '" << this->getName() << "' (&" << this << "), Error: State of new states queue was nullptr. State ignored." << endl; 135 135 queue->pop(); 136 136 continue; … … 227 227 { 228 228 // If the MultiTrigger is set to broadcast and has no originator a boradcast is fired. 229 if(this->getBroadcast() && state->originator == NULL)229 if(this->getBroadcast() && state->originator == nullptr) 230 230 this->broadcast(bActive); 231 231 // Else a normal event is fired. … … 240 240 { 241 241 // Print some debug output if the state has changed. 242 if(state->originator != NULL)242 if(state->originator != nullptr) 243 243 orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: " << state->originator->getIdentifier()->getName() << " (&" << state->originator << "), active: " << bActive << ", triggered: " << state->bTriggered << "." << endl; 244 244 else 245 orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: NULL, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl;245 orxout(verbose, context::triggers) << "MultiTrigger '" << this->getName() << "' (&" << this << ") changed state. originator: nullptr, active: " << bActive << ", triggered: " << state->bTriggered << "." << endl; 246 246 247 247 // If the MultiTrigger has a parent trigger, that is itself a MultiTrigger, it needs to call a method to notify him, that its activity has changed. 248 if(this->parent_ != NULL&& this->parent_->isMultiTrigger())248 if(this->parent_ != nullptr && this->parent_->isMultiTrigger()) 249 249 static_cast<MultiTrigger*>(this->parent_)->childActivityChanged(state->originator); 250 250 } … … 265 265 else 266 266 { 267 this->stateQueue_. push_back(std::pair<float, MultiTriggerState*>(timeRemaining-dt, state));267 this->stateQueue_.emplace_back(timeRemaining-dt, state); 268 268 this->stateQueue_.pop_front(); 269 269 } … … 299 299 300 300 // If the target is not a valid class name display an error. 301 if (target == NULL)301 if (target == nullptr) 302 302 { 303 303 orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl; … … 327 327 328 328 // If the target is not a valid class name display an error. 329 if (target == NULL)329 if (target == nullptr) 330 330 { 331 331 orxout(internal_error, context::triggers) << "'" << targetStr << "' is not a valid class name to include in ClassTreeMask (in " << this->getName() << ", class " << this->getIdentifier()->getName() << ")" << endl; … … 346 346 std::queue<MultiTriggerState*>* MultiTrigger::letTrigger(void) 347 347 { 348 return NULL;348 return nullptr; 349 349 } 350 350 … … 443 443 void MultiTrigger::fire(bool status, BaseObject* originator) 444 444 { 445 // If the originator is NULL, a normal event without MultiTriggerContainer is sent.446 if(originator == NULL)445 // If the originator is nullptr, a normal event without MultiTriggerContainer is sent. 446 if(originator == nullptr) 447 447 { 448 448 this->fireEvent(status); … … 479 479 bool MultiTrigger::addState(MultiTriggerState* state) 480 480 { 481 assert(state); // The state really shouldn't be NULL.481 assert(state); // The state really shouldn't be nullptr. 482 482 483 483 // If the originator is no target of this MultiTrigger. … … 489 489 490 490 // Add it ot the state queue with the delay specified for the MultiTrigger. 491 this->stateQueue_. push_back(std::pair<float, MultiTriggerState*>(this->getDelay(), state));491 this->stateQueue_.emplace_back(this->getDelay(), state); 492 492 493 493 return true; … … 504 504 bool MultiTrigger::checkAnd(BaseObject* triggerer) 505 505 { 506 for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it) 507 { 508 TriggerBase* trigger = *it; 506 for(TriggerBase* trigger : this->children_) 507 { 509 508 if(trigger->isMultiTrigger()) 510 509 { … … 531 530 bool MultiTrigger::checkOr(BaseObject* triggerer) 532 531 { 533 for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it) 534 { 535 TriggerBase* trigger = *it; 532 for(TriggerBase* trigger : this->children_) 533 { 536 534 if(trigger->isMultiTrigger()) 537 535 { … … 559 557 { 560 558 bool triggered = false; 561 for(std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it) 562 { 563 TriggerBase* trigger = *it; 559 for(TriggerBase* trigger : this->children_) 560 { 564 561 if(triggered) 565 562 { -
code/trunk/src/modules/objects/triggers/MultiTrigger.h
r9667 r11071 76 76 - @b simultaneousTriggerers The number of simultaneous triggerers limits the number of objects that are allowed to trigger the MultiTrigger at the same time. Or more precisely, the number of distinct objects the MultiTrigger has <em>triggered</em> states for, at each point in time. The default is <code>-1</code>, which denotes infinity. 77 77 - @b mode The mode describes how the MultiTrigger acts in relation to all the triggers, that are appended to it. There are 3 modes: <em>and</em>, meaning that the MultiTrigger can only be triggered if all the appended triggers are active. <em>or</em>, meaning that the MultiTrigger can only triggered if at least one of the appended triggers is active. And <em>xor</em>, meaning that the MultiTrigger can only be triggered if one and only one appended trigger is active. Note, that I wrote <em>can only be active</em>, that implies, that there is an additional condition to the <em>activity</em> of the MultiTrigger and that is the fulfillment of the triggering condition (the MultiTrigger itself doesn't have one, but all derived classes should). Also bear in mind, that the <em>activity</em> of a MultiTrigger is still coupled to the object that triggered it. The default is <em>and</em>. 78 - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is NULL) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false.78 - @b broadcast Broadcast is a boolean, if true the MutliTrigger is in <em>broadcast-mode</em>, meaning, that all trigger events that are caused by no originator (originator is nullptr) are broadcast as having come from every possible originator, or more precisely as having come from all objects that are specified targets of this MultiTrigger. The default is false. 79 79 - @b target The target describes the kind of objects that are allowed to trigger this MultiTrigger. The default is @ref orxonox::Pawn "Pawn". 80 80 - Also there is the possibility of appending triggers (as long as they inherit from TriggerBase) to the MultiTrigger just by adding them as children in the XML description of your MultiTrigger. … … 110 110 */ 111 111 inline bool isActive(void) const 112 { return this->isActive( NULL); }113 bool isActive(BaseObject* triggerer = NULL) const; //!< Check whether the MultiTrigger is active for a given object.112 { return this->isActive(nullptr); } 113 bool isActive(BaseObject* triggerer = nullptr) const; //!< Check whether the MultiTrigger is active for a given object. 114 114 115 115 /** … … 145 145 */ 146 146 inline bool isTarget(BaseObject* target) 147 { if(target == NULL) return true; else return targetMask_.isIncluded(target->getIdentifier()); }147 { if(target == nullptr) return true; else return targetMask_.isIncluded(target->getIdentifier()); } 148 148 149 149 void addTarget(const std::string& targets); //!< Add some target to the MultiTrigger. … … 152 152 virtual std::queue<MultiTriggerState*>* letTrigger(void); //!< This method is called by the MultiTrigger to get information about new trigger events that need to be looked at. 153 153 154 void changeTriggered(BaseObject* originator = NULL); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator.155 156 bool isModeTriggered(BaseObject* triggerer = NULL); //!< Checks whether the MultiTrigger is triggered concerning it's children.157 bool isTriggered(BaseObject* triggerer = NULL); //!< Get whether the MultiTrigger is triggered for a given object.158 159 virtual void fire(bool status, BaseObject* originator = NULL); //!< Helper method. Creates an Event for the given status and originator and fires it.154 void changeTriggered(BaseObject* originator = nullptr); //!< This method can be called by any class inheriting from MultiTrigger to change it's triggered status for a specified originator. 155 156 bool isModeTriggered(BaseObject* triggerer = nullptr); //!< Checks whether the MultiTrigger is triggered concerning it's children. 157 bool isTriggered(BaseObject* triggerer = nullptr); //!< Get whether the MultiTrigger is triggered for a given object. 158 159 virtual void fire(bool status, BaseObject* originator = nullptr); //!< Helper method. Creates an Event for the given status and originator and fires it. 160 160 void broadcast(bool status); //!< Helper method. Broadcasts an Event for every object that is a target. 161 161 … … 192 192 std::set<BaseObject*> triggered_; //!< The set of all objects the MultiTrigger is triggered for. 193 193 194 std::deque< std::pair<float, MultiTriggerState*>> stateQueue_; //!< The queue of states waiting to become active.194 std::deque<std::pair<float, MultiTriggerState*>> stateQueue_; //!< The queue of states waiting to become active. 195 195 196 196 ClassTreeMask targetMask_; //!< The target mask, masking all objects that can trigger this MultiTrigger. -
code/trunk/src/modules/objects/triggers/MultiTriggerContainer.cc
r9667 r11071 50 50 The creator. 51 51 */ 52 MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_( NULL), data_(NULL)52 MultiTriggerContainer::MultiTriggerContainer(Context* context) : BaseObject(context), originator_(nullptr), data_(nullptr) 53 53 { 54 54 RegisterObject(MultiTriggerContainer); … … 70 70 71 71 Pawn* pawn = orxonox_cast<Pawn*>(data); 72 if(pawn != NULL)72 if(pawn != nullptr) 73 73 { 74 74 this->setForPlayer(true); -
code/trunk/src/modules/objects/triggers/Trigger.cc
r10624 r11071 37 37 #include "core/CoreIncludes.h" 38 38 #include "core/GameMode.h" 39 #include "core/XMLPort.h"40 39 #include "core/command/ConsoleCommandIncludes.h" 41 40 … … 86 85 { 87 86 88 }89 90 /**91 @brief92 Method for creating a Trigger object through XML.93 */94 void Trigger::XMLPort(Element& xmlelement, XMLPort::Mode mode)95 {96 SUPER(Trigger, XMLPort, xmlelement, mode);97 87 } 98 88 … … 203 193 Returns true if the Trigger should be triggered and false if not. 204 194 */ 205 bool Trigger::isTriggered(TriggerMode ::Valuemode)195 bool Trigger::isTriggered(TriggerMode mode) 206 196 { 207 197 // If the trigger has sub-triggers. … … 234 224 { 235 225 // Iterate over all sub-triggers. 236 for ( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)237 { 238 if (! (*it)->isActive())226 for (TriggerBase* child : this->children_) 227 { 228 if (!child->isActive()) 239 229 return false; 240 230 } … … 252 242 { 253 243 // Iterate over all sub-triggers. 254 for ( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)255 { 256 if ( (*it)->isActive())244 for (TriggerBase* child : this->children_) 245 { 246 if (child->isActive()) 257 247 return true; 258 248 } … … 270 260 { 271 261 bool test = false; 272 for ( std::set<TriggerBase*>::iterator it = this->children_.begin(); it != this->children_.end(); ++it)273 { 274 if (test && (*it)->isActive())262 for (TriggerBase* child : this->children_) 263 { 264 if (test && child->isActive()) 275 265 return false; 276 if ( (*it)->isActive())266 if (child->isActive()) 277 267 test = true; 278 268 } … … 346 336 { 347 337 // Iterate over all Triggers. 348 for ( ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)349 it->setVisible(bVisible);338 for (Trigger* trigger : ObjectList<Trigger>()) 339 trigger->setVisible(bVisible); 350 340 } 351 341 -
code/trunk/src/modules/objects/triggers/Trigger.h
r9667 r11071 83 83 virtual ~Trigger(); 84 84 85 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); // Method for creating a Trigger object through XML.86 85 virtual void tick(float dt); 87 86 … … 105 104 inline bool isTriggered() 106 105 { return this->isTriggered(this->mode_); } 107 virtual bool isTriggered(TriggerMode ::Valuemode); // Check whether the Trigger should be triggered, given only its sub-triggers, given a specific mode.106 virtual bool isTriggered(TriggerMode mode); // Check whether the Trigger should be triggered, given only its sub-triggers, given a specific mode. 108 107 virtual void triggered(bool bIsTriggered); // Fires an event with the input triggered state. 109 108 … … 127 126 BillboardSet debugBillboard_; //!< A set of debug billboards to visualize the state of the trigger. 128 127 129 std::queue<std::pair<float, char> 128 std::queue<std::pair<float, char>> stateChanges_; //!< A queue of state changes (in the same format as latestState_) paired with the time they will take effect since the last state change took effect. 130 129 }; 131 130 -
code/trunk/src/modules/objects/triggers/TriggerBase.cc
r9667 r11071 67 67 this->mode_ = TriggerMode::EventTriggerAND; 68 68 69 this->parent_ = NULL;69 this->parent_ = nullptr; 70 70 71 71 this->bMultiTrigger_ = false; … … 100 100 101 101 XMLPortObject(TriggerBase, TriggerBase, "", addTrigger, getTrigger, xmlelement, mode); 102 }103 104 /**105 @brief106 A method that is executed each tick.107 @param dt108 The duration of the last tick.109 */110 void TriggerBase::tick(float dt)111 {112 SUPER(TriggerBase, tick, dt);113 102 } 114 103 … … 170 159 The index. 171 160 @return 172 Returns a pointer ot the trigger. NULLif no such trigger exists.161 Returns a pointer ot the trigger. nullptr if no such trigger exists. 173 162 */ 174 163 const TriggerBase* TriggerBase::getTrigger(unsigned int index) const … … 176 165 // If the index is greater than the number of children. 177 166 if (this->children_.size() <= index) 178 return NULL;167 return nullptr; 179 168 180 169 std::set<TriggerBase*>::const_iterator it; -
code/trunk/src/modules/objects/triggers/TriggerBase.h
r9667 r11071 52 52 @ingroup Triggers 53 53 */ 54 namespaceTriggerMode54 enum class TriggerMode 55 55 { 56 enum Value 57 { 58 EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 59 EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active. 60 EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 61 }; 62 } 56 EventTriggerAND, //!< The <em>and</em> mode. The trigger can only trigger if all the children are active. 57 EventTriggerOR, //!< The <em>or</em> mode. The trigger can only trigger if at least one child is active. 58 EventTriggerXOR, //!< The <em>xor</em> mode. The trigger can only trigger if exactly one child is active. 59 }; 63 60 64 61 /** … … 78 75 79 76 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a TriggerBase object through XML. 80 virtual void tick(float dt); //!< A method that is executed each tick.81 77 82 78 /** … … 158 154 @param mode The mode of the trigger. 159 155 */ 160 inline void setMode(TriggerMode ::Valuemode) //!< Get the mode of the trigger.156 inline void setMode(TriggerMode mode) //!< Get the mode of the trigger. 161 157 { this->mode_ = mode; } 162 158 const std::string& getModeString(void) const; … … 165 161 @return Returns and Enum for the mode of the trigger. 166 162 */ 167 inline TriggerMode ::ValuegetMode(void) const163 inline TriggerMode getMode(void) const 168 164 { return mode_; } 169 165 … … 211 207 212 208 bool bInvertMode_; //!< Bool for the invert-mode, if true the trigger is inverted. 213 TriggerMode ::Valuemode_; //!< The mode of the trigger.209 TriggerMode mode_; //!< The mode of the trigger. 214 210 215 211 TriggerBase* parent_; //!< The parent of this trigger. -
code/trunk/src/modules/overlays/FadeoutText.h
r9667 r11071 44 44 virtual ~FadeoutText() {} 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void tick(float dt) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 virtual void tick(float dt) override; 48 48 49 49 inline void setDelay(float delay) … … 58 58 59 59 private: 60 virtual void changedColour() ;61 virtual void changedCaption() ;60 virtual void changedColour() override; 61 virtual void changedCaption() override; 62 62 63 63 void fadeout(); -
code/trunk/src/modules/overlays/GUIOverlay.cc
r9667 r11071 92 92 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(this->getOwner()); 93 93 if (entity) 94 GUIManager::getInstance().setPlayer(name, entity->getPlayer()); //Set Player is going to be NULL, so it needs to be set in changedVisibility() as well.94 GUIManager::getInstance().setPlayer(name, entity->getPlayer()); //Set Player is going to be nullptr, so it needs to be set in changedVisibility() as well. 95 95 } 96 96 } -
code/trunk/src/modules/overlays/GUIOverlay.h
r9667 r11071 44 44 virtual ~GUIOverlay(); 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 void setGUIName(const std::string& name); 49 49 inline const std::string& getGUIName() const { return this->guiName_; } 50 50 51 virtual void changedVisibility() ;52 virtual void changedOwner() ;51 virtual void changedVisibility() override; 52 virtual void changedOwner() override; 53 53 54 54 private: -
code/trunk/src/modules/overlays/OverlayText.cc
r9667 r11071 32 32 #include <OgrePanelOverlayElement.h> 33 33 #include <OgreTextAreaOverlayElement.h> 34 #include <boost/static_assert.hpp>35 34 36 35 #include "util/StringUtils.h" … … 43 42 RegisterClass(OverlayText); 44 43 45 BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Left);46 BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Center);47 BOOST_STATIC_ASSERT((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Right);44 static_assert((int)Ogre::TextAreaOverlayElement::Left == (int)OverlayText::Alignment::Left, "check enum"); 45 static_assert((int)Ogre::TextAreaOverlayElement::Center == (int)OverlayText::Alignment::Center, "check enum"); 46 static_assert((int)Ogre::TextAreaOverlayElement::Right == (int)OverlayText::Alignment::Right, "check enum"); 48 47 49 48 OverlayText::OverlayText(Context* context) … … 86 85 { 87 86 if (alignment == "right") 88 this->setAlignment(OverlayText:: Right);87 this->setAlignment(OverlayText::Alignment::Right); 89 88 else if (alignment == "center") 90 this->setAlignment(OverlayText:: Center);89 this->setAlignment(OverlayText::Alignment::Center); 91 90 else // "left" and default 92 this->setAlignment(OverlayText:: Left);91 this->setAlignment(OverlayText::Alignment::Left); 93 92 } 94 93 … … 112 111 void OverlayText::sizeChanged() 113 112 { 114 if (this->rotState_ == Horizontal)113 if (this->rotState_ == RotationState::Horizontal) 115 114 this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y); 116 else if (this->rotState_ == Vertical)115 else if (this->rotState_ == RotationState::Vertical) 117 116 this->overlay_->setScale(size_.y / (sizeCorrection_.y * sizeCorrection_.y), size_.y * sizeCorrection_.y); 118 117 else -
code/trunk/src/modules/overlays/OverlayText.h
r9667 r11071 42 42 { 43 43 public: 44 enum Alignment44 enum class Alignment 45 45 { 46 46 Left, … … 52 52 virtual ~OverlayText(); 53 53 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 55 56 56 void setCaption(const std::string& caption); … … 76 76 77 77 protected: 78 virtual void sizeChanged() ;78 virtual void sizeChanged() override; 79 79 virtual void changedColour() {} 80 80 virtual void changedCaption() {} -
code/trunk/src/modules/overlays/debugging/DebugFPSText.h
r9667 r11071 43 43 virtual ~DebugFPSText(); 44 44 45 virtual void tick(float dt) ;45 virtual void tick(float dt) override; 46 46 }; 47 47 } -
code/trunk/src/modules/overlays/debugging/DebugPositionText.cc
r9943 r11071 52 52 SUPER(DebugPositionText, tick, dt); 53 53 54 ObjectList<NewHumanController>::iterator it = ObjectList<NewHumanController> ::begin();54 ObjectList<NewHumanController>::iterator it = ObjectList<NewHumanController>().begin(); 55 55 if (it && it->getControllableEntity() ) 56 56 { -
code/trunk/src/modules/overlays/debugging/DebugPositionText.h
r9943 r11071 43 43 virtual ~DebugPositionText(); 44 44 45 virtual void tick(float dt) ;45 virtual void tick(float dt) override; 46 46 }; 47 47 } -
code/trunk/src/modules/overlays/debugging/DebugRTRText.h
r9667 r11071 43 43 virtual ~DebugRTRText(); 44 44 45 virtual void tick(float dt) ;45 virtual void tick(float dt) override; 46 46 }; 47 47 } -
code/trunk/src/modules/overlays/hud/AnnounceMessage.cc
r9667 r11071 40 40 RegisterObject(AnnounceMessage); 41 41 42 this->owner_ = 0;42 this->owner_ = nullptr; 43 43 44 44 this->setDelay(3.0f); -
code/trunk/src/modules/overlays/hud/AnnounceMessage.h
r9667 r11071 43 43 virtual ~AnnounceMessage() {} 44 44 45 virtual void changedOwner() ;45 virtual void changedOwner() override; 46 46 47 v oid announcemessage(const GametypeInfo* gtinfo, const std::string& message);47 virtual void announcemessage(const GametypeInfo* gtinfo, const std::string& message) override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/ChatOverlay.cc
r9667 r11071 58 58 ChatOverlay::~ChatOverlay() 59 59 { 60 for ( std::set<Timer*>::iterator it = this->timers_.begin(); it != this->timers_.end(); ++it)61 delete (*it);60 for (Timer* timer : this->timers_) 61 delete timer; 62 62 } 63 63 … … 92 92 this->text_->setCaption(""); 93 93 94 for ( std::list<Ogre::DisplayString>::iterator it = this->messages_.begin(); it != this->messages_.end(); ++it)94 for (const Ogre::DisplayString& message : this->messages_) 95 95 { 96 this->text_->setCaption(this->text_->getCaption() + "\n" + (*it));96 this->text_->setCaption(this->text_->getCaption() + "\n" + message); 97 97 } 98 98 } -
code/trunk/src/modules/overlays/hud/ChatOverlay.h
r9667 r11071 49 49 50 50 protected: 51 virtual void incomingChat(const std::string& message, const std::string& name) ;51 virtual void incomingChat(const std::string& message, const std::string& name) override; 52 52 53 53 std::list<Ogre::DisplayString> messages_; -
code/trunk/src/modules/overlays/hud/CountDown.cc
r9943 r11071 71 71 RegisterObject(CountDown); 72 72 73 this->owner_ = 0;73 this->owner_ = nullptr; 74 74 this->hasStopped_ = false; 75 75 } -
code/trunk/src/modules/overlays/hud/CountDown.h
r9943 r11071 44 44 virtual ~CountDown(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void changedOwner() ;48 virtual void tick(float dt) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 virtual void changedOwner() override; 48 virtual void tick(float dt) override; 49 49 50 50 inline void setCounter(float value) -
code/trunk/src/modules/overlays/hud/DeathMessage.cc
r9667 r11071 40 40 RegisterObject(DeathMessage); 41 41 42 this->owner_ = 0;42 this->owner_ = nullptr; 43 43 44 44 this->setDelay(2.0f); -
code/trunk/src/modules/overlays/hud/DeathMessage.h
r9667 r11071 43 43 virtual ~DeathMessage() {} 44 44 45 virtual void changedOwner() ;45 virtual void changedOwner() override; 46 46 47 v oid deathmessage(const GametypeInfo* gtinfo, const std::string& message);47 virtual void deathmessage(const GametypeInfo* gtinfo, const std::string& message) override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/GametypeFadingMessage.cc
r9667 r11071 40 40 RegisterObject(GametypeFadingMessage); 41 41 42 this->owner_ = 0;42 this->owner_ = nullptr; 43 43 this->setDelay(2.0f); 44 44 this->setFadeouttime(0.5f); -
code/trunk/src/modules/overlays/hud/GametypeFadingMessage.h
r9667 r11071 43 43 virtual ~GametypeFadingMessage(); 44 44 45 virtual void changedOwner() ;45 virtual void changedOwner() override; 46 46 47 v oid fadingmessage(const GametypeInfo* gtinfo, const std::string& message);47 virtual void fadingmessage(const GametypeInfo* gtinfo, const std::string& message) override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/GametypeStaticMessage.cc
r9667 r11071 42 42 { 43 43 RegisterObject(GametypeStaticMessage); 44 this->owner_ = 0;44 this->owner_ = nullptr; 45 45 } 46 46 -
code/trunk/src/modules/overlays/hud/GametypeStaticMessage.h
r9667 r11071 46 46 virtual ~GametypeStaticMessage(); 47 47 48 virtual void changedOwner() ;48 virtual void changedOwner() override; 49 49 50 v oid staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour);50 virtual void staticmessage(const GametypeInfo* gtinfo, const std::string& message, const ColourValue& colour) override; 51 51 52 52 private: -
code/trunk/src/modules/overlays/hud/HUDBar.cc
r11052 r11071 219 219 return barColours_[index]; 220 220 else 221 return 0;221 return nullptr; 222 222 } 223 223 -
code/trunk/src/modules/overlays/hud/HUDBar.h
r11052 r11071 52 52 virtual ~BarColour() { } 53 53 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 55 56 56 void setColour(const ColourValue& colour) { this->colour_ = colour; } … … 72 72 virtual ~HUDBar(); 73 73 74 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;74 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 75 75 76 76 void clearColours(); -
code/trunk/src/modules/overlays/hud/HUDBoostBar.cc
r11052 r11071 42 42 RegisterObject(HUDBoostBar); 43 43 44 this->owner_ = 0;44 this->owner_ = nullptr; 45 45 this->flashInterval_ = 0.25f; 46 46 this->flashDt_ = 0.0f; -
code/trunk/src/modules/overlays/hud/HUDBoostBar.h
r9667 r11071 43 43 virtual ~HUDBoostBar(); 44 44 45 virtual void tick(float dt) ;46 virtual void changedOwner() ;45 virtual void tick(float dt) override; 46 virtual void changedOwner() override; 47 47 48 48 private: -
code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.cc
r9667 r11071 30 30 31 31 #include "core/config/ConfigValueIncludes.h" 32 #include "core/CoreIncludes.h" 32 33 #include "worldentities/pawns/Pawn.h" 33 34 … … 41 42 42 43 this->setConfigValues(); 43 this->owner_ = 0;44 this->owner_ = nullptr; 44 45 } 45 46 … … 62 63 void HUDEnemyHealthBar::updateTarget() 63 64 { 64 Pawn* pawn = NULL;65 Pawn* pawn = nullptr; 65 66 if (this->owner_ && this->useEnemyBar_) 66 67 { … … 73 74 // Don't show the HealthBar if the pawn is invisible 74 75 if (pawn && !pawn->isVisible()) 75 pawn = NULL;76 pawn = nullptr; 76 77 } 77 78 // Set the pawn as owner of the HealthBar 78 79 this->setHealthBarOwner(pawn); 79 this->setVisible(pawn != NULL);80 this->setVisible(pawn != nullptr); 80 81 } 81 82 -
code/trunk/src/modules/overlays/hud/HUDEnemyHealthBar.h
r9667 r11071 41 41 42 42 void setConfigValues(); 43 virtual void tick(float dt) ;43 virtual void tick(float dt) override; 44 44 45 v oid changedOwner();45 virtual void changedOwner() override; 46 46 47 47 private: -
code/trunk/src/modules/overlays/hud/HUDEnemyShieldBar.cc
r11052 r11071 41 41 42 42 this->setConfigValues(); 43 this->owner_ = NULL;43 this->owner_ = nullptr; 44 44 } 45 45 … … 62 62 void HUDEnemyShieldBar::updateTarget() 63 63 { 64 Pawn* pawn = NULL;64 Pawn* pawn = nullptr; 65 65 if (this->owner_ && this->useEnemyBar_) 66 66 { … … 73 73 // Don't show the EnemyShieldBar if the pawn is invisible 74 74 if (pawn && !pawn->isVisible()) 75 pawn = NULL;75 pawn = nullptr; 76 76 } 77 77 // Set the pawn as owner of the EnemyShieldBar 78 78 this->setShieldBarOwner(pawn); 79 this->setVisible(pawn != NULL);79 this->setVisible(pawn != nullptr); 80 80 } 81 81 -
code/trunk/src/modules/overlays/hud/HUDEnemyShieldBar.h
r11052 r11071 45 45 46 46 void setConfigValues(); 47 virtual void tick(float dt) ;47 virtual void tick(float dt) override; 48 48 49 v oid changedOwner();49 virtual void changedOwner() override; 50 50 51 51 private: -
code/trunk/src/modules/overlays/hud/HUDHealthBar.cc
r11052 r11071 43 43 RegisterObject(HUDHealthBar); 44 44 45 this->owner_ = 0;45 this->owner_ = nullptr; 46 46 this->bUseBarColour_ = false; 47 47 this->textOffset_ = Vector2(0.0f, 0.0f); … … 66 66 { 67 67 this->textoverlay_->destroy(); 68 this->textoverlay_ = NULL;68 this->textoverlay_ = nullptr; 69 69 } 70 70 } -
code/trunk/src/modules/overlays/hud/HUDHealthBar.h
r11052 r11071 45 45 virtual ~HUDHealthBar(); 46 46 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void tick(float dt) ;49 virtual void changedOwner() ;50 virtual void changedOverlayGroup() ;51 virtual void changedVisibility() ;52 virtual void changedName() ;47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 48 virtual void tick(float dt) override; 49 virtual void changedOwner() override; 50 virtual void changedOverlayGroup() override; 51 virtual void changedVisibility() override; 52 virtual void changedName() override; 53 53 54 54 inline void setTextFont(const std::string& font) … … 112 112 { this->owner_ = owner; } 113 113 protected: 114 virtual void positionChanged() ;115 virtual void sizeChanged() ;114 virtual void positionChanged() override; 115 virtual void sizeChanged() override; 116 116 private: 117 v irtual void positionText();117 void positionText(); 118 118 WeakPtr<Pawn> owner_; 119 119 StrongPtr<OverlayText> textoverlay_; -
code/trunk/src/modules/overlays/hud/HUDNavigation.cc
r11023 r11071 53 53 #include "core/config/ConfigValueIncludes.h" 54 54 #include "tools/TextureGenerator.h" 55 // #include <boost/bind/bind_template.hpp>56 55 57 56 … … 69 68 RegisterClass ( HUDNavigation ); 70 69 71 HUDNavigation* HUDNavigation::localHUD_s = 0;70 HUDNavigation* HUDNavigation::localHUD_s = nullptr; 72 71 73 72 HUDNavigation::HUDNavigation(Context* context) : … … 132 131 } 133 132 this->fontName_ = font; 134 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)135 { 136 if ( it->second.text_ != NULL)137 it->second.text_->setFontName(this->fontName_);133 for (const auto& mapEntry : this->activeObjectList_) 134 { 135 if (mapEntry.second.text_ != nullptr) 136 mapEntry.second.text_->setFontName(this->fontName_); 138 137 } 139 138 } … … 152 151 } 153 152 this->textSize_ = size; 154 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it!=this->activeObjectList_.end(); ++it)155 { 156 if ( it->second.text_)157 it->second.text_->setCharHeight(size);153 for (const auto& mapEntry : this->activeObjectList_) 154 { 155 if (mapEntry.second.text_) 156 mapEntry.second.text_->setCharHeight(size); 158 157 } 159 158 } … … 183 182 184 183 Camera* cam = CameraManager::getInstance().getActiveCamera(); 185 if (cam == NULL)184 if (cam == nullptr) 186 185 return; 187 186 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 188 187 189 for (std:: list<std::pair<RadarViewable*, unsigned int> >::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt)190 listIt->second = (int)((listIt->first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f);188 for (std::pair<RadarViewable*, unsigned int>& pair : this->sortedObjectList_) 189 pair.second = (int)((pair.first->getRVWorldPosition() - HumanController::getLocalControllerSingleton()->getControllableEntity()->getWorldPosition()).length() + 0.5f); 191 190 192 191 this->sortedObjectList_.sort(compareDistance); … … 209 208 bool nextHasToBeSelected = false; 210 209 211 for (std::list<std::pair<RadarViewable*, unsigned int> 210 for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++markerCount, ++listIt) 212 211 { 213 212 … … 469 468 if(!it->second.selected_ 470 469 || it->first->getRVVelocity().squaredLength() == 0 471 || pawn == NULL470 || pawn == nullptr 472 471 /* TODO : improve getTeam in such a way that it works 473 * || humanPawn == NULL472 * || humanPawn == nullptr 474 473 * || pawn->getTeam() == humanPawn->getTeam()*/) 475 474 { … … 525 524 float yScale = this->getActualSize().y; 526 525 527 for ( std::map<RadarViewable*, ObjectInfo>::iterator it = this->activeObjectList_.begin(); it != this->activeObjectList_.end(); ++it)528 { 529 if ( it->second.health_ != NULL)530 it->second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale);531 if ( it->second.healthLevel_ != NULL)532 it->second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale);533 if ( it->second.panel_ != NULL)534 it->second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale);535 if ( it->second.text_ != NULL)536 it->second.text_->setCharHeight(this->textSize_ * yScale);537 if ( it->second.target_ != NULL)538 it->second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale);526 for (const auto& mapEntry : this->activeObjectList_) 527 { 528 if (mapEntry.second.health_ != nullptr) 529 mapEntry.second.health_->setDimensions(this->healthMarkerSize_ * xScale, this->healthMarkerSize_ * yScale); 530 if (mapEntry.second.healthLevel_ != nullptr) 531 mapEntry.second.healthLevel_->setDimensions(this->healthLevelMarkerSize_ * xScale, this->healthLevelMarkerSize_ * yScale); 532 if (mapEntry.second.panel_ != nullptr) 533 mapEntry.second.panel_->setDimensions(this->navMarkerSize_ * xScale, this->navMarkerSize_ * yScale); 534 if (mapEntry.second.text_ != nullptr) 535 mapEntry.second.text_->setCharHeight(this->textSize_ * yScale); 536 if (mapEntry.second.target_ != nullptr) 537 mapEntry.second.target_->setDimensions(this->aimMarkerSize_ * xScale, this->aimMarkerSize_ * yScale); 539 538 } 540 539 } … … 546 545 547 546 if (this->activeObjectList_.size() >= this->markerLimit_) 548 if (object == NULL)547 if (object == nullptr) 549 548 return; 550 549 … … 634 633 } 635 634 636 for (std::list<std::pair<RadarViewable*, unsigned int> 635 for (std::list<std::pair<RadarViewable*, unsigned int>>::iterator listIt = this->sortedObjectList_.begin(); listIt != this->sortedObjectList_.end(); ++listIt) 637 636 { 638 637 if ((listIt->first) == viewable) … … 664 663 { 665 664 const std::set<RadarViewable*>& respawnObjects = this->getOwner()->getScene()->getRadar()->getRadarObjects(); 666 for ( std::set<RadarViewable*>::const_iterator it = respawnObjects.begin(); it != respawnObjects.end(); ++it)667 { 668 if (! (*it)->isHumanShip_)669 this->addObject( *it);665 for (RadarViewable* respawnObject : respawnObjects) 666 { 667 if (!respawnObject->isHumanShip_) 668 this->addObject(respawnObject); 670 669 } 671 670 } -
code/trunk/src/modules/overlays/hud/HUDNavigation.h
r10291 r11071 51 51 void setConfigValues(); 52 52 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void tick(float dt) ;53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 54 virtual void tick(float dt) override; 55 55 56 56 // RadarListener interface 57 virtual void addObject(RadarViewable* object) ;58 virtual void removeObject(RadarViewable* viewable) ;59 virtual void objectChanged(RadarViewable* viewable) ;57 virtual void addObject(RadarViewable* object) override; 58 virtual void removeObject(RadarViewable* viewable) override; 59 virtual void objectChanged(RadarViewable* viewable) override; 60 60 61 virtual void changedOwner() ;62 virtual void sizeChanged() ;63 virtual void angleChanged() { }64 virtual void positionChanged() { }65 virtual void radarTick(float dt) {}61 virtual void changedOwner() override; 62 virtual void sizeChanged() override; 63 virtual void angleChanged() override { } 64 virtual void positionChanged() override { } 65 virtual void radarTick(float dt) override {} 66 66 67 inline float getRadarSensitivity() const67 virtual inline float getRadarSensitivity() const override 68 68 { return 1.0f; } 69 69 … … 141 141 142 142 std::map<RadarViewable*, ObjectInfo> activeObjectList_; 143 std::list<std::pair<RadarViewable*, unsigned int> 143 std::list<std::pair<RadarViewable*, unsigned int>> sortedObjectList_; 144 144 145 145 float healthMarkerSize_; -
code/trunk/src/modules/overlays/hud/HUDRadar.cc
r11052 r11071 65 65 this->setMaximumDotSize3D(0.07f); 66 66 67 this->shapeMaterials_[RadarViewable:: Dot] = "RadarDot.png";68 this->shapeMaterials_[RadarViewable:: Triangle] = "RadarTriangle.png";69 this->shapeMaterials_[RadarViewable::S quare] = "RadarSquare.png";70 this->owner_ = 0;67 this->shapeMaterials_[RadarViewable::Shape::Dot] = "RadarDot.png"; 68 this->shapeMaterials_[RadarViewable::Shape::Triangle] = "RadarTriangle.png"; 69 this->shapeMaterials_[RadarViewable::Shape::Square] = "RadarSquare.png"; 70 this->owner_ = nullptr; 71 71 72 72 this->map3DFront_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton() … … 92 92 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->map3DBack_); 93 93 94 for (std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it = this->radarObjects_.begin(); 95 it != this->radarObjects_.end(); ++it) 96 { 97 Ogre::OverlayManager::getSingleton().destroyOverlayElement(it->second); 94 for (const auto& mapEntry : this->radarObjects_) 95 { 96 Ogre::OverlayManager::getSingleton().destroyOverlayElement(mapEntry.second); 98 97 } 99 98 } … … 166 165 { 167 166 const std::set<RadarViewable*>& objectSet = this->getCreator()->getScene()->getRadar()->getRadarObjects(); 168 std::set<RadarViewable*>::const_iterator it; 169 for( it=objectSet.begin(); it!=objectSet.end(); ++it ) 170 this->addObject(*it); 167 for( RadarViewable* viewable : objectSet ) 168 this->addObject(viewable); 171 169 this->radarTick(0); 172 170 } … … 184 182 185 183 // update the distances for all objects 186 std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;187 188 184 189 185 if(RadarMode_) … … 202 198 } 203 199 204 for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it)200 for( const auto& mapEntry : this->radarObjects_ ) 205 201 { 206 202 // Make sure the object really is a WorldEntity 207 const WorldEntity* wePointer = it->first->getWorldEntity();203 const WorldEntity* wePointer = mapEntry.first->getWorldEntity(); 208 204 if( !wePointer ) 209 205 { … … 211 207 assert(0); 212 208 } 213 bool isFocus = ( it->first == focusObject);209 bool isFocus = (mapEntry.first == focusObject); 214 210 // set size to fit distance... 215 211 float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length(); … … 218 214 float size; 219 215 if(RadarMode_) 220 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();216 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale(); 221 217 else 222 size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();223 it->second->setDimensions(size, size);218 size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale(); 219 mapEntry.second->setDimensions(size, size); 224 220 225 221 // calc position on radar... … … 235 231 int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_); 236 232 if(overXZPlain == false /*&& (it->second->getZOrder() > 100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay 237 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);233 mapEntry.second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder); 238 234 if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/) 239 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);235 mapEntry.second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder); 240 236 } 241 237 else … … 243 239 244 240 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 245 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);241 mapEntry.second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f); 246 242 247 243 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 248 it->second->show();244 mapEntry.second->show(); 249 245 else 250 it->second->hide();246 mapEntry.second->hide(); 251 247 252 248 // if this object is in focus, then set the focus marker … … 256 252 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f); 257 253 if(RadarMode_) 258 this->marker_->_notifyZOrder( it->second->getZOrder() -1);254 this->marker_->_notifyZOrder(mapEntry.second->getZOrder() -1); 259 255 this->marker_->show(); 260 256 } -
code/trunk/src/modules/overlays/hud/HUDRadar.h
r9945 r11071 50 50 virtual ~HUDRadar(); 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;53 virtual void changedOwner() ;52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 virtual void changedOwner() override; 54 54 void setConfigValues(); 55 55 … … 80 80 void set3DMaterialBack(std::string material3DBack) { this->material3DBack_ = material3DBack; } 81 81 82 float getRadarSensitivity() const{ return this->sensitivity_; }82 virtual float getRadarSensitivity() const override { return this->sensitivity_; } 83 83 // used also by RadarListener interface! 84 84 void setRadarSensitivity(float sensitivity) { this->sensitivity_ = sensitivity; } … … 89 89 90 90 // RadarListener interface 91 virtual void addObject(RadarViewable* viewable) ;92 virtual void removeObject(RadarViewable* viewable) ;93 virtual void objectChanged( RadarViewable* rv ) ;94 v oid radarTick(float dt);91 virtual void addObject(RadarViewable* viewable) override; 92 virtual void removeObject(RadarViewable* viewable) override; 93 virtual void objectChanged( RadarViewable* rv ) override; 94 virtual void radarTick(float dt) override; 95 95 bool showObject( RadarViewable* rv ); //!< Do not display an object on radar, if showObject(.) is false. 96 96 -
code/trunk/src/modules/overlays/hud/HUDRocketFuelBar.cc
r11052 r11071 40 40 RegisterObject(HUDRocketFuelBar); 41 41 42 this->owner_ = NULL;42 this->owner_ = nullptr; 43 43 } 44 44 -
code/trunk/src/modules/overlays/hud/HUDRocketFuelBar.h
r11052 r11071 49 49 virtual ~HUDRocketFuelBar(); 50 50 51 virtual void tick(float dt) ;52 virtual void changedOwner() ;51 virtual void tick(float dt) override; 52 virtual void changedOwner() override; 53 53 54 54 private: -
code/trunk/src/modules/overlays/hud/HUDShieldBar.cc
r11052 r11071 41 41 RegisterObject(HUDShieldBar); 42 42 43 this->owner_ = NULL;43 this->owner_ = nullptr; 44 44 } 45 45 -
code/trunk/src/modules/overlays/hud/HUDShieldBar.h
r11052 r11071 49 49 virtual ~HUDShieldBar(); 50 50 51 virtual void tick(float dt) ;52 virtual void changedOwner() ;51 virtual void tick(float dt) override; 52 virtual void changedOwner() override; 53 53 54 54 inline void setShieldBarOwner(Pawn* owner) -
code/trunk/src/modules/overlays/hud/HUDSpeedBar.cc
r9667 r11071 43 43 RegisterObject(HUDSpeedBar); 44 44 45 this->owner_ = 0;45 this->owner_ = nullptr; 46 46 } 47 47 -
code/trunk/src/modules/overlays/hud/HUDSpeedBar.h
r9667 r11071 44 44 virtual ~HUDSpeedBar(); 45 45 46 virtual void tick(float dt) ;47 virtual void changedOwner() ;46 virtual void tick(float dt) override; 47 virtual void changedOwner() override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/HUDTimer.cc
r9667 r11071 42 42 RegisterObject(HUDTimer); 43 43 44 this->owner_ = 0;44 this->owner_ = nullptr; 45 45 } 46 46 -
code/trunk/src/modules/overlays/hud/HUDTimer.h
r9667 r11071 43 43 virtual ~HUDTimer(); 44 44 45 virtual void tick(float dt) ;45 virtual void tick(float dt) override; 46 46 47 virtual void changedOwner() ;47 virtual void changedOwner() override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/HUDWeapon.cc
r11052 r11071 44 44 weaponModeHUDActualSize_ = Vector2(0.0f,0.0f); 45 45 46 weaponModes_ = NULL;47 46 weaponIndex_ = 0; 48 47 hudWeaponModes_.clear(); … … 77 76 if (!weapon_) 78 77 { 79 // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is NULL)78 // TODO: destroy this HUD id the Weapon does no more exist. (Wehen the weak pointer is null) 80 79 } 81 80 } … … 115 114 bool visible = this->isVisible(); 116 115 117 for ( std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)118 { 119 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed120 (*it)->setVisible(visible);116 for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_) 117 { 118 hudWeaponMode->changedVisibility(); //inform all Child Overlays that our visibility has changed 119 hudWeaponMode->setVisible(visible); 121 120 } 122 121 } … … 141 140 void HUDWeapon::updateWeaponModeList() 142 141 { 143 if (owner_ == NULL || weapon_ == NULL)142 if (owner_ == nullptr || weapon_ == nullptr) 144 143 { 145 144 return; … … 147 146 148 147 destroyHUDChilds(); 149 150 weaponModes_ = weapon_->getAllWeaponmodes();151 148 152 149 updateSize(); … … 157 154 void HUDWeapon::createHUDChilds() 158 155 { 159 if (weapon Modes_ == NULL)156 if (weapon_ == nullptr) 160 157 { 161 158 return; … … 164 161 int positionIndex = 0; 165 162 166 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = weaponModes_->begin(); it != weaponModes_->end(); ++it)163 for (const auto& mapEntry : weapon_->getAllWeaponmodes()) 167 164 { 168 165 HUDWeaponMode* hudWeaponMode = new HUDWeaponMode(this->getContext()); … … 170 167 hudWeaponMode->setOverlayGroup(this->getOverlayGroup()); 171 168 hudWeaponMode->setVisible(this->isVisible()); 172 hudWeaponMode->setWeaponMode( it->second);169 hudWeaponMode->setWeaponMode(mapEntry.second); 173 170 hudWeaponMode->setWeaponIndex(this->weaponIndex_); 174 171 hudWeaponMode->setAspectCorrection(false); … … 185 182 int positionIndex = 0; 186 183 187 for ( std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)188 { 189 (*it)->setPositionOffset(this->positionOffset_);190 (*it)->setWeaponModeIndex(positionIndex);191 (*it)->setWeaponIndex(this->weaponIndex_);192 (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);184 for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_) 185 { 186 hudWeaponMode->setPositionOffset(this->positionOffset_); 187 hudWeaponMode->setWeaponModeIndex(positionIndex); 188 hudWeaponMode->setWeaponIndex(this->weaponIndex_); 189 hudWeaponMode->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_); 193 190 194 191 ++ positionIndex; … … 198 195 void HUDWeapon::destroyHUDChilds() 199 196 { 200 for ( std::vector<WeakPtr<HUDWeaponMode> >::iterator it = hudWeaponModes_.begin(); it != hudWeaponModes_.end(); ++it)201 { 202 (*it)->destroy();197 for (HUDWeaponMode* hudWeaponMode : hudWeaponModes_) 198 { 199 hudWeaponMode->destroy(); 203 200 } 204 201 … … 208 205 void HUDWeapon::updateSize() 209 206 { 210 if (weapon Modes_ != NULL)211 { 212 this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weapon Modes_->size()));207 if (weapon_ != nullptr) 208 { 209 this->setSize(Vector2(weaponModeHUDActualSize_.x,weaponModeHUDActualSize_.y*weapon_->getAllWeaponmodes().size())); 213 210 updatePosition(); 214 211 } … … 217 214 void HUDWeapon::updatePosition() 218 215 { 219 if (weapon Modes_ != NULL)216 if (weapon_ != nullptr) 220 217 { 221 218 this->setPosition(Vector2(weaponModeHUDActualSize_.x*weaponIndex_,0.0f) + this->positionOffset_); -
code/trunk/src/modules/overlays/hud/HUDWeapon.h
r11052 r11071 55 55 virtual ~HUDWeapon(); 56 56 57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;58 virtual void tick(float dt) ;59 virtual void changedOwner() ;60 virtual void changedOverlayGroup() ;61 virtual void changedVisibility() ;62 virtual void changedName() ;63 virtual void positionChanged() ;64 virtual void sizeChanged() ;57 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 58 virtual void tick(float dt) override; 59 virtual void changedOwner() override; 60 virtual void changedOverlayGroup() override; 61 virtual void changedVisibility() override; 62 virtual void changedName() override; 63 virtual void positionChanged() override; 64 virtual void sizeChanged() override; 65 65 66 v irtual void setWeapon(Weapon* weapon);66 void setWeapon(Weapon* weapon); 67 67 68 68 inline void setWeaponModeHUDActualSize(Vector2 vector) … … 84 84 85 85 private: 86 v irtual void createHUDChilds();87 v irtual void positionHUDChilds();88 v irtual void destroyHUDChilds();89 v irtual void updateWeaponModeList();90 v irtual void updateSize();91 v irtual void updatePosition();86 void createHUDChilds(); 87 void positionHUDChilds(); 88 void destroyHUDChilds(); 89 void updateWeaponModeList(); 90 void updateSize(); 91 void updatePosition(); 92 92 93 93 WeakPtr<Pawn> owner_; 94 94 WeakPtr<Weapon> weapon_; 95 95 96 std::multimap<unsigned int, WeaponMode*>* weaponModes_; 97 std::vector<WeakPtr<HUDWeaponMode> > hudWeaponModes_; 96 std::vector<WeakPtr<HUDWeaponMode>> hudWeaponModes_; 98 97 99 98 Ogre::PanelOverlayElement* overlayElement_; -
code/trunk/src/modules/overlays/hud/HUDWeaponMode.cc
r11052 r11071 29 29 #include "HUDWeaponMode.h" 30 30 31 #include "util/Convert.h" 32 #include "util/StringUtils.h" 31 33 #include "core/CoreIncludes.h" 32 #include "core/XMLPort.h"33 #include "util/Convert.h"34 34 #include "core/class/Super.h" 35 35 … … 76 76 textOverlayLeft_->setPickPoint(Vector2(0.0f,0.0f)); 77 77 textOverlayLeft_->setVisible(true); 78 textOverlayLeft_->setAlignment(OverlayText:: Center);78 textOverlayLeft_->setAlignment(OverlayText::Alignment::Center); 79 79 textOverlayLeft_->setTextSize(0.02f); 80 80 textOverlayLeft_->setColour(ColourValue(0.21,0.70,0.21,1.0)); … … 87 87 textOverlayRight_->setPickPoint(Vector2(0.0f,0.0f)); 88 88 textOverlayRight_->setVisible(true); 89 textOverlayRight_->setAlignment(OverlayText:: Center);89 textOverlayRight_->setAlignment(OverlayText::Alignment::Center); 90 90 textOverlayRight_->setTextSize(0.02f); 91 91 textOverlayRight_->setColour(ColourValue(0.21,0.70,0.21,1.0)); … … 107 107 } 108 108 109 void HUDWeaponMode::XMLPort(Element& xmlelement, XMLPort::Mode mode)110 {111 SUPER(HUDWeaponMode, XMLPort, xmlelement, mode);112 }113 114 109 void HUDWeaponMode::tick(float dt) 115 110 { … … 131 126 Munition* munition = this->weaponMode_->getMunition(); 132 127 133 if (munition != NULL)134 { 135 MunitionDeployment ::Valuedeployment = munition->getMunitionDeployment();128 if (munition != nullptr) 129 { 130 MunitionDeployment deployment = munition->getMunitionDeployment(); 136 131 137 132 if (deployment == MunitionDeployment::Share) … … 242 237 Munition* munition = this->weaponMode_->getMunition(); 243 238 244 if (munition != NULL)245 { 246 MunitionDeployment ::Valuedeployment = munition->getMunitionDeployment();239 if (munition != nullptr) 240 { 241 MunitionDeployment deployment = munition->getMunitionDeployment(); 247 242 248 243 if (deployment == MunitionDeployment::Share) -
code/trunk/src/modules/overlays/hud/HUDWeaponMode.h
r11052 r11071 57 57 virtual ~HUDWeaponMode(); 58 58 59 virtual void tick(float dt); 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 61 virtual void changedOwner(); 62 virtual void changedOverlayGroup(); 63 virtual void changedVisibility(); 64 virtual void changedName(); 65 virtual void positionChanged(); 66 virtual void sizeChanged(); 59 virtual void tick(float dt) override; 60 virtual void changedOwner() override; 61 virtual void changedOverlayGroup() override; 62 virtual void changedVisibility() override; 63 virtual void changedName() override; 64 virtual void positionChanged() override; 65 virtual void sizeChanged() override; 67 66 68 v irtual void setWeaponMode(WeaponMode* weaponMode);67 void setWeaponMode(WeaponMode* weaponMode); 69 68 70 69 inline void setWeaponModeHUDActualSize(Vector2 vector) … … 89 88 90 89 private: 91 v irtual void updateSize();92 v irtual void updatePosition();93 v irtual void positionHUDChilds();90 void updateSize(); 91 void updatePosition(); 92 void positionHUDChilds(); 94 93 95 94 WeakPtr<Pawn> owner_; -
code/trunk/src/modules/overlays/hud/HUDWeaponSystem.cc
r11052 r11071 103 103 bool visible = this->isVisible(); 104 104 105 for ( std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)105 for (HUDWeapon* hudWeapon : hudWeapons_) 106 106 { 107 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed108 (*it)->setVisible(visible);107 hudWeapon->changedVisibility(); //inform all Child Overlays that our visibility has changed 108 hudWeapon->setVisible(visible); 109 109 } 110 110 } … … 117 117 void HUDWeaponSystem::updateWeaponList() 118 118 { 119 if (owner_ == NULL)119 if (owner_ == nullptr) 120 120 { 121 121 return; … … 126 126 destroyHUDChilds(); 127 127 128 std::vector<WeaponPack*>* weaponPacks = owner_->getAllWeaponPacks(); 128 if (owner_->getWeaponSystem()) 129 { 130 const std::vector<WeaponPack*>& weaponPacks = owner_->getWeaponSystem()->getAllWeaponPacks(); 131 for (WeaponPack* weaponPack : weaponPacks) 132 { 133 const std::vector<Weapon*>& weapons = weaponPack->getAllWeapons(); 134 for (Weapon* weapon : weapons) 135 { 136 this->weapons_.push_back(weapon); 137 } 138 } 129 139 130 for (std::vector<WeaponPack*>::const_iterator itPacks = weaponPacks->begin(); itPacks != weaponPacks->end(); ++itPacks) 131 { 132 std::vector<Weapon*>* weapons = (*itPacks)->getAllWeapons(); 133 134 for (std::vector<Weapon*>::const_iterator itWeapons = weapons->begin(); itWeapons != weapons->end(); ++itWeapons) 135 { 136 this->weapons_.push_back(*itWeapons); 137 } 140 createHUDChilds(); 141 positionHUDChilds(); 138 142 } 139 140 createHUDChilds();141 positionHUDChilds();142 143 } 143 144 … … 146 147 int positionIndex = 0; 147 148 148 for ( std::vector<WeakPtr<Weapon> >::iterator it = weapons_.begin(); it != weapons_.end(); ++it)149 for (Weapon* weapon : weapons_) 149 150 { 150 151 HUDWeapon* hudWeapon = new HUDWeapon(this->getContext()); … … 152 153 hudWeapon->setOverlayGroup(this->getOverlayGroup()); 153 154 hudWeapon->setVisible(this->isVisible()); 154 hudWeapon->setWeapon( *it);155 hudWeapon->setWeapon(weapon); 155 156 hudWeapon->setAspectCorrection(false); 156 157 hudWeapon->setPickPoint(Vector2(0.0f,0.0f)); … … 167 168 Vector2 offset = this->getPosition(); 168 169 169 for ( std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)170 for (HUDWeapon* hudWeapon : hudWeapons_) 170 171 { 171 (*it)->setPositionOffset(offset);172 (*it)->setWeaponIndex(positionIndex);173 (*it)->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_);172 hudWeapon->setPositionOffset(offset); 173 hudWeapon->setWeaponIndex(positionIndex); 174 hudWeapon->setWeaponModeHUDActualSize(this->weaponModeHUDActualSize_); 174 175 175 176 ++ positionIndex; … … 179 180 void HUDWeaponSystem::destroyHUDChilds() 180 181 { 181 for ( std::vector<WeakPtr<HUDWeapon> >::iterator it = hudWeapons_.begin(); it != hudWeapons_.end(); ++it)182 for (HUDWeapon* hudWeapon : hudWeapons_) 182 183 { 183 (*it)->destroy();184 hudWeapon->destroy(); 184 185 } 185 186 -
code/trunk/src/modules/overlays/hud/HUDWeaponSystem.h
r11052 r11071 49 49 virtual ~HUDWeaponSystem(); 50 50 51 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;52 virtual void changedOwner() ;53 virtual void changedOverlayGroup() ;54 virtual void changedVisibility() ;55 virtual void changedName() ;56 virtual void positionChanged() ;57 virtual void sizeChanged() ;51 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 52 virtual void changedOwner() override; 53 virtual void changedOverlayGroup() override; 54 virtual void changedVisibility() override; 55 virtual void changedName() override; 56 virtual void positionChanged() override; 57 virtual void sizeChanged() override; 58 58 protected: 59 59 inline void setWeaponModeHUDSize(Vector2 vector) … … 64 64 { return weaponModeHUDSize_; } 65 65 private: 66 v irtual void updateWeaponList();67 v irtual void createHUDChilds();68 v irtual void positionHUDChilds();69 v irtual void destroyHUDChilds();66 void updateWeaponList(); 67 void createHUDChilds(); 68 void positionHUDChilds(); 69 void destroyHUDChilds(); 70 70 71 71 WeakPtr<Pawn> owner_; 72 72 73 std::vector<WeakPtr<Weapon> 74 std::vector<WeakPtr<HUDWeapon> 73 std::vector<WeakPtr<Weapon>> weapons_; 74 std::vector<WeakPtr<HUDWeapon>> hudWeapons_; 75 75 76 76 Vector2 weaponModeHUDSize_; -
code/trunk/src/modules/overlays/hud/KillMessage.cc
r9667 r11071 40 40 RegisterObject(KillMessage); 41 41 42 this->owner_ = 0;42 this->owner_ = nullptr; 43 43 44 44 this->setDelay(2.0f); -
code/trunk/src/modules/overlays/hud/KillMessage.h
r9667 r11071 43 43 virtual ~KillMessage() {} 44 44 45 virtual void changedOwner() ;45 virtual void changedOwner() override; 46 46 47 v oid killmessage(const GametypeInfo* gtinfo, const std::string& message);47 virtual void killmessage(const GametypeInfo* gtinfo, const std::string& message) override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/LastManStandingInfos.cc
r10624 r11071 43 43 RegisterObject(LastManStandingInfos); 44 44 45 this->lms_ = 0;46 this->player_ = 0;45 this->lms_ = nullptr; 46 this->player_ = nullptr; 47 47 this->bShowLives_ = false; 48 48 this->bShowPlayers_ = false; … … 91 91 else 92 92 { 93 this->player_ = 0;94 this->lms_ = 0;93 this->player_ = nullptr; 94 this->lms_ = nullptr; 95 95 } 96 96 } -
code/trunk/src/modules/overlays/hud/LastManStandingInfos.h
r9667 r11071 43 43 virtual ~LastManStandingInfos(); 44 44 45 virtual void tick(float dt) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void changedOwner() ;45 virtual void tick(float dt) override; 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 virtual void changedOwner() override; 48 48 49 49 inline void setShowLives(bool value) -
code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.cc
r10624 r11071 43 43 RegisterObject(LastTeamStandingInfos); 44 44 45 this->lts_ = 0;46 this->player_ = 0;45 this->lts_ = nullptr; 46 this->player_ = nullptr; 47 47 this->bShowLives_ = false; 48 48 this->bShowTeams_ = false; … … 91 91 else 92 92 { 93 this->player_ = 0;94 this->lts_ = 0;93 this->player_ = nullptr; 94 this->lts_ = nullptr; 95 95 } 96 96 } -
code/trunk/src/modules/overlays/hud/LastTeamStandingInfos.h
r9667 r11071 43 43 virtual ~LastTeamStandingInfos(); 44 44 45 virtual void tick(float dt) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void changedOwner() ;45 virtual void tick(float dt) override; 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 virtual void changedOwner() override; 48 48 49 49 inline void setShowLives(bool value) -
code/trunk/src/modules/overlays/hud/PauseNotice.cc
r9667 r11071 40 40 RegisterObject(PauseNotice); 41 41 42 this->owner_ = 0;42 this->owner_ = nullptr; 43 43 } 44 44 -
code/trunk/src/modules/overlays/hud/PauseNotice.h
r9667 r11071 42 42 PauseNotice(Context* context); 43 43 44 virtual void changedOwner() ;44 virtual void changedOwner() override; 45 45 46 46 protected: 47 virtual void changedTimeFactor(float factor_new, float factor_old) ;47 virtual void changedTimeFactor(float factor_new, float factor_old) override; 48 48 49 49 private: -
code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.cc
r10624 r11071 43 43 RegisterObject(TeamBaseMatchScore); 44 44 45 this->owner_ = 0;45 this->owner_ = nullptr; 46 46 47 47 this->bShowBases_ = false; … … 120 120 this->owner_ = orxonox_cast<TeamBaseMatch*>(this->getOwner()->getGametype()); 121 121 else 122 this->owner_ = 0;122 this->owner_ = nullptr; 123 123 } 124 124 } -
code/trunk/src/modules/overlays/hud/TeamBaseMatchScore.h
r9667 r11071 43 43 virtual ~TeamBaseMatchScore(); 44 44 45 virtual void tick(float dt) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void changedOwner() ;45 virtual void tick(float dt) override; 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 virtual void changedOwner() override; 48 48 49 49 inline void setShowBases(bool value) -
code/trunk/src/modules/overlays/stats/CreateLines.cc
r6502 r11071 37 37 CreateLines::CreateLines(float leftOffset, float topOffset, float width, float height) 38 38 { 39 playerNameText_ = new OverlayText( 0);39 playerNameText_ = new OverlayText(nullptr); 40 40 playerNameText_->setTextSize(0.04f); 41 41 playerNameText_->setColour(ColourValue(0.0f, 0.75f, 0.2f, 1.0f)); 42 42 playerNameText_->setPosition(Vector2(0.1f, topOffset + 0.01f)); 43 43 44 scoreText_ = new OverlayText( 0);44 scoreText_ = new OverlayText(nullptr); 45 45 scoreText_->setTextSize(0.04f); 46 46 scoreText_->setColour(ColourValue(0.0f, 0.75f, 0.2f, 1.0f)); 47 47 scoreText_->setPosition(Vector2(0.6f, topOffset + 0.01f)); 48 48 49 deathsText_ = new OverlayText( 0);49 deathsText_ = new OverlayText(nullptr); 50 50 deathsText_->setTextSize(0.04f); 51 51 deathsText_->setColour(ColourValue(0, 0.75f, 0.2f, 1.0f)); 52 52 deathsText_->setPosition(Vector2(0.8f, topOffset + 0.01f)); 53 53 54 background_ = new Stats( 0);54 background_ = new Stats(nullptr); 55 55 background_->setPosition(Vector2(leftOffset, topOffset)); 56 56 background_->setSize(Vector2(width, height)); -
code/trunk/src/modules/overlays/stats/CreateLines.h
r5980 r11071 29 29 30 30 #include "overlays/OverlaysPrereqs.h" 31 32 #include <string> 31 33 32 34 namespace orxonox -
code/trunk/src/modules/overlays/stats/Scoreboard.cc
r9667 r11071 60 60 SUPER(Scoreboard, changedVisibility); 61 61 62 for ( unsigned int i = 0; i < this->lines_.size(); ++i)63 this->lines_[i]->changedVisibility();62 for (CreateLines* line : this->lines_) 63 line->changedVisibility(); 64 64 } 65 65 … … 94 94 95 95 unsigned int index = 0; 96 for ( std::map<PlayerInfo*, Player>::const_iterator it = playerList.begin(); it != playerList.end(); ++it)96 for (const auto& mapEntry : playerList) 97 97 { 98 this->lines_[index]->setPlayerName(multi_cast<std::string>( it->first->getName()));99 this->lines_[index]->setScore(multi_cast<std::string>( it->second.frags_));100 this->lines_[index]->setDeaths(multi_cast<std::string>( it->second.killed_));98 this->lines_[index]->setPlayerName(multi_cast<std::string>(mapEntry.first->getName())); 99 this->lines_[index]->setScore(multi_cast<std::string>(mapEntry.second.frags_)); 100 this->lines_[index]->setDeaths(multi_cast<std::string>(mapEntry.second.killed_)); 101 101 index++; 102 102 } -
code/trunk/src/modules/overlays/stats/Scoreboard.h
r9667 r11071 44 44 virtual ~Scoreboard(); 45 45 46 virtual void tick(float dt) ;46 virtual void tick(float dt) override; 47 47 48 48 inline void setCreateLines(CreateLines* cl) … … 51 51 { return this->createlines_; } 52 52 53 virtual void changedVisibility() ;53 virtual void changedVisibility() override; 54 54 55 55 private: // functions -
code/trunk/src/modules/overlays/stats/Stats.cc
r9667 r11071 46 46 Stats::Stats(Context* context) 47 47 : OrxonoxOverlay(context) 48 , statsOverlayNoise_( 0)49 , statsOverlayBorder_( 0)48 , statsOverlayNoise_(nullptr) 49 , statsOverlayBorder_(nullptr) 50 50 { 51 51 RegisterObject(Stats); -
code/trunk/src/modules/overlays/stats/Stats.h
r9667 r11071 46 46 void setConfigValues(); 47 47 48 virtual void tick(float dt) ;48 virtual void tick(float dt) override; 49 49 50 50 private: // variables -
code/trunk/src/modules/pickup/CollectiblePickup.cc
r10624 r11071 47 47 Registers the object and initializes variables. 48 48 */ 49 CollectiblePickup::CollectiblePickup() : collection_( NULL)49 CollectiblePickup::CollectiblePickup() : collection_(nullptr) 50 50 { 51 51 RegisterObject(CollectiblePickup); … … 103 103 void CollectiblePickup::wasRemovedFromCollection(void) 104 104 { 105 this->collection_ = NULL;105 this->collection_ = nullptr; 106 106 } 107 107 } -
code/trunk/src/modules/pickup/CollectiblePickup.h
r9348 r11071 61 61 virtual ~CollectiblePickup(); //! Destructor. 62 62 63 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.64 virtual void changedPickedUp(void) ; //!< Is called when the pickup has transited from picked up to dropped or the other way around.63 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 64 virtual void changedPickedUp(void) override; //!< Is called when the pickup has transited from picked up to dropped or the other way around. 65 65 66 66 /** … … 69 69 */ 70 70 bool isInCollection(void) const 71 { return this->collection_ != NULL; }71 { return this->collection_ != nullptr; } 72 72 73 73 private: -
code/trunk/src/modules/pickup/Pickup.cc
r9667 r11071 78 78 void Pickup::initialize(void) 79 79 { 80 this->activationType_ = pickupActivationType::immediate;81 this->durationType_ = pickupDurationType::once;80 this->activationType_ = PickupActivationType::immediate; 81 this->durationType_ = PickupDurationType::once; 82 82 } 83 83 … … 105 105 switch(this->getActivationType()) 106 106 { 107 case pickupActivationType::immediate:107 case PickupActivationType::immediate: 108 108 return activationTypeImmediate_s; 109 case pickupActivationType::onUse:109 case PickupActivationType::onUse: 110 110 return activationTypeOnUse_s; 111 111 default: … … 124 124 switch(this->getDurationType()) 125 125 { 126 case pickupDurationType::once:126 case PickupDurationType::once: 127 127 return durationTypeOnce_s; 128 case pickupDurationType::continuous:128 case PickupDurationType::continuous: 129 129 return durationTypeContinuous_s; 130 130 default: … … 142 142 { 143 143 if(type == Pickup::activationTypeImmediate_s) 144 this->setActivationType( pickupActivationType::immediate);144 this->setActivationType(PickupActivationType::immediate); 145 145 else if(type == Pickup::activationTypeOnUse_s) 146 this->setActivationType( pickupActivationType::onUse);146 this->setActivationType(PickupActivationType::onUse); 147 147 else 148 148 orxout(internal_error, context::pickups) << "Invalid activationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; … … 158 158 { 159 159 if(type == Pickup::durationTypeOnce_s) 160 this->setDurationType( pickupDurationType::once);160 this->setDurationType(PickupDurationType::once); 161 161 else if(type == Pickup::durationTypeContinuous_s) 162 this->setDurationType( pickupDurationType::continuous);162 this->setDurationType(PickupDurationType::continuous); 163 163 else 164 164 orxout(internal_error, context::pickups) << "Invalid durationType '" << type << "' in " << this->getIdentifier()->getName() << "." << endl; -
code/trunk/src/modules/pickup/Pickup.h
r9667 r11071 53 53 @ingroup Pickup 54 54 */ 55 namespace pickupActivationType55 enum class PickupActivationType 56 56 { 57 enum Value 58 { 59 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 60 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 61 }; 62 } 57 immediate, //!< Means that the @ref orxonox::Pickup "Pickup" will be used immediately after pickup. 58 onUse, //!< Means that the @ref orxonox::Pickup "Pickup" will be used at a later point trough some external influence. 59 }; 63 60 64 61 /** … … 68 65 @ingroup Pickup 69 66 */ 70 namespace pickupDurationType67 enum class PickupDurationType 71 68 { 72 enum Value 73 { 74 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 75 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 76 }; 77 } 69 once, //!< Means that the @ref orxonox::Pickup "Pickup" will be used only once at a singular time instant. 70 continuous, //!< Means that the @ref orxonox::Pickup "Pickup" will be used over a continuous timespan. 71 }; 78 72 79 73 /** … … 103 97 virtual ~Pickup(); //!< Destructor. 104 98 105 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;99 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 106 100 107 virtual const std::string& getRepresentationName() const 101 virtual const std::string& getRepresentationName() const override 108 102 { return this->representationName_; } 109 103 … … 112 106 @return Returns the activation type of the Pickup. 113 107 */ 114 inline pickupActivationType::Value getActivationType(void) const108 inline PickupActivationType getActivationType(void) const 115 109 { return this->activationType_; } 116 110 /** … … 118 112 @return Returns the duration type of the Pickup. 119 113 */ 120 inline pickupDurationType::Value getDurationType(void) const114 inline PickupDurationType getDurationType(void) const 121 115 { return this->durationType_; } 122 116 … … 129 123 */ 130 124 inline bool isImmediate(void) const 131 { return this->getActivationType() == pickupActivationType::immediate; }125 { return this->getActivationType() == PickupActivationType::immediate; } 132 126 /** 133 127 @brief Get whether the activation type is 'onUse'. … … 135 129 */ 136 130 inline bool isOnUse(void) const 137 { return this->getActivationType() == pickupActivationType::onUse; }131 { return this->getActivationType() == PickupActivationType::onUse; } 138 132 /** 139 133 @brief Get whether the duration type is 'once'. … … 141 135 */ 142 136 inline bool isOnce(void) const 143 { return this->getDurationType() == pickupDurationType::once; }137 { return this->getDurationType() == PickupDurationType::once; } 144 138 /** 145 139 @brief Get whether the duration type is 'continuous'. … … 147 141 */ 148 142 inline bool isContinuous(void) const 149 { return this->getDurationType() == pickupDurationType::continuous; }143 { return this->getDurationType() == PickupDurationType::continuous; } 150 144 151 virtual void changedPickedUp(void) ; //!< Should be called when the pickup has transited from picked up to dropped or the other way around.145 virtual void changedPickedUp(void) override; //!< Should be called when the pickup has transited from picked up to dropped or the other way around. 152 146 153 147 protected: 154 virtual bool createSpawner(void) ; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.148 virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 155 149 156 150 /** … … 164 158 @param type The activation type of the Pickup. 165 159 */ 166 inline void setActivationType( pickupActivationType::Value type)160 inline void setActivationType(PickupActivationType type) 167 161 { this->activationType_ = type; } 168 162 /** … … 170 164 @param type The duration type of the Pickup. 171 165 */ 172 inline void setDurationType( pickupDurationType::Value type)166 inline void setDurationType(PickupDurationType type) 173 167 { this->durationType_ = type; } 174 168 … … 180 174 181 175 std::string representationName_; //!< The name of the associated PickupRepresentation. 182 pickupActivationType::Value activationType_; //!< The activation type of the Pickup.183 pickupDurationType::Value durationType_; //!< The duration type of the Pickup.176 PickupActivationType activationType_; //!< The activation type of the Pickup. 177 PickupDurationType durationType_; //!< The duration type of the Pickup. 184 178 185 179 //! Strings for the activation and duration types. -
code/trunk/src/modules/pickup/PickupCollection.cc
r9667 r11071 68 68 { 69 69 // Destroy all Pickupables constructing this PickupCollection. 70 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)71 { 72 (*it)->wasRemovedFromCollection();73 (*it)->destroy();70 for(CollectiblePickup* pickup : this->pickups_) 71 { 72 pickup->wasRemovedFromCollection(); 73 pickup->destroy(); 74 74 } 75 75 this->pickups_.clear(); … … 99 99 this->processingUsed_ = true; 100 100 // Change used for all Pickupables this PickupCollection consists of. 101 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)102 (*it)->setUsed(this->isUsed());101 for(CollectiblePickup* pickup : this->pickups_) 102 pickup->setUsed(this->isUsed()); 103 103 104 104 this->processingUsed_ = false; … … 119 119 size_t numPickupsEnabled = 0; 120 120 size_t numPickupsInUse = 0; 121 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)122 { 123 if ( (*it)->isEnabled())121 for(CollectiblePickup* pickup : this->pickups_) 122 { 123 if (pickup->isEnabled()) 124 124 ++numPickupsEnabled; 125 if ( (*it)->isUsed())125 if (pickup->isUsed()) 126 126 ++numPickupsInUse; 127 127 } … … 146 146 147 147 // Change the PickupCarrier for all Pickupables this PickupCollection consists of. 148 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)149 { 150 if(this->getCarrier() == NULL)151 (*it)->setCarrier(NULL);148 for(CollectiblePickup* pickup : this->pickups_) 149 { 150 if(this->getCarrier() == nullptr) 151 pickup->setCarrier(nullptr); 152 152 else 153 (*it)->setCarrier(this->getCarrier()->getTarget(*it));153 pickup->setCarrier(this->getCarrier()->getTarget(pickup)); 154 154 } 155 155 } … … 186 186 // If at least all the enabled pickups of this PickupCollection are no longer picked up. 187 187 bool isOnePickupEnabledAndPickedUp = false; 188 for( std::list<CollectiblePickup*>::iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)189 { 190 if ( (*it)->isEnabled() && (*it)->isPickedUp())188 for(CollectiblePickup* pickup : this->pickups_) 189 { 190 if (pickup->isEnabled() && pickup->isPickedUp()) 191 191 { 192 192 isOnePickupEnabledAndPickedUp = true; … … 208 208 bool PickupCollection::isTarget(const PickupCarrier* carrier) const 209 209 { 210 for( std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); it != this->pickups_.end(); ++it)211 { 212 if(!carrier->isTarget( *it))210 for(CollectiblePickup* pickup : this->pickups_) 211 { 212 if(!carrier->isTarget(pickup)) 213 213 return false; 214 214 } … … 227 227 bool PickupCollection::addPickupable(CollectiblePickup* pickup) 228 228 { 229 if(pickup == NULL)229 if(pickup == nullptr) 230 230 return false; 231 231 … … 247 247 { 248 248 if(this->pickups_.size() >= index) 249 return NULL;249 return nullptr; 250 250 251 251 std::list<CollectiblePickup*>::const_iterator it = this->pickups_.begin(); -
code/trunk/src/modules/pickup/PickupCollection.h
r9667 r11071 73 73 virtual ~PickupCollection(); //!< Destructor. 74 74 75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Creates an instance of this Class through XML.75 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates an instance of this Class through XML. 76 76 77 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.78 virtual void changedCarrier(void) ; //!< Is called when the pickup has changed its PickupCarrier.79 virtual void changedPickedUp(void) ; //!< Is called when the pickup has transited from picked up to dropped or the other way around.77 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 78 virtual void changedCarrier(void) override; //!< Is called when the pickup has changed its PickupCarrier. 79 virtual void changedPickedUp(void) override; //!< Is called when the pickup has transited from picked up to dropped or the other way around. 80 80 81 virtual bool isTarget(const PickupCarrier* carrier) const ; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection.81 virtual bool isTarget(const PickupCarrier* carrier) const override; //!< Get whether a given class, represented by the input Identifier, is a target of this PickupCollection. 82 82 83 83 inline void setRepresentationName(const std::string& name) 84 84 { this->representationName_ = name; } 85 virtual const std::string& getRepresentationName() const 85 virtual const std::string& getRepresentationName() const override 86 86 { return this->representationName_; } 87 87 … … 98 98 99 99 protected: 100 virtual bool createSpawner(void) ; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable.100 virtual bool createSpawner(void) override; //!< Facilitates the creation of a PickupSpawner upon dropping of the Pickupable. 101 101 102 102 private: -
code/trunk/src/modules/pickup/PickupManager.cc
r10624 r11071 68 68 Constructor. Registers the PickupManager and creates the default PickupRepresentation. 69 69 */ 70 PickupManager::PickupManager() : guiLoaded_(false), pickupHighestIndex_(0), defaultRepresentation_( NULL)70 PickupManager::PickupManager() : guiLoaded_(false), pickupHighestIndex_(0), defaultRepresentation_(nullptr) 71 71 { 72 72 RegisterObject(PickupManager); … … 85 85 { 86 86 // Destroying the default representation. 87 if(this->defaultRepresentation_ != NULL)87 if(this->defaultRepresentation_ != nullptr) 88 88 this->defaultRepresentation_->destroy(); 89 89 … … 91 91 92 92 // Destroying all the PickupInventoryContainers that are still there. 93 for( std::map<uint32_t, PickupInventoryContainer*>::iterator it = this->pickupInventoryContainers_.begin(); it != this->pickupInventoryContainers_.end(); it++)94 delete it->second;93 for(const auto& mapEntry : this->pickupInventoryContainers_) 94 delete mapEntry.second; 95 95 this->pickupInventoryContainers_.clear(); 96 96 … … 184 184 CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup); 185 185 // If the Pickupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is. 186 if(collectible != NULL&& collectible->isInCollection())186 if(collectible != nullptr && collectible->isInCollection()) 187 187 return; 188 188 189 189 // Getting clientId of the host this change of the pickup's used status concerns. 190 190 PickupCarrier* carrier = pickup->getCarrier(); 191 while(carrier->getCarrierParent() != NULL)191 while(carrier->getCarrierParent() != nullptr) 192 192 carrier = carrier->getCarrierParent(); 193 193 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 194 if(pawn == NULL)194 if(pawn == nullptr) 195 195 return; 196 196 PlayerInfo* info = pawn->getPlayer(); 197 if(info == NULL)197 if(info == nullptr) 198 198 return; 199 199 unsigned int clientId = info->getClientID(); … … 265 265 CollectiblePickup* collectible = orxonox_cast<CollectiblePickup*>(pickup); 266 266 // If the Pickupable is part of a PickupCollection it isn't displayed in the PickupInventory, just the PickupCollection is. 267 if(collectible != NULL&& collectible->isInCollection())267 if(collectible != nullptr && collectible->isInCollection()) 268 268 return; 269 269 270 270 // Getting clientId of the host this change of the pickup's pickedUp status concerns. 271 271 PickupCarrier* carrier = pickup->getCarrier(); 272 while(carrier->getCarrierParent() != NULL)272 while(carrier->getCarrierParent() != nullptr) 273 273 carrier = carrier->getCarrierParent(); 274 274 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 275 if(pawn == NULL)275 if(pawn == nullptr) 276 276 return; 277 277 PlayerInfo* info = pawn->getFormerPlayer(); 278 if(info == NULL)278 if(info == nullptr) 279 279 return; 280 280 unsigned int clientId = info->getClientID(); … … 399 399 return; 400 400 Pickupable* pickupable = this->pickups_.find(pickup)->second; 401 if(pickupable != NULL)401 if(pickupable != nullptr) 402 402 pickupable->drop(); 403 403 } … … 442 442 return; 443 443 Pickupable* pickupable = this->pickups_.find(pickup)->second; 444 if(pickupable != NULL)444 if(pickupable != nullptr) 445 445 pickupable->setUsed(use); 446 446 } -
code/trunk/src/modules/pickup/PickupManager.h
r10624 r11071 117 117 PickupRepresentation* getRepresentation(const std::string& name); // tolua_export 118 118 119 virtual void pickupChangedUsed(Pickupable* pickup, bool used) ; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state.119 virtual void pickupChangedUsed(Pickupable* pickup, bool used) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input used state. 120 120 static void pickupChangedUsedNetwork(uint32_t pickup, bool inUse, bool usable, bool unusable); //!< Helper method to react to the change in the used status of a Pickupable. 121 virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) ; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state.121 virtual void pickupChangedPickedUp(Pickupable* pickup, bool pickedUp) override; //!< Is called by the PickupListener to notify the PickupManager, that the input Pickupable has transited to the input pickedUp state. 122 122 static void pickupChangedPickedUpNetwork(uint32_t pickup, bool usable, uint32_t representationObjectId, const std::string& representationName, bool pickedUp); //!< Helper method to react to the change in the pickedUp status of a Pickupable. 123 123 … … 161 161 std::map<uint32_t, PickupInventoryContainer*>::iterator pickupsIterator_; //!< An iterator pointing to the current Pickupable in pickupsList_. 162 162 163 std::map<uint32_t, WeakPtr<Pickupable> 163 std::map<uint32_t, WeakPtr<Pickupable>> pickups_; //!< Map linking a number identifying a Pickupable to a weak pointer of a Pickupable. 164 164 std::map<Pickupable*, uint32_t> indexes_;//!< Map linking Pickupable to the number identifying it. 165 165 -
code/trunk/src/modules/pickup/PickupRepresentation.cc
r11052 r11071 52 52 This is primarily for use of the PickupManager in creating a default PickupRepresentation. 53 53 */ 54 PickupRepresentation::PickupRepresentation() : BaseObject( NULL), Synchronisable(NULL), spawnerRepresentation_(NULL)54 PickupRepresentation::PickupRepresentation() : BaseObject(nullptr), Synchronisable(nullptr), spawnerRepresentation_(nullptr) 55 55 { 56 56 RegisterObject(PickupRepresentation); … … 64 64 Default Constructor. Registers the object and initializes its member variables. 65 65 */ 66 PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_( NULL)66 PickupRepresentation::PickupRepresentation(Context* context) : BaseObject(context), Synchronisable(context), spawnerRepresentation_(nullptr) 67 67 { 68 68 RegisterObject(PickupRepresentation); … … 78 78 PickupRepresentation::~PickupRepresentation() 79 79 { 80 if(this->spawnerRepresentation_ != NULL)80 if(this->spawnerRepresentation_ != nullptr) 81 81 this->spawnerRepresentation_->destroy(); 82 82 … … 135 135 StaticEntity* PickupRepresentation::createSpawnerRepresentation(PickupSpawner* spawner) 136 136 { 137 if(this->spawnerRepresentation_ == NULL)137 if(this->spawnerRepresentation_ == nullptr) 138 138 { 139 139 orxout(verbose, context::pickups) << "PickupRepresentation: No spawner representation found." << endl; … … 149 149 this->spawnerRepresentation_->setVisible(true); 150 150 StaticEntity* temp = this->spawnerRepresentation_; 151 this->spawnerRepresentation_ = NULL;151 this->spawnerRepresentation_ = nullptr; 152 152 153 153 return temp; … … 164 164 { 165 165 this->spawnerRepresentation_ = representation; 166 if(this->spawnerRepresentation_ != NULL)166 if(this->spawnerRepresentation_ != nullptr) 167 167 this->spawnerRepresentation_->setVisible(false); 168 168 } -
code/trunk/src/modules/pickup/PickupRepresentation.h
r9667 r11071 98 98 virtual ~PickupRepresentation(); //!< Destructor. 99 99 100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a PickupRepresentation object through XML.100 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a PickupRepresentation object through XML. 101 101 102 102 /** … … 119 119 @brief Get the StaticEntity that defines how the PickupSpawner of the Pickupable represented by this PickupRepresentation looks like. 120 120 @param index The index. 121 @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns NULL.121 @return Returns (for index = 0) a pointer to the StaticEntity. For index > 0 it returns nullptr. 122 122 */ 123 123 inline const StaticEntity* getSpawnerRepresentationIndex(unsigned int index) const 124 { if(index == 0) return this->spawnerRepresentation_; return NULL; }124 { if(index == 0) return this->spawnerRepresentation_; return nullptr; } 125 125 /** 126 126 @brief Get the name of the image representing the pickup in the PickupInventory. … … 129 129 inline const std::string& getInventoryRepresentation(void) const { return this->inventoryRepresentation_; } // tolua_export 130 130 131 virtual void changedName() ;131 virtual void changedName() override; 132 132 133 133 StaticEntity* createSpawnerRepresentation(PickupSpawner* spawner); //!< Create a spawnerRepresentation for a specific PickupSpawner. -
code/trunk/src/modules/pickup/PickupSpawner.cc
r10624 r11071 55 55 Pointer to the object which created this item. 56 56 */ 57 PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_( NULL), representation_(NULL), pickupTemplate_(NULL)57 PickupSpawner::PickupSpawner(Context* context) : StaticEntity(context), pickup_(nullptr), representation_(nullptr), pickupTemplate_(nullptr) 58 58 { 59 59 RegisterObject(PickupSpawner); … … 74 74 this->selfDestruct_ = false; 75 75 76 this->setPickupable( NULL);76 this->setPickupable(nullptr); 77 77 } 78 78 … … 83 83 PickupSpawner::~PickupSpawner() 84 84 { 85 if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != NULL)85 if(this->isInitialized() && this->selfDestruct_ && this->pickup_ != nullptr) 86 86 this->pickup_->destroy(); 87 87 } … … 158 158 159 159 // Iterate trough all Pawns. 160 for( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)160 for(Pawn* pawn : ObjectList<Pawn>()) 161 161 { 162 if(spawner == NULL) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute).162 if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute). 163 163 break; 164 164 165 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();166 PickupCarrier* carrier = static_cast<PickupCarrier*>( *it);165 Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition(); 166 PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn); 167 167 // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked. 168 if(distance.length() < this->triggerDistance_ && carrier != NULL&& this->blocked_.find(carrier) == this->blocked_.end())168 if(distance.length() < this->triggerDistance_ && carrier != nullptr && this->blocked_.find(carrier) == this->blocked_.end()) 169 169 { 170 170 if(carrier->isTarget(this->pickup_)) 171 this->trigger( *it);171 this->trigger(pawn); 172 172 } 173 173 } … … 195 195 pickedUp = false; // To avoid compiler warning. 196 196 197 this->setPickupable( NULL);197 this->setPickupable(nullptr); 198 198 this->decrementSpawnsRemaining(); 199 199 } … … 282 282 { 283 283 orxout(internal_error, context::pickups) << "Massive Error: PickupSpawner still alive until having spawned last item." << endl; 284 return NULL;285 } 286 287 if (this->pickupTemplate_ != NULL)284 return nullptr; 285 } 286 287 if (this->pickupTemplate_ != nullptr) 288 288 { 289 289 Identifier* identifier = this->pickupTemplate_->getBaseclassIdentifier(); 290 if (identifier != NULL)290 if (identifier != nullptr) 291 291 { 292 292 Pickupable* pickup = orxonox_cast<Pickupable*>(identifier->fabricate(this->getContext())); … … 298 298 } 299 299 300 return NULL;300 return nullptr; 301 301 } 302 302 … … 309 309 void PickupSpawner::setPickupable(Pickupable* pickup) 310 310 { 311 if (this->representation_ != NULL)311 if (this->representation_ != nullptr) 312 312 { 313 313 this->representation_->destroy(); 314 this->representation_ = NULL;315 } 316 317 if (pickup != NULL)318 { 319 if (this->pickup_ != NULL)314 this->representation_ = nullptr; 315 } 316 317 if (pickup != nullptr) 318 { 319 if (this->pickup_ != nullptr) 320 320 this->pickup_->destroy(); 321 321 -
code/trunk/src/modules/pickup/PickupSpawner.h
r9667 r11071 82 82 static PickupSpawner* createDroppedPickup(Context* context, Pickupable* pickup, PickupCarrier* carrier, float triggerDistance = 10.0); 83 83 84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a PickupSpawner through XML.85 virtual void tick(float dt) ; //!< Tick, checks if any Pawn is close enough to trigger.84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a PickupSpawner through XML. 85 virtual void tick(float dt) override; //!< Tick, checks if any Pawn is close enough to trigger. 86 86 87 87 /** -
code/trunk/src/modules/pickup/items/BoostPickup.cc
r11052 r11071 106 106 107 107 SpaceShip* ship = this->carrierToSpaceShipHelper(); 108 if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.108 if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed. 109 109 this->Pickupable::destroy(); 110 110 … … 128 128 Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 129 129 @return 130 A pointer to the SpaceShip, or NULLif the conversion failed.130 A pointer to the SpaceShip, or nullptr if the conversion failed. 131 131 */ 132 132 SpaceShip* BoostPickup::carrierToSpaceShipHelper(void) … … 135 135 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 136 136 137 if(ship == NULL)137 if(ship == nullptr) 138 138 { 139 139 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in BoostPickup." << endl; -
code/trunk/src/modules/pickup/items/BoostPickup.h
r11052 r11071 52 52 virtual ~BoostPickup(); //!< Destructor. 53 53 54 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) ; //!< Method for creating a BoostPickup object through XML.54 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; //!< Method for creating a BoostPickup object through XML. 55 55 56 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.56 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 57 57 inline float getBoostRefill() 58 58 { return this->boostRefill_; } -
code/trunk/src/modules/pickup/items/DamageBoostPickup.cc
r9667 r11071 106 106 107 107 SpaceShip* ship = this->carrierToSpaceShipHelper(); 108 if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.108 if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed. 109 109 this->Pickupable::destroy(); 110 110 … … 152 152 Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 153 153 @return 154 A pointer to the SpaceShip, or NULLif the conversion failed.154 A pointer to the SpaceShip, or nullptr if the conversion failed. 155 155 */ 156 156 SpaceShip* DamageBoostPickup::carrierToSpaceShipHelper(void) … … 159 159 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 160 160 161 if(ship == NULL)161 if(ship == nullptr) 162 162 { 163 163 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DamageBoostPickup." << endl; -
code/trunk/src/modules/pickup/items/DronePickup.cc
r9667 r11071 74 74 { 75 75 this->addTarget(ClassIdentifier<Pawn>::getIdentifier()); 76 this->setDurationType( pickupDurationType::once);76 this->setDurationType(PickupDurationType::once); 77 77 this->droneTemplate_ = ""; 78 78 } … … 122 122 123 123 Pawn* pawn = this->carrierToPawnHelper(); 124 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.124 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 125 125 this->Pickupable::destroy(); 126 126 … … 131 131 Controller* controller = drone->getController(); 132 132 DroneController* droneController = orxonox_cast<DroneController*>(controller); 133 if(droneController != NULL)133 if(droneController != nullptr) 134 134 { 135 135 droneController->setOwner(pawn); … … 156 156 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 157 157 @return 158 A pointer to the Pawn, or NULLif the conversion failed.158 A pointer to the Pawn, or nullptr if the conversion failed. 159 159 */ 160 160 Pawn* DronePickup::carrierToPawnHelper(void) … … 163 163 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 164 164 165 if(pawn == NULL)165 if(pawn == nullptr) 166 166 { 167 167 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in DronePickup." << endl; -
code/trunk/src/modules/pickup/items/HealthPickup.cc
r9667 r11071 77 77 this->health_ = 0.0f; 78 78 this->healthRate_ = 0.0f; 79 this->healthType_ = pickupHealthType::limited;79 this->healthType_ = PickupHealthType::limited; 80 80 this->maxHealthSave_ = 0.0f; 81 81 this->maxHealthOverwrite_ = 0.0f; … … 114 114 { 115 115 Pawn* pawn = this->carrierToPawnHelper(); 116 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.116 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 117 117 this->Pickupable::destroy(); 118 118 … … 127 127 switch(this->getHealthType()) 128 128 { 129 case pickupHealthType::permanent:129 case PickupHealthType::permanent: 130 130 if(pawn->getMaxHealth() < fullHealth) 131 131 pawn->setMaxHealth(fullHealth); 132 case pickupHealthType::limited:132 case PickupHealthType::limited: 133 133 pawn->addHealth(health); 134 134 break; 135 case pickupHealthType::temporary:135 case PickupHealthType::temporary: 136 136 if(pawn->getMaxHealth() > fullHealth) 137 137 { … … 168 168 { 169 169 Pawn* pawn = this->carrierToPawnHelper(); 170 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.170 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 171 171 this->Pickupable::destroy(); 172 172 … … 174 174 switch(this->getHealthType()) 175 175 { 176 case pickupHealthType::permanent:176 case PickupHealthType::permanent: 177 177 health = pawn->getHealth()+this->getHealth(); 178 178 if(pawn->getMaxHealth() < health) 179 179 pawn->setMaxHealth(health); 180 case pickupHealthType::limited:180 case PickupHealthType::limited: 181 181 pawn->addHealth(this->getHealth()); 182 182 break; 183 case pickupHealthType::temporary:183 case PickupHealthType::temporary: 184 184 health = pawn->getHealth()+this->getHealth(); 185 185 if(pawn->getMaxHealth() < health) … … 201 201 else 202 202 { 203 if(this->getHealthType() == pickupHealthType::temporary)203 if(this->getHealthType() == PickupHealthType::temporary) 204 204 { 205 205 PickupCarrier* carrier = this->getCarrier(); 206 206 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 207 207 208 if(pawn == NULL)208 if(pawn == nullptr) 209 209 { 210 210 orxout(internal_error, context::pickups) << "Something went horribly wrong in Health Pickup. PickupCarrier is '" << carrier->getIdentifier()->getName() << "' instead of Pawn." << endl; … … 233 233 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 234 234 @return 235 A pointer to the Pawn, or NULLif the conversion failed.235 A pointer to the Pawn, or nullptr if the conversion failed. 236 236 */ 237 237 Pawn* HealthPickup::carrierToPawnHelper(void) … … 240 240 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 241 241 242 if(pawn == NULL)242 if(pawn == nullptr) 243 243 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in HealthPickup." << endl; 244 244 … … 256 256 switch(this->getHealthType()) 257 257 { 258 case pickupHealthType::limited:258 case PickupHealthType::limited: 259 259 return HealthPickup::healthTypeLimited_s; 260 case pickupHealthType::temporary:260 case PickupHealthType::temporary: 261 261 return HealthPickup::healthTypeTemporary_s; 262 case pickupHealthType::permanent:262 case PickupHealthType::permanent: 263 263 return HealthPickup::healthTypePermanent_s; 264 264 default: … … 308 308 { 309 309 if(type == HealthPickup::healthTypeLimited_s) 310 this->setHealthType( pickupHealthType::limited);310 this->setHealthType(PickupHealthType::limited); 311 311 else if(type == HealthPickup::healthTypeTemporary_s) 312 this->setHealthType( pickupHealthType::temporary);312 this->setHealthType(PickupHealthType::temporary); 313 313 else if(type == HealthPickup::healthTypePermanent_s) 314 this->setHealthType( pickupHealthType::permanent);314 this->setHealthType(PickupHealthType::permanent); 315 315 else 316 316 orxout(internal_error, context::pickups) << "Invalid healthType '" << type << "' in HealthPickup." << endl; -
code/trunk/src/modules/pickup/items/HealthPickup.h
r9667 r11071 51 51 @ingroup PickupItems 52 52 */ 53 namespace pickupHealthType53 enum class PickupHealthType 54 54 { 55 enum Value 56 { 57 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 58 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 59 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 60 }; 61 } 55 limited, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" only increases the users health to its maximum health. 56 temporary, //!< Means that the @ref orxonox::HealthPickup "HealthPickup" temporarily increases the users health even above its maximum health, but only as long as it is in use. 57 permanent //!< Means that the @ref orxonox::HealthPickup "HealthPickup" increases the users health even above its maximum health and increases the maximum health permanently such that it matches the new health. 58 }; 62 59 63 60 /** … … 115 112 @return Returns the health type as an enum. 116 113 */ 117 inline pickupHealthType::Value getHealthType(void) const114 inline PickupHealthType getHealthType(void) const 118 115 { return this->healthType_; } 119 116 const std::string& getHealthTypeAsString(void) const; //!< Get the health type of this pickup. … … 127 124 @param type The type of this pickup as an enum. 128 125 */ 129 inline void setHealthType( pickupHealthType::Value type)126 inline void setHealthType(PickupHealthType type) 130 127 { this->healthType_ = type; } 131 128 void setHealthTypeAsString(const std::string& type); //!< Set the type of the HealthPickup. … … 139 136 float maxHealthSave_; //!< Helper to remember what the actual maxHealth of the Pawn was before we changed it. 140 137 float maxHealthOverwrite_; //!< Helper to remember with which value we overwrote the maxHealh, to detect if someone else changed it as well. 141 pickupHealthType::Value healthType_; //!< The type of the HealthPickup.138 PickupHealthType healthType_; //!< The type of the HealthPickup. 142 139 143 140 //! Strings for the health types. -
code/trunk/src/modules/pickup/items/InvisiblePickup.cc
r9667 r11071 139 139 { 140 140 Pawn* pawn = this->carrierToPawnHelper(); 141 if(pawn == NULL)141 if(pawn == nullptr) 142 142 return false; 143 143 … … 163 163 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 164 164 @return 165 A pointer to the Pawn, or NULLif the conversion failed.165 A pointer to the Pawn, or nullptr if the conversion failed. 166 166 */ 167 167 Pawn* InvisiblePickup::carrierToPawnHelper(void) … … 170 170 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 171 171 172 if(pawn == NULL)172 if(pawn == nullptr) 173 173 { 174 174 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in InvisiblePickup." << endl; -
code/trunk/src/modules/pickup/items/MetaPickup.cc
r9667 r11071 79 79 this->addTarget(ClassIdentifier<PickupCarrier>::getIdentifier()); 80 80 81 this->setDurationType( pickupDurationType::once);82 this->metaType_ = pickupMetaType::none;81 this->setDurationType(PickupDurationType::once); 82 this->metaType_ = PickupMetaType::none; 83 83 } 84 84 … … 104 104 105 105 // If the MetaPickup transited to used, and the metaType is not none. 106 if(this->isUsed() && this->metaType_ != pickupMetaType::none)106 if(this->isUsed() && this->metaType_ != PickupMetaType::none) 107 107 { 108 108 PickupCarrier* carrier = this->getCarrier(); 109 if(this->getMetaType() != pickupMetaType::none && carrier != NULL)109 if(this->getMetaType() != PickupMetaType::none && carrier != nullptr) 110 110 { 111 111 // If the metaType is destroyCarrier, then the PickupCarrier is destroyed. 112 if(this->getMetaType() == pickupMetaType::destroyCarrier)112 if(this->getMetaType() == PickupMetaType::destroyCarrier) 113 113 { 114 114 Pawn* pawn = orxonox_cast<Pawn*>(carrier); … … 118 118 std::set<Pickupable*> pickups = carrier->getPickups(); 119 119 // Iterate over all Pickupables of the PickupCarrier. 120 for( std::set<Pickupable*>::iterator it = pickups.begin(); it != pickups.end(); it++)120 for(Pickupable* pickup : pickups) 121 121 { 122 Pickupable* pickup = (*it); 123 if(pickup == NULL || pickup == this) 122 if(pickup == nullptr || pickup == this) 124 123 continue; 125 124 126 125 // If the metaType is use, then the Pickupable is set to used. 127 if(this->getMetaType() == pickupMetaType::use && !pickup->isUsed())126 if(this->getMetaType() == PickupMetaType::use && !pickup->isUsed()) 128 127 { 129 128 pickup->setUsed(true); 130 129 } 131 130 // If the metaType is drop, then the Pickupable is dropped. 132 else if(this->getMetaType() == pickupMetaType::drop)131 else if(this->getMetaType() == PickupMetaType::drop) 133 132 { 134 133 pickup->drop(); 135 134 } 136 135 // If the metaType is destroy, then the Pickupable is destroyed. 137 else if(this->getMetaType() == pickupMetaType::destroy)136 else if(this->getMetaType() == PickupMetaType::destroy) 138 137 { 139 138 pickup->Pickupable::destroy(); … … 155 154 switch(this->getMetaType()) 156 155 { 157 case pickupMetaType::none:156 case PickupMetaType::none: 158 157 return MetaPickup::metaTypeNone_s; 159 case pickupMetaType::use:158 case PickupMetaType::use: 160 159 return MetaPickup::metaTypeUse_s; 161 case pickupMetaType::drop:160 case PickupMetaType::drop: 162 161 return MetaPickup::metaTypeDrop_s; 163 case pickupMetaType::destroy:162 case PickupMetaType::destroy: 164 163 return MetaPickup::metaTypeDestroy_s; 165 case pickupMetaType::destroyCarrier:164 case PickupMetaType::destroyCarrier: 166 165 return MetaPickup::metaTypeDestroyCarrier_s; 167 166 default: … … 180 179 if(type == MetaPickup::metaTypeNone_s) 181 180 { 182 this->setMetaType( pickupMetaType::none);181 this->setMetaType(PickupMetaType::none); 183 182 } 184 183 else if(type == MetaPickup::metaTypeUse_s) 185 184 { 186 this->setMetaType( pickupMetaType::use);185 this->setMetaType(PickupMetaType::use); 187 186 } 188 187 else if(type == MetaPickup::metaTypeDrop_s) 189 188 { 190 this->setMetaType( pickupMetaType::drop);189 this->setMetaType(PickupMetaType::drop); 191 190 } 192 191 else if(type == MetaPickup::metaTypeDestroy_s) 193 192 { 194 this->setMetaType( pickupMetaType::destroy);193 this->setMetaType(PickupMetaType::destroy); 195 194 } 196 195 else if(type == MetaPickup::metaTypeDestroyCarrier_s) 197 196 { 198 this->setMetaType( pickupMetaType::destroyCarrier);197 this->setMetaType(PickupMetaType::destroyCarrier); 199 198 } 200 199 else -
code/trunk/src/modules/pickup/items/MetaPickup.h
r9667 r11071 48 48 @ingroup PickupItems 49 49 */ 50 namespace pickupMetaType50 enum class PickupMetaType 51 51 { 52 enum Value 53 { 54 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 55 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 57 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 58 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 59 }; 60 } 52 none, //!< The @ref orxonox::MetaPickup "MetaPickup" does nothing. 53 use, //!< The @ref orxonox::MetaPickup "MetaPickup" uses all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 54 drop, //!< The @ref orxonox::MetaPickup "MetaPickup" drops all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 55 destroy, //!< The @ref orxonox::MetaPickup "MetaPickup" destroys all the @ref orxonox::PickupCarrier "PickupCarriers'" @ref orxonox::Pickupable "Pickupables". 56 destroyCarrier //!< The @ref orxonox::MetaPickup "MetaPickup" destroys the @ref orxonox::PickupCarrier "PickupCarrier". 57 }; 61 58 62 59 /** … … 100 97 @return Returns an enum with the meta type of the MetaPickup. 101 98 */ 102 inline pickupMetaType::Value getMetaType(void) const99 inline PickupMetaType getMetaType(void) const 103 100 { return this->metaType_; } 104 101 const std::string& getMetaTypeAsString(void) const; //!< Get the meta type of this MetaPickup. … … 109 106 @param type The meta type as an enum. 110 107 */ 111 inline void setMetaType( pickupMetaType::Value type)108 inline void setMetaType(PickupMetaType type) 112 109 { this->metaType_ = type; } 113 110 void setMetaTypeAsString(const std::string& type); //!< Set the meta type of this MetaPickup. … … 116 113 void initialize(void); //!< Initializes the member variables. 117 114 118 pickupMetaType::Value metaType_; //!< The meta type of the MetaPickup, determines which actions are taken.115 PickupMetaType metaType_; //!< The meta type of the MetaPickup, determines which actions are taken. 119 116 120 117 //! Static strings for the meta types. -
code/trunk/src/modules/pickup/items/MunitionContainer.h
r11052 r11071 53 53 virtual ~MunitionContainer(); 54 54 55 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) ;55 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; 56 56 57 57 inline const std::string& getMunitionName() const -
code/trunk/src/modules/pickup/items/MunitionPickup.cc
r11052 r11071 86 86 void MunitionPickup::addMunitionContainer(MunitionContainer* munitionContainer) 87 87 { 88 OrxAssert(munitionContainer != NULL, "The munitionContainer cannot be NULL.");88 OrxAssert(munitionContainer != nullptr, "The munitionContainer cannot be nullptr."); 89 89 this->munitionContainers_.push_back(munitionContainer); 90 90 } … … 93 93 { 94 94 if(this->munitionContainers_.size() >= index) 95 return NULL;95 return nullptr; 96 96 else 97 97 return this->munitionContainers_[index]; … … 108 108 Pawn* pawn = this->carrierToPawnHelper(); 109 109 110 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.110 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 111 111 this->Pickupable::destroy(); 112 112 … … 114 114 if(this->isUsed()) 115 115 { 116 for( std::vector<MunitionContainer*>::iterator it = this->munitionContainers_.begin(); it != this->munitionContainers_.end(); ++it)116 for(MunitionContainer* container : this->munitionContainers_) 117 117 { 118 118 //Get pointer to the appropriate munition 119 SubclassIdentifier<Munition> identifier = (*it)->getMunitionType();119 SubclassIdentifier<Munition> identifier = container->getMunitionType(); 120 120 Munition* munition = pawn->getMunition(&identifier); 121 121 if (munition) 122 122 { 123 123 // Add munition and magzines 124 munition->addMunition( (*it)->getMunitionAmount());125 munition->addMagazines( (*it)->getMagazinesAmount());124 munition->addMunition(container->getMunitionAmount()); 125 munition->addMagazines(container->getMagazinesAmount()); 126 126 } 127 (*it)->destroy();127 container->destroy(); 128 128 } 129 129 // This will destroy the pickp … … 140 140 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 141 141 @return 142 A pointer to the Pawn, or NULLif the conversion failed.142 A pointer to the Pawn, or nullptr if the conversion failed. 143 143 */ 144 144 Pawn* MunitionPickup::carrierToPawnHelper(void) … … 147 147 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 148 148 149 if(pawn == NULL)149 if(pawn == nullptr) 150 150 { 151 151 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in MunitionPickup." << endl; -
code/trunk/src/modules/pickup/items/MunitionPickup.h
r11052 r11071 59 59 virtual ~MunitionPickup(); //!< Destructor. 60 60 61 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) ; //!< Method for creating a MunitionPickup object through XML.61 virtual void XMLPort(Element& xmlelement, orxonox::XMLPort::Mode mode) override; //!< Method for creating a MunitionPickup object through XML. 62 62 63 virtual void changedUsed(void) ; //!< Is called when the pickup has transited from used to unused or the other way around.63 virtual void changedUsed(void) override; //!< Is called when the pickup has transited from used to unused or the other way around. 64 64 65 v irtual void addMunitionContainer(MunitionContainer* munitionContainer);65 void addMunitionContainer(MunitionContainer* munitionContainer); 66 66 MunitionContainer* getMunitionContainer(unsigned int index); 67 67 -
code/trunk/src/modules/pickup/items/ShieldPickup.cc
r9667 r11071 99 99 100 100 Pawn* pawn = this->carrierToPawnHelper(); 101 if(pawn == NULL)101 if(pawn == nullptr) 102 102 this->Pickupable::destroy(); 103 103 … … 143 143 Helper to transform the PickupCarrier to a Pawn, and throw an error message if the conversion fails. 144 144 @return 145 A pointer to the Pawn, or NULLif the conversion failed.145 A pointer to the Pawn, or nullptr if the conversion failed. 146 146 */ 147 147 Pawn* ShieldPickup::carrierToPawnHelper(void) … … 150 150 Pawn* pawn = orxonox_cast<Pawn*>(carrier); 151 151 152 if(pawn == NULL)152 if(pawn == nullptr) 153 153 { 154 154 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in ShieldPickup." << endl; -
code/trunk/src/modules/pickup/items/ShrinkPickup.cc
r10624 r11071 146 146 { 147 147 Pawn* pawn = this->carrierToPawnHelper(); 148 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.148 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 149 149 { 150 150 this->Pickupable::destroy(); … … 173 173 //TODO: Deploy particle effect. 174 174 Pawn* pawn = this->carrierToPawnHelper(); 175 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.175 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 176 176 return; 177 177 … … 182 182 183 183 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 184 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();184 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 185 185 int size = cameraPositions.size(); 186 186 for(int index = 0; index < size; index++) 187 187 { 188 188 CameraPosition* cameraPos = pawn->getCameraPosition(index); 189 if(cameraPos == NULL)189 if(cameraPos == nullptr) 190 190 continue; 191 191 cameraPos->setPosition(cameraPos->getPosition()/factor); … … 201 201 //TODO: Deploy particle effect. 202 202 Pawn* pawn = this->carrierToPawnHelper(); 203 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.203 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 204 204 return; 205 205 … … 208 208 209 209 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 210 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();210 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 211 211 int size = cameraPositions.size(); 212 212 for(int index = 0; index < size; index++) 213 213 { 214 214 CameraPosition* cameraPos = pawn->getCameraPosition(index); 215 if(cameraPos == NULL)215 if(cameraPos == nullptr) 216 216 continue; 217 217 cameraPos->setPosition(cameraPos->getPosition()/this->shrinkFactor_); … … 237 237 { 238 238 Pawn* pawn = this->carrierToPawnHelper(); 239 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.239 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 240 240 { 241 241 this->Pickupable::destroy(); … … 263 263 264 264 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 265 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();265 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 266 266 int size = cameraPositions.size(); 267 267 for(int index = 0; index < size; index++) 268 268 { 269 269 CameraPosition* cameraPos = pawn->getCameraPosition(index); 270 if(cameraPos == NULL)270 if(cameraPos == nullptr) 271 271 continue; 272 272 cameraPos->setPosition(cameraPos->getPosition()/factor); … … 277 277 { 278 278 Pawn* pawn = this->carrierToPawnHelper(); 279 if(pawn == NULL) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed.279 if(pawn == nullptr) // If the PickupCarrier is no Pawn, then this pickup is useless and therefore is destroyed. 280 280 this->Pickupable::destroy(); 281 281 … … 304 304 305 305 // Iterate over all camera positions and inversely move the camera to create a shrinking sensation. 306 const std::list< StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions();306 const std::list<StrongPtr<CameraPosition>>& cameraPositions = pawn->getCameraPositions(); 307 307 int size = cameraPositions.size(); 308 308 for(int index = 0; index < size; index++) 309 309 { 310 310 CameraPosition* cameraPos = pawn->getCameraPosition(index); 311 if(cameraPos == NULL)311 if(cameraPos == nullptr) 312 312 continue; 313 313 cameraPos->setPosition(cameraPos->getPosition()/factor); -
code/trunk/src/modules/pickup/items/SpeedPickup.cc
r9667 r11071 99 99 100 100 SpaceShip* ship = this->carrierToSpaceShipHelper(); 101 if(ship == NULL) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed.101 if(ship == nullptr) // If the PickupCarrier is no SpaceShip, then this pickup is useless and therefore is destroyed. 102 102 this->Pickupable::destroy(); 103 103 … … 143 143 Helper to transform the PickupCarrier to a SpaceShip, and throw an error message if the conversion fails. 144 144 @return 145 A pointer to the SpaceShip, or NULLif the conversion failed.145 A pointer to the SpaceShip, or nullptr if the conversion failed. 146 146 */ 147 147 SpaceShip* SpeedPickup::carrierToSpaceShipHelper(void) … … 150 150 SpaceShip* ship = orxonox_cast<SpaceShip*>(carrier); 151 151 152 if(ship == NULL)152 if(ship == nullptr) 153 153 { 154 154 orxout(internal_error, context::pickups) << "Invalid PickupCarrier in SpeedPickup." << endl; -
code/trunk/src/modules/pong/Pong.cc
r9939 r11071 64 64 RegisterObject(Pong); 65 65 66 this->center_ = 0;67 this->ball_ = 0;68 this->bat_[0] = 0;69 this->bat_[1] = 0;66 this->center_ = nullptr; 67 this->ball_ = nullptr; 68 this->bat_[0] = nullptr; 69 this->bat_[1] = nullptr; 70 70 71 71 this->setHUDTemplate("PongHUD"); … … 103 103 void Pong::cleanup() 104 104 { 105 if (this->ball_ != NULL) // Destroy the ball, if present.105 if (this->ball_ != nullptr) // Destroy the ball, if present. 106 106 { 107 107 this->ball_->destroy(); 108 this->ball_ = 0;108 this->ball_ = nullptr; 109 109 } 110 110 … … 112 112 for (size_t i = 0; i < 2; ++i) 113 113 { 114 if (this->bat_[0] != NULL)114 if (this->bat_[0] != nullptr) 115 115 { 116 116 this->bat_[0]->destroy(); 117 this->bat_[0] = 0;117 this->bat_[0] = nullptr; 118 118 } 119 119 } … … 127 127 void Pong::start() 128 128 { 129 if (this->center_ != NULL) // There needs to be a PongCenterpoint, i.e. the area the game takes place.130 { 131 if (this->ball_ == NULL) // If there is no ball, create a new ball.129 if (this->center_ != nullptr) // There needs to be a PongCenterpoint, i.e. the area the game takes place. 130 { 131 if (this->ball_ == nullptr) // If there is no ball, create a new ball. 132 132 { 133 133 this->ball_ = new PongBall(this->center_->getContext()); … … 145 145 146 146 // If one of the bats is missing, create it. Apply the template for the bats as specified in the centerpoint. 147 for ( size_t i = 0; i < 2; ++i)147 for (WeakPtr<orxonox::PongBat>& bat : this->bat_) 148 148 { 149 if ( this->bat_[i] == NULL)149 if (bat == nullptr) 150 150 { 151 this->bat_[i]= new PongBat(this->center_->getContext());152 this->bat_[i]->addTemplate(this->center_->getBattemplate());151 bat = new PongBat(this->center_->getContext()); 152 bat->addTemplate(this->center_->getBattemplate()); 153 153 } 154 154 } … … 211 211 { 212 212 // first spawn human players to assign always the left bat to the player in singleplayer 213 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)214 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))215 this->spawnPlayer( it->first);213 for (const auto& mapEntry : this->players_) 214 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 215 this->spawnPlayer(mapEntry.first); 216 216 // now spawn bots 217 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)218 if (! it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))219 this->spawnPlayer( it->first);217 for (const auto& mapEntry : this->players_) 218 if (!mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 219 this->spawnPlayer(mapEntry.first); 220 220 } 221 221 … … 231 231 232 232 // If the first (left) bat has no player. 233 if (this->bat_[0]->getPlayer() == NULL)233 if (this->bat_[0]->getPlayer() == nullptr) 234 234 { 235 235 player->startControl(this->bat_[0]); … … 237 237 } 238 238 // If the second (right) bat has no player. 239 else if (this->bat_[1]->getPlayer() == NULL)239 else if (this->bat_[1]->getPlayer() == nullptr) 240 240 { 241 241 player->startControl(this->bat_[1]); … … 247 247 248 248 // If the player is an AI, it receives a pointer to the ball. 249 if (player->getController() != NULL&& player->getController()->isA(Class(PongAI)))249 if (player->getController() != nullptr && player->getController()->isA(Class(PongAI))) 250 250 { 251 251 PongAI* ai = orxonox_cast<PongAI*>(player->getController()); … … 262 262 Deathmatch::playerScored(player, score); 263 263 264 if (this->center_ != NULL) // If there is a centerpoint.264 if (this->center_ != nullptr) // If there is a centerpoint. 265 265 { 266 266 // Fire an event for the player that has scored, to be able to react to it in the level, e.g. by displaying fireworks. … … 271 271 272 272 // Also announce, that the player has scored. 273 if (player != NULL)273 if (player != nullptr) 274 274 this->gtinfo_->sendAnnounceMessage(player->getName() + " scored"); 275 275 } 276 276 277 277 // If there is a ball present, reset its position, velocity and acceleration. 278 if (this->ball_ != NULL)278 if (this->ball_ != nullptr) 279 279 { 280 280 this->ball_->setPosition(Vector3::ZERO); … … 285 285 286 286 // If there are bats reset them to the middle position. 287 if (this->bat_[0] != NULL && this->bat_[1] != NULL)287 if (this->bat_[0] != nullptr && this->bat_[1] != nullptr) 288 288 { 289 289 this->bat_[0]->setPosition(-this->center_->getFieldDimension().x / 2, 0, 0); … … 292 292 293 293 // If a player gets enough points, he won the game -> end of game 294 PlayerInfo* winningPlayer = NULL;294 PlayerInfo* winningPlayer = nullptr; 295 295 if (this->getLeftPlayer() && this->getScore(this->getLeftPlayer()) >= scoreLimit_) 296 296 winningPlayer = this->getLeftPlayer(); … … 314 314 void Pong::startBall() 315 315 { 316 if (this->ball_ != NULL && this->center_ != NULL)316 if (this->ball_ != nullptr && this->center_ != nullptr) 317 317 this->ball_->setSpeed(this->center_->getBallSpeed()); 318 318 } … … 322 322 Get the left player. 323 323 @return 324 Returns a pointer to the player playing on the left. If there is no left player, NULLis returned.324 Returns a pointer to the player playing on the left. If there is no left player, nullptr is returned. 325 325 */ 326 326 PlayerInfo* Pong::getLeftPlayer() const 327 327 { 328 if (this->bat_ != NULL && this->bat_[0] != NULL)328 if (this->bat_ != nullptr && this->bat_[0] != nullptr) 329 329 return this->bat_[0]->getPlayer(); 330 330 else 331 return 0;331 return nullptr; 332 332 } 333 333 … … 336 336 Get the right player. 337 337 @return 338 Returns a pointer to the player playing on the right. If there is no right player, NULLis returned.338 Returns a pointer to the player playing on the right. If there is no right player, nullptr is returned. 339 339 */ 340 340 PlayerInfo* Pong::getRightPlayer() const 341 341 { 342 if (this->bat_ != NULL && this->bat_[1] != NULL)342 if (this->bat_ != nullptr && this->bat_[1] != nullptr) 343 343 return this->bat_[1]->getPlayer(); 344 344 else 345 return 0;345 return nullptr; 346 346 } 347 347 } -
code/trunk/src/modules/pong/Pong.h
r9667 r11071 68 68 virtual ~Pong(); //!< Destructor. Cleans up, if initialized. 69 69 70 virtual void start() ; //!< Starts the Pong minigame.71 virtual void end() ; ///!< Ends the Pong minigame.70 virtual void start() override; //!< Starts the Pong minigame. 71 virtual void end() override; ///!< Ends the Pong minigame. 72 72 73 virtual void spawnPlayer(PlayerInfo* player) ; //!< Spawns the input player.73 virtual void spawnPlayer(PlayerInfo* player) override; //!< Spawns the input player. 74 74 75 virtual void playerScored(PlayerInfo* player, int score = 1) ; //!< Is called when the player scored.75 virtual void playerScored(PlayerInfo* player, int score = 1) override; //!< Is called when the player scored. 76 76 77 77 /** … … 87 87 88 88 protected: 89 virtual void spawnPlayersIfRequested() ; //!< Spawns players, and fills the rest up with bots.89 virtual void spawnPlayersIfRequested() override; //!< Spawns players, and fills the rest up with bots. 90 90 91 91 void startBall(); //!< Starts the ball with some default speed. -
code/trunk/src/modules/pong/PongAI.cc
r11018 r11071 57 57 RegisterObject(PongAI); 58 58 59 this->ball_ = 0;59 this->ball_ = nullptr; 60 60 this->ballDirection_ = Vector2::ZERO; 61 61 this->ballEndPosition_ = 0; … … 77 77 PongAI::~PongAI() 78 78 { 79 for (std:: list<std::pair<Timer*, char> >::iterator it = this->reactionTimers_.begin(); it != this->reactionTimers_.end(); ++it)80 delete it->first;79 for (std::pair<Timer*, char>& pair : this->reactionTimers_) 80 delete pair.first; 81 81 } 82 82 … … 101 101 { 102 102 // If either the ball, or the controllable entity (i.e. the bat) don't exist (or aren't set). 103 if (this->ball_ == NULL || this->getControllableEntity() == NULL)103 if (this->ball_ == nullptr || this->getControllableEntity() == nullptr) 104 104 return; 105 105 … … 362 362 // Add a new Timer 363 363 Timer* timer = new Timer(delay, false, createExecutor(createFunctor(&PongAI::delayedMove, this))); 364 this->reactionTimers_. push_back(std::pair<Timer*, char>(timer, direction));364 this->reactionTimers_.emplace_back(timer, direction); 365 365 } 366 366 else -
code/trunk/src/modules/pong/PongAI.h
r9667 r11071 66 66 void setConfigValues(); 67 67 68 virtual void tick(float dt) ; //!< Implements the behavior of the PongAI (i.e. its intelligence).68 virtual void tick(float dt) override; //!< Implements the behavior of the PongAI (i.e. its intelligence). 69 69 70 70 /** … … 89 89 float strength_; //!< The strength of the AI. Ranging from 0 to 1. 90 90 91 std::list<std::pair<Timer*, char> 91 std::list<std::pair<Timer*, char>> reactionTimers_; //!< A list of reaction timers and the directions that take effect when their timer expires. 92 92 char movement_; //!< The planned movement. 93 93 char oldMove_; //!< The previous movement. -
code/trunk/src/modules/pong/PongBall.cc
r9945 r11071 61 61 this->speed_ = 0; 62 62 this->accelerationFactor_ = 1.0f; 63 this->bat_ = 0;63 this->bat_ = nullptr; 64 64 this->bDeleteBats_ = false; 65 65 this->batID_ = new unsigned int[2]; … … 82 82 else 83 83 { 84 this->defScoreSound_ = 0;85 this->defBatSound_ = 0;86 this->defBoundarySound_ = 0;84 this->defScoreSound_ = nullptr; 85 this->defBatSound_ = nullptr; 86 this->defBoundarySound_ = nullptr; 87 87 } 88 88 } … … 163 163 float distance = 0; 164 164 165 if (this->bat_ != NULL) // If there are bats.165 if (this->bat_ != nullptr) // If there are bats. 166 166 { 167 167 // If the right boundary has been crossed. 168 if (position.x > this->fieldWidth_ / 2 && this->bat_[1] != NULL)168 if (position.x > this->fieldWidth_ / 2 && this->bat_[1] != nullptr) 169 169 { 170 170 // Calculate the distance (in z-direction) between the ball and the center of the bat, weighted by half of the effective length of the bat (with additional 10%) … … 195 195 } 196 196 // If the left boundary has been crossed. 197 else if (position.x < -this->fieldWidth_ / 2 && this->bat_[0] != NULL)197 else if (position.x < -this->fieldWidth_ / 2 && this->bat_[0] != nullptr) 198 198 { 199 199 // Calculate the distance (in z-direction) between the ball and the center of the bat, weighted by half of the effective length of the bat (with additional 10%) … … 285 285 { 286 286 // Make space for the bats, if they don't exist, yet. 287 if (this->bat_ == NULL)287 if (this->bat_ == nullptr) 288 288 { 289 289 this->bat_ = new WeakPtr<PongBat>[2]; -
code/trunk/src/modules/pong/PongBall.h
r9939 r11071 63 63 virtual ~PongBall(); 64 64 65 virtual void tick(float dt) ;65 virtual void tick(float dt) override; 66 66 67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 68 68 69 69 /** -
code/trunk/src/modules/pong/PongBat.h
r9667 r11071 60 60 virtual ~PongBat() {} 61 61 62 virtual void tick(float dt) ;62 virtual void tick(float dt) override; 63 63 64 virtual void moveFrontBack(const Vector2& value) ; //!< Overloaded the function to steer the bat up and down.65 virtual void moveRightLeft(const Vector2& value) ; //!< Overloaded the function to steer the bat up and down.64 virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 65 virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 66 66 67 virtual void changedPlayer() ; //!< Is called when the player changed.67 virtual void changedPlayer() override; //!< Is called when the player changed. 68 68 69 69 /** -
code/trunk/src/modules/pong/PongCenterpoint.cc
r10624 r11071 84 84 void PongCenterpoint::checkGametype() 85 85 { 86 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Pong)))86 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Pong))) 87 87 { 88 88 Pong* pongGametype = orxonox_cast<Pong*>(this->getGametype()); -
code/trunk/src/modules/pong/PongCenterpoint.h
r10624 r11071 124 124 virtual ~PongCenterpoint() {} 125 125 126 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method to create a PongCenterpoint through XML.126 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a PongCenterpoint through XML. 127 127 128 128 /** -
code/trunk/src/modules/pong/PongScore.cc
r10624 r11071 55 55 RegisterObject(PongScore); 56 56 57 this->owner_ = 0;57 this->owner_ = nullptr; 58 58 59 59 this->bShowName_ = false; … … 97 97 98 98 // If the owner is set. The owner being a Pong game. 99 if (this->owner_ != NULL)99 if (this->owner_ != nullptr) 100 100 { 101 101 if (!this->owner_->hasEnded()) … … 113 113 114 114 // Save the name and score of each player as a string. 115 if (player1_ != NULL)115 if (player1_ != nullptr) 116 116 { 117 117 name1 = player1_->getName(); 118 118 score1 = multi_cast<std::string>(this->owner_->getScore(player1_)); 119 119 } 120 if (player2_ != NULL)120 if (player2_ != nullptr) 121 121 { 122 122 name2 = player2_->getName(); … … 128 128 if (this->bShowLeftPlayer_) 129 129 { 130 if (this->bShowName_ && this->bShowScore_ && player1_ != NULL)130 if (this->bShowName_ && this->bShowScore_ && player1_ != nullptr) 131 131 output1 = name1 + " - " + score1; 132 132 else if (this->bShowScore_) … … 139 139 if (this->bShowRightPlayer_) 140 140 { 141 if (this->bShowName_ && this->bShowScore_ && player2_ != NULL)141 if (this->bShowName_ && this->bShowScore_ && player2_ != nullptr) 142 142 output2 = score2 + " - " + name2; 143 143 else if (this->bShowScore_) … … 163 163 @brief 164 164 Is called when the owner changes. 165 Sets the owner to NULL, if it is not a pointer to a Pong game.165 Sets the owner to nullptr, if it is not a pointer to a Pong game. 166 166 */ 167 167 void PongScore::changedOwner() … … 169 169 SUPER(PongScore, changedOwner); 170 170 171 if (this->getOwner() != NULL&& this->getOwner()->getGametype())171 if (this->getOwner() != nullptr && this->getOwner()->getGametype()) 172 172 this->owner_ = orxonox_cast<Pong*>(this->getOwner()->getGametype()); 173 173 else 174 this->owner_ = 0;174 this->owner_ = nullptr; 175 175 } 176 176 } -
code/trunk/src/modules/pong/PongScore.h
r9939 r11071 60 60 virtual ~PongScore(); 61 61 62 virtual void tick(float dt) ; //!< Creates and sets the caption to be displayed by the PongScore.63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;64 virtual void changedOwner() ; //!< Is called when the owner changes.62 virtual void tick(float dt) override; //!< Creates and sets the caption to be displayed by the PongScore. 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 64 virtual void changedOwner() override; //!< Is called when the owner changes. 65 65 66 66 /** -
code/trunk/src/modules/portals/PortalEndPoint.cc
r11022 r11071 48 48 std::map<unsigned int, PortalEndPoint *> PortalEndPoint::idMap_s; 49 49 50 PortalEndPoint::PortalEndPoint(Context* context) : StaticEntity(context), RadarViewable(this, static_cast<WorldEntity*>(this)), id_(0), trigger_( NULL), reenterDelay_(0)50 PortalEndPoint::PortalEndPoint(Context* context) : StaticEntity(context), RadarViewable(this, static_cast<WorldEntity*>(this)), id_(0), trigger_(nullptr), reenterDelay_(0) 51 51 { 52 52 RegisterObject(PortalEndPoint); … … 57 57 58 58 this->setRadarObjectColour(ColourValue::White); 59 this->setRadarObjectShape(RadarViewable:: Dot);59 this->setRadarObjectShape(RadarViewable::Shape::Dot); 60 60 this->setRadarVisibility(true); 61 61 if( GameMode::isMaster() ) … … 72 72 { 73 73 if (this->isInitialized()) { 74 if (this->trigger_ != NULL)74 if (this->trigger_ != nullptr) 75 75 this->trigger_->destroy(); 76 76 77 if (this->portalSound_ != NULL)77 if (this->portalSound_ != nullptr) 78 78 this->portalSound_->destroy(); 79 79 } … … 112 112 113 113 MultiTriggerContainer * cont = orxonox_cast<MultiTriggerContainer *>(trigger); 114 if(cont == 0)114 if(cont == nullptr) 115 115 return true; 116 116 117 117 DistanceMultiTrigger * originatingTrigger = orxonox_cast<DistanceMultiTrigger *>(cont->getOriginator()); 118 if(originatingTrigger == 0)118 if(originatingTrigger == nullptr) 119 119 { 120 120 return true; … … 122 122 123 123 MobileEntity * entity = orxonox_cast<MobileEntity *>(cont->getData()); 124 if(entity == 0)124 if(entity == nullptr) 125 125 return true; 126 126 -
code/trunk/src/modules/portals/PortalEndPoint.h
r9667 r11071 63 63 virtual ~PortalEndPoint(); 64 64 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;66 virtual void changedActivity(void) ;65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 66 virtual void changedActivity(void) override; 67 67 68 68 inline void setTarget(const std::string & target) //!< add types which are allowed to activate the PortalEndPoint 69 69 { this->trigger_->addTarget(target); } 70 70 71 v oid XMLEventPort(Element& xmlelement, XMLPort::Mode mode);71 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 72 72 static std::map<unsigned int, PortalEndPoint *> idMap_s; //!< Maps the id of each PortalEndPoint to a pointer to that PortalEndPoint 73 73 inline void setReenterDelay(unsigned int seconds) -
code/trunk/src/modules/portals/PortalLink.cc
r9667 r11071 40 40 std::map<PortalEndPoint *, PortalEndPoint *> PortalLink::links_s; 41 41 42 PortalLink::PortalLink(Context* context) : BaseObject(context), fromID_(0), toID_(0), from_( 0), to_(0)42 PortalLink::PortalLink(Context* context) : BaseObject(context), fromID_(0), toID_(0), from_(nullptr), to_(nullptr) 43 43 { 44 44 RegisterObject(PortalLink); … … 67 67 void PortalLink::use(MobileEntity* entity, PortalEndPoint * entrance) 68 68 { 69 if(entrance == 0)69 if(entrance == nullptr) 70 70 return; 71 71 -
code/trunk/src/modules/portals/PortalLink.h
r9667 r11071 56 56 PortalLink(Context* context); 57 57 virtual ~PortalLink(); 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 59 59 60 60 inline void setFromID(unsigned int from) //!< set the ID of the PortalEndPoint which should act as the entrance of this link -
code/trunk/src/modules/questsystem/GlobalQuest.cc
r9667 r11071 94 94 95 95 // Iterate through all players possessing this Quest. 96 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)97 QuestEffect::invokeEffects( *it, this->getFailEffectList());96 for(PlayerInfo* questPlayer : players_) 97 QuestEffect::invokeEffects(questPlayer, this->getFailEffectList()); 98 98 99 99 return true; … … 119 119 120 120 // Iterate through all players possessing the Quest. 121 for( std::set<PlayerInfo*>::const_iterator it = players_.begin(); it != players_.end(); it++)122 QuestEffect::invokeEffects( *it, this->getCompleteEffectList());121 for(PlayerInfo* questPlayer : players_) 122 QuestEffect::invokeEffects(questPlayer, this->getCompleteEffectList()); 123 123 124 124 Quest::complete(player); … … 138 138 bool GlobalQuest::isStartable(const PlayerInfo* player) const 139 139 { 140 if(!(this->getParentQuest() == NULL|| this->getParentQuest()->isActive(player)))140 if(!(this->getParentQuest() == nullptr || this->getParentQuest()->isActive(player))) 141 141 return false; 142 142 … … 177 177 The player. 178 178 */ 179 QuestStatus ::ValueGlobalQuest::getStatus(const PlayerInfo* player) const179 QuestStatus GlobalQuest::getStatus(const PlayerInfo* player) const 180 180 { 181 181 assert(player); … … 198 198 The status to be set. 199 199 @return 200 Returns false if player is NULL.201 */ 202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus ::Value& status)200 Returns false if player is nullptr. 201 */ 202 bool GlobalQuest::setStatus(PlayerInfo* player, const QuestStatus & status) 203 203 { 204 204 assert(player); … … 242 242 { 243 243 int i = index; 244 for ( std::list<QuestEffect*>::const_iterator effect = this->rewards_.begin(); effect != this->rewards_.end(); ++effect)244 for (QuestEffect* reward : this->rewards_) 245 245 { 246 246 if(i == 0) 247 return *effect;247 return reward; 248 248 249 249 i--; 250 250 } 251 return NULL;251 return nullptr; 252 252 } 253 253 -
code/trunk/src/modules/questsystem/GlobalQuest.h
r9667 r11071 93 93 virtual ~GlobalQuest(); 94 94 95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a GlobalQuest object through XML.95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a GlobalQuest object through XML. 96 96 97 virtual bool fail(PlayerInfo* player) ; //!< Fails the Quest.98 virtual bool complete(PlayerInfo* player) ; //!< Completes the Quest.97 virtual bool fail(PlayerInfo* player) override; //!< Fails the Quest. 98 virtual bool complete(PlayerInfo* player) override; //!< Completes the Quest. 99 99 100 100 protected: 101 virtual bool isStartable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be started.102 virtual bool isFailable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be failed.103 virtual bool isCompletable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be completed.101 virtual bool isStartable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be started. 102 virtual bool isFailable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be failed. 103 virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed. 104 104 105 virtual QuestStatus ::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.105 virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player. 106 106 107 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value & status); //!< Sets the status for a specific player.107 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player. 108 108 109 109 private: 110 110 std::set<PlayerInfo*> players_; //!< The set of players which possess this Quest. 111 QuestStatus ::Valuestatus_; //!< The status of this Quest.111 QuestStatus status_; //!< The status of this Quest. 112 112 std::list<QuestEffect*> rewards_; //!< Reward QuestEffects only invoked on the player completing the Quest. 113 113 -
code/trunk/src/modules/questsystem/LocalQuest.cc
r9667 r11071 128 128 bool LocalQuest::isStartable(const PlayerInfo* player) const 129 129 { 130 if(!(this->getParentQuest() == NULL|| this->getParentQuest()->isActive(player)))130 if(!(this->getParentQuest() == nullptr || this->getParentQuest()->isActive(player))) 131 131 return false; 132 132 … … 168 168 Returns the status of the Quest for the input player. 169 169 */ 170 QuestStatus ::ValueLocalQuest::getStatus(const PlayerInfo* player) const170 QuestStatus LocalQuest::getStatus(const PlayerInfo* player) const 171 171 { 172 172 assert(player); 173 173 174 std::map<const PlayerInfo*, QuestStatus ::Value>::const_iterator it = this->playerStatus_.find(player);174 std::map<const PlayerInfo*, QuestStatus>::const_iterator it = this->playerStatus_.find(player); 175 175 if (it != this->playerStatus_.end()) // If there is a player in the map. 176 176 return it->second; … … 188 188 The status to be set. 189 189 @return 190 Returns false if player is NULL.191 */ 192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus ::Value& status)190 Returns false if player is nullptr. 191 */ 192 bool LocalQuest::setStatus(PlayerInfo* player, const QuestStatus & status) 193 193 { 194 194 assert(player); -
code/trunk/src/modules/questsystem/LocalQuest.h
r9667 r11071 87 87 virtual ~LocalQuest(); 88 88 89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a LocalQuest object through XML.89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a LocalQuest object through XML. 90 90 91 virtual bool fail(PlayerInfo* player) ; //!< Fails the Quest.92 virtual bool complete(PlayerInfo* player) ; //!< Completes the Quest.91 virtual bool fail(PlayerInfo* player) override; //!< Fails the Quest. 92 virtual bool complete(PlayerInfo* player) override; //!< Completes the Quest. 93 93 94 94 protected: 95 virtual bool isStartable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be started.96 virtual bool isFailable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be failed.97 virtual bool isCompletable(const PlayerInfo* player) const ; //!< Checks whether the Quest can be completed.95 virtual bool isStartable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be started. 96 virtual bool isFailable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be failed. 97 virtual bool isCompletable(const PlayerInfo* player) const override; //!< Checks whether the Quest can be completed. 98 98 99 virtual QuestStatus ::Value getStatus(const PlayerInfo* player) const; //!< Returns the status of the Quest for a specific player.100 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value & status); //!< Sets the status for a specific player.99 virtual QuestStatus getStatus(const PlayerInfo* player) const override; //!< Returns the status of the Quest for a specific player. 100 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) override; //!< Sets the status for a specific player. 101 101 102 102 private: 103 std::map<const PlayerInfo*, QuestStatus ::Value> playerStatus_; //!< List of the status for each player, with the Player-pointer as key.103 std::map<const PlayerInfo*, QuestStatus> playerStatus_; //!< List of the status for each player, with the Player-pointer as key. 104 104 105 105 }; -
code/trunk/src/modules/questsystem/Quest.cc
r10624 r11071 55 55 RegisterObject(Quest); 56 56 57 this->parentQuest_ = NULL;57 this->parentQuest_ = nullptr; 58 58 } 59 59 … … 183 183 The index. 184 184 @return 185 Returns a pointer to the sub-quest at the given index. NULLif there is no element at the given index.185 Returns a pointer to the sub-quest at the given index. nullptr if there is no element at the given index. 186 186 */ 187 187 const Quest* Quest::getSubQuest(unsigned int index) const … … 190 190 191 191 // Iterate through all subquests. 192 for ( std::list<Quest*>::const_iterator subQuest = this->subQuests_.begin(); subQuest != this->subQuests_.end(); ++subQuest)192 for (Quest* quest : this->subQuests_) 193 193 { 194 194 if(i == 0) // We're counting down... 195 return *subQuest;195 return quest; 196 196 197 197 i--; 198 198 } 199 199 200 return NULL; // If the index is greater than the number of elements in the list.200 return nullptr; // If the index is greater than the number of elements in the list. 201 201 } 202 202 … … 207 207 The index. 208 208 @return 209 Returns a pointer to the QuestHint at the given index. NULLif there is no element at the given index.209 Returns a pointer to the QuestHint at the given index. nullptr if there is no element at the given index. 210 210 */ 211 211 const QuestHint* Quest::getHint(unsigned int index) const … … 214 214 215 215 // Iterate through all QuestHints. 216 for ( std::list<QuestHint*>::const_iterator hint = this->hints_.begin(); hint != this->hints_.end(); ++hint)216 for (QuestHint* hint : this->hints_) 217 217 { 218 218 if(i == 0) // We're counting down... 219 return *hint;219 return hint; 220 220 221 221 i--; 222 222 } 223 return NULL; // If the index is greater than the number of elements in the list.223 return nullptr; // If the index is greater than the number of elements in the list. 224 224 } 225 225 … … 230 230 The index. 231 231 @return 232 Returns a pointer to the fail QuestEffect at the given index. NULLif there is no element at the given index.232 Returns a pointer to the fail QuestEffect at the given index. nullptr if there is no element at the given index. 233 233 */ 234 234 const QuestEffect* Quest::getFailEffect(unsigned int index) const … … 237 237 238 238 // Iterate through all fail QuestEffects. 239 for ( std::list<QuestEffect*>::const_iterator effect = this->failEffects_.begin(); effect != this->failEffects_.end(); ++effect)239 for (QuestEffect* effect : this->failEffects_) 240 240 { 241 241 if(i == 0) // We're counting down... 242 return *effect;242 return effect; 243 243 244 244 i--; 245 245 } 246 return NULL; // If the index is greater than the number of elements in the list.246 return nullptr; // If the index is greater than the number of elements in the list. 247 247 } 248 248 … … 253 253 The index. 254 254 @return 255 Returns a pointer to the complete QuestEffect at the given index. NULLif there is no element at the given index.255 Returns a pointer to the complete QuestEffect at the given index. nullptr if there is no element at the given index. 256 256 */ 257 257 const QuestEffect* Quest::getCompleteEffect(unsigned int index) const … … 260 260 261 261 // Iterate through all complete QuestEffects. 262 for ( std::list<QuestEffect*>::const_iterator effect = this->completeEffects_.begin(); effect != this->completeEffects_.end(); ++effect)262 for (QuestEffect* effect : this->completeEffects_) 263 263 { 264 264 if(i == 0) // We're counting down... 265 return *effect;265 return effect; 266 266 267 267 i--; 268 268 } 269 return NULL; // If the index is greater than the number of elements in the list.269 return nullptr; // If the index is greater than the number of elements in the list. 270 270 } 271 271 … … 280 280 bool Quest::isInactive(const PlayerInfo* player) const 281 281 { 282 if(player == NULL)282 if(player == nullptr) 283 283 return true; 284 284 return this->getStatus(player) == QuestStatus::Inactive; … … 295 295 bool Quest::isActive(const PlayerInfo* player) const 296 296 { 297 if(player == NULL)297 if(player == nullptr) 298 298 return false; 299 299 return this->getStatus(player) == QuestStatus::Active; … … 310 310 bool Quest::isFailed(const PlayerInfo* player) const 311 311 { 312 if(player == NULL)312 if(player == nullptr) 313 313 return false; 314 314 return this->getStatus(player) == QuestStatus::Failed; … … 325 325 bool Quest::isCompleted(const PlayerInfo* player) const 326 326 { 327 if(player == NULL)327 if(player == nullptr) 328 328 return false; 329 329 return this->getStatus(player) == QuestStatus::Completed; -
code/trunk/src/modules/questsystem/Quest.h
r9667 r11071 51 51 @ingroup Questsystem 52 52 */ 53 namespaceQuestStatus53 enum class QuestStatus 54 54 { 55 enum Value 56 { 57 Inactive, //!< The @ref orxonox::Quest "Quest" is inactive. 58 Active, //!< The @ref orxonox::Quest "Quest" is active. 59 Failed, //!< The @ref orxonox::Quest "Quest" has been failed. 60 Completed //!< The @ref orxonox::Quest "Quest" has been completed. 61 }; 62 } 55 Inactive, //!< The @ref orxonox::Quest "Quest" is inactive. 56 Active, //!< The @ref orxonox::Quest "Quest" is active. 57 Failed, //!< The @ref orxonox::Quest "Quest" has been failed. 58 Completed //!< The @ref orxonox::Quest "Quest" has been completed. 59 }; 63 60 64 61 /** … … 85 82 virtual ~Quest(); 86 83 87 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a Quest object through XML.84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Quest object through XML. 88 85 89 86 /** … … 143 140 { return this->completeEffects_; } 144 141 145 virtual QuestStatus ::ValuegetStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player.146 virtual bool setStatus(PlayerInfo* player, const QuestStatus ::Value& status) = 0; //!< Changes the status for a specific player.142 virtual QuestStatus getStatus(const PlayerInfo* player) const = 0; //!< Returns the status of the Quest for a specific player. 143 virtual bool setStatus(PlayerInfo* player, const QuestStatus & status) = 0; //!< Changes the status for a specific player. 147 144 148 145 private: -
code/trunk/src/modules/questsystem/QuestDescription.cc
r9667 r11071 119 119 } 120 120 121 NotificationListener::sendNotification(message, QuestDescription::SENDER, notificationMessageType::info, notificationSendMode::network, player->getClientID());121 NotificationListener::sendNotification(message, QuestDescription::SENDER, NotificationMessageType::info, NotificationSendMode::network, player->getClientID()); 122 122 return true; 123 123 } -
code/trunk/src/modules/questsystem/QuestDescription.h
r9667 r11071 67 67 virtual ~QuestDescription(); 68 68 69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestDescription object through XML.69 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestDescription object through XML. 70 70 71 71 // tolua_begin -
code/trunk/src/modules/questsystem/QuestEffect.cc
r10624 r11071 74 74 orxout(verbose, context::quests) << "Invoking QuestEffects on player: " << player << " ." << endl; 75 75 76 for ( std::list<QuestEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)77 temp = temp && (*effect)->invoke(player);76 for (QuestEffect* effect : effects) 77 temp = temp && effect->invoke(player); 78 78 79 79 return temp; -
code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
r9667 r11071 113 113 114 114 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 115 PlayerInfo* player = NULL;115 PlayerInfo* player = nullptr; 116 116 117 117 // If the trigger is a PlayerTrigger. 118 if(pTrigger != NULL)118 if(pTrigger != nullptr) 119 119 { 120 120 if(!pTrigger->isForPlayer()) // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 126 126 return false; 127 127 128 if(player == NULL)128 if(player == nullptr) 129 129 { 130 130 orxout(verbose, context::quests) << "The QuestEffectBeacon was triggered by an entity other than a Pawn. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 236 236 { 237 237 int i = index; 238 for ( std::list<QuestEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)238 for (QuestEffect* effect : this->effects_) 239 239 { 240 240 if(i == 0) 241 return *effect;241 return effect; 242 242 243 243 i--; 244 244 } 245 return NULL;245 return nullptr; 246 246 } 247 247 -
code/trunk/src/modules/questsystem/QuestEffectBeacon.h
r9667 r11071 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestEffectBeaconStatus52 enum class QuestEffectBeaconStatus 53 53 { 54 enum Value 55 { 56 Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive. 57 Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active. 58 }; 59 } 54 Inactive, //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is inactive. 55 Active //!< The @ref orxonox::QuestEffectBeacon "QuestEffectBeacon" is active. 56 }; 60 57 61 58 /** … … 96 93 virtual ~QuestEffectBeacon(); 97 94 98 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestEffectBeacon object through XML.99 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;95 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestEffectBeacon object through XML. 96 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 100 97 101 98 bool execute(bool bTriggered, BaseObject* trigger); //!< Executes the QuestEffects of the QuestEffectBeacon. … … 125 122 std::list<QuestEffect*> effects_; //!< The list of QuestEffects to be invoked on the executing player. 126 123 int times_; //!< Number of times the beacon can be exectued. 127 QuestEffectBeaconStatus ::Valuestatus_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive.124 QuestEffectBeaconStatus status_; //!< The status of the QuestEffectBeacon, Can be eighter active or inactive. 128 125 129 126 bool setTimes(const int & n); //!< Set the number of times the QuestEffectBeacon can be executed. -
code/trunk/src/modules/questsystem/QuestHint.cc
r9667 r11071 88 88 bool QuestHint::isActive(const PlayerInfo* player) const 89 89 { 90 if(player == NULL) // If the player is NULL, the Quest obviously can't be active.90 if(player == nullptr) // If the player is nullptr, the Quest obviously can't be active. 91 91 return false; 92 92 93 93 // Find the player. 94 std::map<const PlayerInfo*, QuestHintStatus ::Value>::const_iterator it = this->playerStatus_.find(player);94 std::map<const PlayerInfo*, QuestHintStatus>::const_iterator it = this->playerStatus_.find(player); 95 95 if (it != this->playerStatus_.end()) // If the player is in the map. 96 return it->second;96 return (it->second == QuestHintStatus::Active); 97 97 98 return QuestStatus::Inactive;98 return false; 99 99 } 100 100 -
code/trunk/src/modules/questsystem/QuestHint.h
r9667 r11071 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestHintStatus52 enum class QuestHintStatus 53 53 { 54 enum Value 55 { 56 Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive. 57 Active //!< The @ref orxonox::QuestHint "QuestHint" is active. 58 }; 59 } 54 Inactive, //!< The @ref orxonox::QuestHint "QuestHint" is inactive. 55 Active //!< The @ref orxonox::QuestHint "QuestHint" is active. 56 }; 60 57 61 58 /** … … 85 82 virtual ~QuestHint(); 86 83 87 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestHint object through XML.84 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestHint object through XML. 88 85 89 86 bool isActive(const PlayerInfo* player) const; //!< Returns true if the QuestHint is active for the input player. … … 101 98 private: 102 99 Quest* quest_; //!< The Quest the QuestHint belongs to. 103 std::map<const PlayerInfo*, QuestHintStatus ::Value> playerStatus_; //!< List of the states for each player, with the Player-pointer as key.100 std::map<const PlayerInfo*, QuestHintStatus> playerStatus_; //!< List of the states for each player, with the Player-pointer as key. 104 101 105 102 }; // tolua_export -
code/trunk/src/modules/questsystem/QuestItem.h
r9667 r11071 63 63 virtual ~QuestItem(); 64 64 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestItem object through XML.65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestItem object through XML. 66 66 67 67 /** -
code/trunk/src/modules/questsystem/QuestListener.cc
r9667 r11071 59 59 60 60 this->mode_ = QuestListenerMode::All; 61 this->quest_ = NULL;61 this->quest_ = nullptr; 62 62 } 63 63 … … 81 81 XMLPortParam(QuestListener, "mode", setMode, getMode, xmlelement, mode); 82 82 83 if(this->quest_ != NULL)83 if(this->quest_ != nullptr) 84 84 this->quest_->addListener(this); // Adds the QuestListener to the Quests list of listeners. 85 85 … … 97 97 /* static */ void QuestListener::advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status) 98 98 { 99 for (std::list<QuestListener*>::iterator it = listeners.begin(); it != listeners.end(); ++it) // Iterate through all QuestListeners 100 { 101 QuestListener* listener = *it; 99 for (QuestListener* listener : listeners) // Iterate through all QuestListeners 100 { 102 101 if(listener->getMode() == status || listener->getMode() == QuestListener::ALL) // Check whether the status change affects the give QuestListener. 103 102 listener->execute(); … … 117 116 this->quest_ = QuestManager::getInstance().findQuest(id); // Find the Quest corresponding to the given questId. 118 117 119 if(this->quest_ == NULL) // If there is no such Quest.118 if(this->quest_ == nullptr) // If there is no such Quest. 120 119 { 121 120 ThrowException(Argument, "This is bad! The QuestListener has not found a Quest with a corresponding id.."); -
code/trunk/src/modules/questsystem/QuestListener.h
r9667 r11071 50 50 @ingroup Questsystem 51 51 */ 52 namespaceQuestListenerMode52 enum class QuestListenerMode 53 53 { 54 enum Value 55 { 56 All, //!< Listens to all events. 57 Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests". 58 Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests". 59 Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests". 60 }; 61 } 54 All, //!< Listens to all events. 55 Start, //!< Only listens to events pertaining the starting of @ref orxonox::Quest "Quests". 56 Fail, //!< Only listens to events pertaining the failing of @ref orxonox::Quest "Quests". 57 Complete //!< Only listens to events pertaining the completing of @ref orxonox::Quest "Quests". 58 }; 62 59 63 60 /** … … 90 87 virtual ~QuestListener(); 91 88 92 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a QuestListener object through XML.89 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a QuestListener object through XML. 93 90 94 91 static void advertiseStatusChange(std::list<QuestListener*> & listeners, const std::string & status); //!< Makes all QuestListener in the list aware that a certain status change has occured. … … 103 100 104 101 private: 105 QuestListenerMode ::Valuemode_; //!< The mode of the QuestListener.102 QuestListenerMode mode_; //!< The mode of the QuestListener. 106 103 Quest* quest_; //!< A pointer to the Quest the QuestListener is reacting to. 107 104 -
code/trunk/src/modules/questsystem/QuestManager.cc
r10624 r11071 93 93 bool QuestManager::registerQuest(Quest* quest) 94 94 { 95 if(quest == NULL)96 { 97 orxout(internal_error, context::quests) << "Quest pointer is NULL." << endl;95 if(quest == nullptr) 96 { 97 orxout(internal_error, context::quests) << "Quest pointer is nullptr." << endl; 98 98 return false; 99 99 } … … 135 135 bool QuestManager::registerHint(QuestHint* hint) 136 136 { 137 if(hint == NULL)138 { 139 orxout(internal_error, context::quests) << "Quest pointer is NULL." << endl;137 if(hint == nullptr) 138 { 139 orxout(internal_error, context::quests) << "Quest pointer is nullptr." << endl; 140 140 return false; 141 141 } … … 173 173 @return 174 174 Returns a pointer to the Quest with the input id. 175 Returns NULLif there is no Quest with the given questId.175 Returns nullptr if there is no Quest with the given questId. 176 176 @throws 177 177 Throws an exception if the given questId is invalid. … … 188 188 else 189 189 { 190 quest = NULL;190 quest = nullptr; 191 191 orxout(internal_warning, context::quests) << "The quest with id {" << questId << "} is nowhere to be found." << endl; 192 192 } … … 202 202 @return 203 203 Returns a pointer to the QuestHint with the input id. 204 Returns NULLif there is no QuestHint with the given hintId.204 Returns nullptr if there is no QuestHint with the given hintId. 205 205 @throws 206 206 Throws an exception if the given hintId is invalid. … … 217 217 else 218 218 { 219 hint = NULL;219 hint = nullptr; 220 220 orxout(internal_warning, context::quests) << "The hint with id {" << hintId << "} is nowhere to be found." << endl; 221 221 } … … 235 235 { 236 236 int numQuests = 0; 237 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)238 { 239 if( it->second->getParentQuest() == NULL && !it->second->isInactive(player))237 for(const auto& mapEntry : this->questMap_) 238 { 239 if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player)) 240 240 numQuests++; 241 241 } … … 255 255 Quest* QuestManager::getRootQuest(PlayerInfo* player, int index) 256 256 { 257 for( std::map<std::string, Quest*>::iterator it = this->questMap_.begin(); it != this->questMap_.end(); it++)258 { 259 if( it->second->getParentQuest() == NULL && !it->second->isInactive(player) && index-- == 0)260 return it->second;261 } 262 return NULL;257 for(const auto& mapEntry : this->questMap_) 258 { 259 if(mapEntry.second->getParentQuest() == nullptr && !mapEntry.second->isInactive(player) && index-- == 0) 260 return mapEntry.second; 261 } 262 return nullptr; 263 263 } 264 264 … … 275 275 int QuestManager::getNumSubQuests(Quest* quest, PlayerInfo* player) 276 276 { 277 if(quest == NULL)277 if(quest == nullptr) 278 278 return this->getNumRootQuests(player); 279 279 280 280 std::list<Quest*> quests = quest->getSubQuestList(); 281 281 int numQuests = 0; 282 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)283 { 284 if(! (*it)->isInactive(player))282 for(Quest* subquest : quests) 283 { 284 if(!subquest->isInactive(player)) 285 285 numQuests++; 286 286 } … … 300 300 Quest* QuestManager::getSubQuest(Quest* quest, PlayerInfo* player, int index) 301 301 { 302 if(quest == NULL)302 if(quest == nullptr) 303 303 return this->getRootQuest(player, index); 304 304 305 305 std::list<Quest*> quests = quest->getSubQuestList(); 306 for( std::list<Quest*>::iterator it = quests.begin(); it != quests.end(); it++)307 { 308 if(! (*it)->isInactive(player) && index-- == 0)309 return *it;310 } 311 return NULL;306 for(Quest* subquest : quests) 307 { 308 if(!subquest->isInactive(player) && index-- == 0) 309 return quest; 310 } 311 return nullptr; 312 312 } 313 313 … … 326 326 std::list<QuestHint*> hints = quest->getHintsList(); 327 327 int numHints = 0; 328 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)329 { 330 if( (*it)->isActive(player))328 for(QuestHint* hint : hints) 329 { 330 if(hint->isActive(player)) 331 331 numHints++; 332 332 } … … 349 349 { 350 350 std::list<QuestHint*> hints = quest->getHintsList(); 351 for( std::list<QuestHint*>::iterator it = hints.begin(); it != hints.end(); it++)352 { 353 if( (*it)->isActive(player) && index-- == 0)354 return *it;355 } 356 return NULL;351 for(QuestHint* hint : hints) 352 { 353 if(hint->isActive(player) && index-- == 0) 354 return hint; 355 } 356 return nullptr; 357 357 } 358 358 … … 367 367 Quest* QuestManager::getParentQuest(Quest* quest) 368 368 { 369 OrxAssert(quest, "The input Quest is NULL.");369 OrxAssert(quest, "The input Quest is nullptr."); 370 370 return quest->getParentQuest(); 371 371 } … … 381 381 QuestDescription* QuestManager::getDescription(Quest* item) 382 382 { 383 OrxAssert(item, "The input Quest is NULL.");383 OrxAssert(item, "The input Quest is nullptr."); 384 384 return item->getDescription(); 385 385 } … … 395 395 QuestDescription* QuestManager::getDescription(QuestHint* item) 396 396 { 397 OrxAssert(item, "The input QuestHint is NULL.");397 OrxAssert(item, "The input QuestHint is nullptr."); 398 398 return item->getDescription(); 399 399 } … … 409 409 const std::string QuestManager::getId(Quest* item) const 410 410 { 411 OrxAssert(item, "The input Quest is NULL.");411 OrxAssert(item, "The input Quest is nullptr."); 412 412 return item->getId(); 413 413 } … … 423 423 const std::string QuestManager::getId(QuestHint* item) const 424 424 { 425 OrxAssert(item, "The input QuestHint is NULL.");425 OrxAssert(item, "The input QuestHint is nullptr."); 426 426 return item->getId(); 427 427 } … … 440 440 { 441 441 PlayerInfo* player = GUIManager::getInstance().getPlayer(guiName); 442 if(player == NULL)442 if(player == nullptr) 443 443 { 444 444 orxout(internal_error, context::quests) << "GUIOverlay with name '" << guiName << "' has no player." << endl; 445 return NULL;445 return nullptr; 446 446 } 447 447 -
code/trunk/src/modules/questsystem/effects/AddQuest.cc
r9667 r11071 90 90 { 91 91 Quest* quest = QuestManager::getInstance().findQuest(this->getQuestId()); 92 if(quest == NULL|| !quest->start(player))92 if(quest == nullptr || !quest->start(player)) 93 93 return false; 94 94 } -
code/trunk/src/modules/questsystem/effects/AddQuest.h
r9667 r11071 62 62 virtual ~AddQuest(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a AddQuest object through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddQuest object through XML. 65 65 66 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.66 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 67 67 68 68 }; -
code/trunk/src/modules/questsystem/effects/AddQuestHint.cc
r9667 r11071 113 113 { 114 114 QuestHint* hint = QuestManager::getInstance().findHint(this->hintId_); 115 if(hint == NULL|| !hint->setActive(player))115 if(hint == nullptr || !hint->setActive(player)) 116 116 return false; 117 117 } -
code/trunk/src/modules/questsystem/effects/AddQuestHint.h
r9667 r11071 64 64 virtual ~AddQuestHint(); 65 65 66 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a AddQuestHint object through XML.66 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddQuestHint object through XML. 67 67 68 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.68 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 69 69 70 70 private: -
code/trunk/src/modules/questsystem/effects/AddReward.cc
r9667 r11071 84 84 { 85 85 int i = index; 86 for ( std::list<Rewardable*>::const_iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)86 for (Rewardable* reward : this->rewards_) 87 87 { 88 88 if(i == 0) 89 return *reward;89 return reward; 90 90 i--; 91 91 } 92 return NULL;92 return nullptr; 93 93 } 94 94 … … 106 106 107 107 bool temp = true; 108 for ( std::list<Rewardable*>::iterator reward = this->rewards_.begin(); reward != this->rewards_.end(); ++reward)109 temp = temp && (*reward)->reward(player);108 for (Rewardable* reward : this->rewards_) 109 temp = temp && reward->reward(player); 110 110 111 111 orxout(verbose, context::quests) << "Rewardable successfully added to player." << player << " ." << endl; -
code/trunk/src/modules/questsystem/effects/AddReward.h
r9667 r11071 68 68 virtual ~AddReward(); 69 69 70 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a AddReward object through XML.70 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a AddReward object through XML. 71 71 72 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.72 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 73 73 74 74 private: -
code/trunk/src/modules/questsystem/effects/ChangeQuestStatus.h
r9667 r11071 59 59 virtual ~ChangeQuestStatus(); 60 60 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a ChangeQuestStatus object through XML.61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a ChangeQuestStatus object through XML. 62 62 63 63 virtual bool invoke(PlayerInfo* player) = 0; //!< Invokes the QuestEffect. -
code/trunk/src/modules/questsystem/effects/CompleteQuest.cc
r9667 r11071 92 92 { 93 93 quest = QuestManager::getInstance().findQuest(this->getQuestId()); 94 if(quest == NULL|| !quest->complete(player))94 if(quest == nullptr || !quest->complete(player)) 95 95 return false; 96 96 } -
code/trunk/src/modules/questsystem/effects/CompleteQuest.h
r9667 r11071 62 62 virtual ~CompleteQuest(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a CompleteQuest object through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a CompleteQuest object through XML. 65 65 66 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.66 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 67 67 68 68 }; -
code/trunk/src/modules/questsystem/effects/FailQuest.cc
r9667 r11071 91 91 { 92 92 quest = QuestManager::getInstance().findQuest(this->getQuestId()); 93 if(quest == NULL|| !quest->fail(player))93 if(quest == nullptr || !quest->fail(player)) 94 94 return false; 95 95 } -
code/trunk/src/modules/questsystem/effects/FailQuest.h
r9667 r11071 62 62 virtual ~FailQuest(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a FailQuest object through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a FailQuest object through XML. 65 65 66 virtual bool invoke(PlayerInfo* player) ; //!< Invokes the QuestEffect.66 virtual bool invoke(PlayerInfo* player) override; //!< Invokes the QuestEffect. 67 67 68 68 }; -
code/trunk/src/modules/tetris/Tetris.cc
r10624 r11071 66 66 RegisterObject(Tetris); 67 67 68 this->activeBrick_ = 0;68 this->activeBrick_ = nullptr; 69 69 70 70 // Pre-set the timer, but don't start it yet. … … 72 72 this->starttimer_.stopTimer(); 73 73 74 this->player_ = NULL;74 this->player_ = nullptr; 75 75 this->setHUDTemplate("TetrisHUD"); 76 this->futureBrick_ = 0;76 this->futureBrick_ = nullptr; 77 77 } 78 78 … … 96 96 { 97 97 this->activeBrick_->destroy(); 98 this->activeBrick_ = 0;98 this->activeBrick_ = nullptr; 99 99 } 100 100 if (this->futureBrick_) 101 101 { 102 102 this->futureBrick_->destroy(); 103 this->futureBrick_ = 0;104 } 105 106 for ( std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)107 (*it)->destroy();103 this->futureBrick_ = nullptr; 104 } 105 106 for (TetrisStone* stone : this->stones_) 107 stone->destroy(); 108 108 this->stones_.clear(); 109 109 } … … 113 113 SUPER(Tetris, tick, dt); 114 114 115 if((this->activeBrick_ != NULL)&&(!this->hasEnded()))115 if((this->activeBrick_ != nullptr)&&(!this->hasEnded())) 116 116 { 117 117 if(!this->isValidBrickPosition(this->activeBrick_)) … … 136 136 return false; 137 137 138 for( std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)139 { 140 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone138 for(TetrisStone* someStone : this->stones_) 139 { 140 const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone 141 141 142 142 if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize()) … … 192 192 193 193 // check for collisions with all stones 194 for( std::list<StrongPtr<TetrisStone> >::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)194 for(TetrisStone* someStone : this->stones_) 195 195 { 196 196 //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount()); 197 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone197 const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone 198 198 199 199 //filter out cases where the falling stone is already below a steady stone … … 290 290 void Tetris::start() 291 291 { 292 if (this->center_ != NULL) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place.292 if (this->center_ != nullptr) // There needs to be a TetrisCenterpoint, i.e. the area the game takes place. 293 293 { 294 294 // Create the first brick. … … 323 323 { 324 324 this->activeBrick_->setVelocity(Vector3::ZERO); 325 if(this->activeBrick_ != NULL)325 if(this->activeBrick_ != nullptr) 326 326 { 327 327 this->player_->stopControl(); … … 341 341 { 342 342 // Spawn a human player. 343 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)344 if ( it->first->isHumanPlayer() && (it->first->isReadyToSpawn() || this->bForceSpawn_))345 this->spawnPlayer( it->first);343 for (const auto& mapEntry : this->players_) 344 if (mapEntry.first->isHumanPlayer() && (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 345 this->spawnPlayer(mapEntry.first); 346 346 } 347 347 … … 351 351 if(player && player->isHumanPlayer()) 352 352 { 353 if(this->activeBrick_ != NULL)353 if(this->activeBrick_ != nullptr) 354 354 { 355 355 this->player_->stopControl(); … … 370 370 assert(player); 371 371 372 if(this->player_ == NULL)372 if(this->player_ == nullptr) 373 373 { 374 374 this->player_ = player; … … 381 381 void Tetris::startBrick(void) 382 382 { 383 if(this->player_ == NULL)383 if(this->player_ == nullptr) 384 384 return; 385 385 386 386 unsigned int cameraIndex = 0; 387 if(this->activeBrick_ != NULL)387 if(this->activeBrick_ != nullptr) 388 388 { 389 389 // Get camera settings … … 396 396 // Make the last brick to be created the active brick. 397 397 this->activeBrick_ = this->futureBrick_; 398 this->futureBrick_ = 0;398 this->futureBrick_ = nullptr; 399 399 400 400 // set its position … … 437 437 Get the player. 438 438 @return 439 Returns a pointer to the player. If there is no player, NULLis returned.439 Returns a pointer to the player. If there is no player, nullptr is returned. 440 440 */ 441 441 PlayerInfo* Tetris::getPlayer(void) const … … 469 469 { 470 470 stonesPerRow = 0; 471 for(std::list<StrongPtr<TetrisStone> 472 { 473 std::list<StrongPtr<TetrisStone> 471 for(std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ) 472 { 473 std::list<StrongPtr<TetrisStone>>::iterator it_temp = it++; 474 474 correctPosition = static_cast<unsigned int>(((*it_temp)->getPosition().y - 5)/this->center_->getStoneSize()); 475 475 if(correctPosition == row) … … 491 491 void Tetris::clearRow(unsigned int row) 492 492 {// clear the full row 493 for(std::list<StrongPtr<TetrisStone> 493 for(std::list<StrongPtr<TetrisStone>>::iterator it = this->stones_.begin(); it != this->stones_.end(); ) 494 494 { 495 495 if(static_cast<unsigned int>(((*it)->getPosition().y - 5)/this->center_->getStoneSize()) == row) … … 502 502 } 503 503 // adjust height of stones above the deleted row //TODO: check if this could be a source of a bug. 504 for( std::list<StrongPtr<TetrisStone> >::iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)505 { 506 if(static_cast<unsigned int>(( (*it)->getPosition().y - 5)/this->center_->getStoneSize()) > row)507 (*it)->setPosition((*it)->getPosition()-Vector3(0,10,0));504 for(TetrisStone* stone : this->stones_) 505 { 506 if(static_cast<unsigned int>((stone->getPosition().y - 5)/this->center_->getStoneSize()) > row) 507 stone->setPosition(stone->getPosition()-Vector3(0,10,0)); 508 508 } 509 509 -
code/trunk/src/modules/tetris/Tetris.h
r10624 r11071 58 58 virtual ~Tetris(); //!< Destructor. Cleans up, if initialized. 59 59 60 virtual void start(void) ; //!< Starts the Tetris minigame.61 virtual void end(void) ; ///!< Ends the Tetris minigame.60 virtual void start(void) override; //!< Starts the Tetris minigame. 61 virtual void end(void) override; ///!< Ends the Tetris minigame. 62 62 63 virtual void tick(float dt) ;63 virtual void tick(float dt) override; 64 64 65 virtual void spawnPlayer(PlayerInfo* player) ; //!< Spawns the input player.66 virtual bool playerLeft(PlayerInfo* player) ;65 virtual void spawnPlayer(PlayerInfo* player) override; //!< Spawns the input player. 66 virtual bool playerLeft(PlayerInfo* player) override; 67 67 68 68 void setCenterpoint(TetrisCenterpoint* center); … … 77 77 78 78 protected: 79 virtual void spawnPlayersIfRequested() ; //!< Spawns player.79 virtual void spawnPlayersIfRequested() override; //!< Spawns player. 80 80 81 81 … … 93 93 94 94 WeakPtr<TetrisCenterpoint> center_; //!< The playing field. 95 std::list<StrongPtr<TetrisStone> 95 std::list<StrongPtr<TetrisStone>> stones_; //!< A list of all stones in play. 96 96 WeakPtr<TetrisBrick> activeBrick_; 97 97 WeakPtr<TetrisBrick> futureBrick_; -
code/trunk/src/modules/tetris/TetrisBrick.cc
r10624 r11071 81 81 this->attach(stone); 82 82 this->formBrick(stone, i); 83 if(this->tetris_ != NULL)83 if(this->tetris_ != nullptr) 84 84 { 85 85 stone->setGame(this->tetris_); 86 if(this->tetris_->getCenterpoint() != NULL)86 if(this->tetris_->getCenterpoint() != nullptr) 87 87 stone->addTemplate(this->tetris_->getCenterpoint()->getStoneTemplate()); 88 88 else 89 orxout()<< "tetris_->getCenterpoint == NULLin TetrisBrick.cc"<< endl;89 orxout()<< "tetris_->getCenterpoint == nullptr in TetrisBrick.cc"<< endl; 90 90 } 91 91 else 92 orxout()<< "tetris_ == NULLin TetrisBrick.cc"<< endl;92 orxout()<< "tetris_ == nullptr in TetrisBrick.cc"<< endl; 93 93 } 94 94 } … … 161 161 if(i < this->brickStones_.size()) 162 162 return this->brickStones_[i]; 163 else return NULL;163 else return nullptr; 164 164 } 165 165 … … 167 167 Tetris* TetrisBrick::getTetris() 168 168 { 169 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Tetris)))169 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Tetris))) 170 170 { 171 171 Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype()); 172 172 return tetrisGametype; 173 173 } 174 return NULL;174 return nullptr; 175 175 } 176 176 … … 239 239 { 240 240 assert(this->tetris_); 241 for( unsigned int i = 0; i < this->brickStones_.size(); i++)242 { 243 this->brickStones_[i]->detachFromParent();244 this->brickStones_[i]->attachToParent(center);245 this->brickStones_[i]->setPosition(this->getPosition()+this->tetris_->rotateVector(this->brickStones_[i]->getPosition(),this->rotationCount_ ));241 for(TetrisStone* stone : this->brickStones_) 242 { 243 stone->detachFromParent(); 244 stone->attachToParent(center); 245 stone->setPosition(this->getPosition()+this->tetris_->rotateVector(stone->getPosition(),this->rotationCount_ )); 246 246 } 247 247 this->brickStones_.clear(); -
code/trunk/src/modules/tetris/TetrisBrick.h
r10262 r11071 57 57 virtual ~TetrisBrick() {} 58 58 59 virtual void moveFrontBack(const Vector2& value) ; //!< Overloaded the function to steer the bat up and down.60 virtual void moveRightLeft(const Vector2& value) ; //!< Overloaded the function to steer the bat up and down.61 virtual void changedPlayer() ; //!< Is called when the player changed.59 virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 60 virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 61 virtual void changedPlayer() override; //!< Is called when the player changed. 62 62 63 63 bool isValidMove(const Vector3& position, bool isRotation); -
code/trunk/src/modules/tetris/TetrisCenterpoint.cc
r10624 r11071 84 84 void TetrisCenterpoint::checkGametype() 85 85 { 86 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(Tetris)))86 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(Tetris))) 87 87 { 88 88 Tetris* tetrisGametype = orxonox_cast<Tetris*>(this->getGametype()); -
code/trunk/src/modules/tetris/TetrisCenterpoint.h
r10624 r11071 62 62 virtual ~TetrisCenterpoint() {} 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method to create a TetrisCenterpoint through XML.64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method to create a TetrisCenterpoint through XML. 65 65 66 66 /** -
code/trunk/src/modules/tetris/TetrisScore.cc
r10624 r11071 36 36 37 37 #include "core/CoreIncludes.h" 38 #include "core/XMLPort.h"39 38 #include "util/Convert.h" 40 39 … … 56 55 RegisterObject(TetrisScore); 57 56 58 this->owner_ = 0;59 this->player_ = NULL;57 this->owner_ = nullptr; 58 this->player_ = nullptr; 60 59 } 61 60 … … 66 65 TetrisScore::~TetrisScore() 67 66 { 68 }69 70 /**71 @brief72 Method to create a TetrisScore through XML.73 */74 void TetrisScore::XMLPort(Element& xmlelement, XMLPort::Mode mode)75 {76 SUPER(TetrisScore, XMLPort, xmlelement, mode);77 67 } 78 68 … … 89 79 90 80 // If the owner is set. The owner being a Tetris game. 91 if (this->owner_ != NULL)81 if (this->owner_ != nullptr) 92 82 { 93 83 std::string score("0"); … … 101 91 { 102 92 // Save the name and score of each player as a string. 103 if (player_ != NULL)93 if (player_ != nullptr) 104 94 score = multi_cast<std::string>(this->owner_->getScore(player_)); 105 95 } … … 111 101 @brief 112 102 Is called when the owner changes. 113 Sets the owner to NULL, if it is not a pointer to a Tetris game.103 Sets the owner to nullptr, if it is not a pointer to a Tetris game. 114 104 */ 115 105 void TetrisScore::changedOwner() … … 117 107 SUPER(TetrisScore, changedOwner); 118 108 119 if (this->getOwner() != NULL&& this->getOwner()->getGametype())109 if (this->getOwner() != nullptr && this->getOwner()->getGametype()) 120 110 this->owner_ = orxonox_cast<Tetris*>(this->getOwner()->getGametype()); 121 111 else 122 this->owner_ = 0;112 this->owner_ = nullptr; 123 113 } 124 114 } -
code/trunk/src/modules/tetris/TetrisScore.h
r10262 r11071 60 60 virtual ~TetrisScore(); 61 61 62 virtual void tick(float dt); //!< Creates and sets the caption to be displayed by the TetrisScore. 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 64 virtual void changedOwner(); //!< Is called when the owner changes. 62 virtual void tick(float dt) override; //!< Creates and sets the caption to be displayed by the TetrisScore. 63 virtual void changedOwner() override; //!< Is called when the owner changes. 65 64 66 65 private: -
code/trunk/src/modules/towerdefense/TowerDefense.cc
r10727 r11071 90 90 RegisterObject(TowerDefense); 91 91 92 selecter = NULL;93 this->player_ = NULL;92 selecter = nullptr; 93 this->player_ = nullptr; 94 94 this->setHUDTemplate("TowerDefenseHUD"); 95 95 this->waveNumber_ = 0; … … 117 117 void TowerDefense::start() 118 118 { 119 if (center_ != NULL) // There needs to be a TowerDefenseCenterpoint, i.e. the area the game takes place.120 { 121 if (selecter == NULL)119 if (center_ != nullptr) // There needs to be a TowerDefenseCenterpoint, i.e. the area the game takes place. 120 { 121 if (selecter == nullptr) 122 122 { 123 123 selecter = new TowerDefenseSelecter(this->center_->getContext()); … … 176 176 WaypointController* controller = (WaypointController*)(en1->getXMLController()); 177 177 178 if (controller != NULL&& waypoints_.size() > 1)178 if (controller != nullptr && waypoints_.size() > 1) 179 179 { 180 180 en1->setPosition(waypoints_.at(0)->getPosition() + offset_); … … 183 183 en1->lookAt(waypoints_.at(1)->getPosition() + offset_); 184 184 185 for ( unsigned int i = 0; i < waypoints_.size(); ++ i)185 for (TowerDefenseField* field : waypoints_) 186 186 { 187 187 orxonox::WeakPtr<MovableEntity> waypoint = new MovableEntity(this->center_->getContext()); 188 waypoint->setPosition( waypoints_.at(i)->getPosition() + offset_);188 waypoint->setPosition(field->getPosition() + offset_); 189 189 controller->addWaypoint(waypoint); 190 190 } … … 208 208 player_ = player; 209 209 210 if (selecter->getPlayer() == NULL)210 if (selecter->getPlayer() == nullptr) 211 211 { 212 212 player_->startControl(selecter); … … 219 219 Get the player. 220 220 @return 221 Returns a pointer to the player. If there is no player, NULLis returned.221 Returns a pointer to the player. If there is no player, nullptr is returned. 222 222 */ 223 223 PlayerInfo* TowerDefense::getPlayer(void) const … … 265 265 SUPER(TowerDefense, tick, dt); 266 266 267 if (hasStarted() == false || player_ == NULL)267 if (hasStarted() == false || player_ == nullptr) 268 268 { 269 269 return; … … 273 273 274 274 //build/upgrade tower at selecter position 275 if (selecter != NULL&& selecter->buildTower_ == true)275 if (selecter != nullptr && selecter->buildTower_ == true) 276 276 { 277 277 selecter->buildTower_ = false; … … 287 287 } 288 288 289 for (std::list<WeakPtr<TowerDefenseEnemy> 290 { 291 if (*it == NULL)289 for (std::list<WeakPtr<TowerDefenseEnemy>>::iterator it = enemies_.begin(); it != enemies_.end(); ) 290 { 291 if (*it == nullptr) 292 292 { 293 293 // the enemy was destroyed by a tower - remove it from the list … … 355 355 fields_[i][j]->create(fields.at(pos), fields.at(pos+1)); 356 356 pos += 2; 357 if (fields_[i][j]->getType() == START)357 if (fields_[i][j]->getType() == TowerDefenseFieldType::START) 358 358 { 359 359 startCoord.Set(i,j); … … 365 365 TDCoordinate* thisCoord = &startCoord; 366 366 TDCoordinate* nextCoord; 367 while ((nextCoord = getNextStreetCoord(thisCoord)) != NULL)367 while ((nextCoord = getNextStreetCoord(thisCoord)) != nullptr) 368 368 { 369 369 waypoints_.push_back(fields_[nextCoord->GetX()][nextCoord->GetY()]); … … 379 379 TDCoordinate* nextCoord = new TDCoordinate(0,0); 380 380 381 if (thisField->getType() != STREET && thisField->getType() !=START)382 { 383 return NULL;381 if (thisField->getType() != TowerDefenseFieldType::STREET && thisField->getType() != TowerDefenseFieldType::START) 382 { 383 return nullptr; 384 384 } 385 385 … … 406 406 } 407 407 408 return NULL;408 return nullptr; 409 409 } 410 410 } -
code/trunk/src/modules/towerdefense/TowerDefense.h
r10629 r11071 53 53 virtual ~TowerDefense(); 54 54 void addTowerDefenseEnemy(int templatenr); 55 virtual void start() ; //<! The function is called when the gametype starts56 virtual void end() ;57 virtual void tick(float dt) ;58 virtual void spawnPlayer(PlayerInfo* player) ;55 virtual void start() override; //<! The function is called when the gametype starts 56 virtual void end() override; 57 virtual void tick(float dt) override; 58 virtual void spawnPlayer(PlayerInfo* player) override; 59 59 PlayerInfo* getPlayer(void) const; 60 60 int getCredit(){ return this->credit_; } … … 87 87 int waveNumber_; 88 88 int lifes_; 89 std::list<orxonox::WeakPtr<TowerDefenseEnemy> 89 std::list<orxonox::WeakPtr<TowerDefenseEnemy>> enemies_; 90 90 TowerDefenseField* fields_[16][16]; 91 std::vector<orxonox::WeakPtr<TowerDefenseField> 91 std::vector<orxonox::WeakPtr<TowerDefenseField>> waypoints_; 92 92 Vector3 endpoint_; 93 93 Vector3 offset_; -
code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.cc
r10629 r11071 92 92 void TowerDefenseCenterpoint::checkGametype() 93 93 { 94 if (this->getGametype() != NULL&& this->getGametype()->isA(Class(TowerDefense)))94 if (this->getGametype() != nullptr && this->getGametype()->isA(Class(TowerDefense))) 95 95 { 96 96 // Sets the centerpoint of the gametype. The gametype uses this to later spawn in towers, he needs the tower template stored in the center point -
code/trunk/src/modules/towerdefense/TowerDefenseCenterpoint.h
r10629 r11071 52 52 virtual ~TowerDefenseCenterpoint() {} 53 53 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 55 56 56 /** -
code/trunk/src/modules/towerdefense/TowerDefenseEnemy.cc
r10629 r11071 27 27 RegisterObject(TowerDefenseEnemy); 28 28 29 this->setCollisionType(WorldEntity:: Dynamic);29 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 30 30 //needed to keep track of the PlayerStats coded in TowerDefense.h 31 31 this->td = orxonox_cast<TowerDefense*>(this->getGametype()); … … 38 38 } 39 39 40 void TowerDefenseEnemy::tick(float dt)41 {42 //orxout() << "TDE tick1" << endl;43 SUPER(TowerDefenseEnemy, tick, dt);44 //orxout() << "TDE tick2" << endl;45 }46 47 40 WeakPtr<TowerDefense> TowerDefenseEnemy::getGame() 48 41 { 49 if (game == NULL)42 if (game == nullptr) 50 43 { 51 for ( ObjectList<TowerDefense>::iterator it = ObjectList<TowerDefense>::begin(); it != ObjectList<TowerDefense>::end(); ++it)52 game = *it;44 for (TowerDefense* towerDefense : ObjectList<TowerDefense>()) 45 game = towerDefense; 53 46 } 54 47 return game; 55 48 } 56 49 57 void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator )50 void TowerDefenseEnemy::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 58 51 { 59 52 Pawn::damage(damage, healthdamage, shielddamage, originator); -
code/trunk/src/modules/towerdefense/TowerDefenseEnemy.h
r10629 r11071 37 37 //health gibt es unter: health_ 38 38 39 virtual void tick(float dt); 40 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator); 39 virtual void damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) override; 41 40 42 41 private: -
code/trunk/src/modules/towerdefense/TowerDefenseField.cc
r11052 r11071 49 49 RegisterObject(TowerDefenseField); 50 50 51 tower_ = NULL;52 type_ = FREE;53 center_ = NULL;51 tower_ = nullptr; 52 type_ = TowerDefenseFieldType::FREE; 53 center_ = nullptr; 54 54 upgrade_ = 0; 55 55 setPosition(0,0,0); … … 119 119 bool TowerDefenseField::canUpgrade() 120 120 { 121 if (tower_ != NULL&& upgrade_ < 5)121 if (tower_ != nullptr && upgrade_ < 5) 122 122 { 123 123 return true; … … 129 129 void TowerDefenseField::setAngle(int newAngle) 130 130 { 131 if (modelGround_ != NULL)131 if (modelGround_ != nullptr) 132 132 { 133 133 switch (newAngle) … … 152 152 } 153 153 154 if (modelObject_ != NULL)154 if (modelObject_ != nullptr) 155 155 { 156 156 switch (newAngle) … … 185 185 { 186 186 modelGround_->setMeshSource("TD_F1.mesh"); 187 tower_ = NULL;188 type_ = FREE;187 tower_ = nullptr; 188 type_ = TowerDefenseFieldType::FREE; 189 189 setUpgrade(0); 190 190 setAngle(orientation); … … 194 194 { 195 195 modelGround_->setMeshSource("TD_S5.mesh"); 196 tower_ = NULL;197 type_ = START;196 tower_ = nullptr; 197 type_ = TowerDefenseFieldType::START; 198 198 setUpgrade(0); 199 199 setAngle(orientation); … … 204 204 { 205 205 modelGround_->setMeshSource("TD_S4.mesh"); 206 tower_ = NULL;207 type_ = END;206 tower_ = nullptr; 207 type_ = TowerDefenseFieldType::END; 208 208 setUpgrade(0); 209 209 setAngle(orientation); … … 213 213 { 214 214 modelGround_->setMeshSource("TD_S1.mesh"); 215 tower_ = NULL;216 type_ = STREET;215 tower_ = nullptr; 216 type_ = TowerDefenseFieldType::STREET; 217 217 setUpgrade(0); 218 218 setAngle(orientation); … … 222 222 { 223 223 modelGround_->setMeshSource("TD_S2.mesh"); 224 tower_ = NULL;225 type_ = STREET;224 tower_ = nullptr; 225 type_ = TowerDefenseFieldType::STREET; 226 226 setUpgrade(0); 227 227 setAngle(orientation); … … 231 231 { 232 232 modelGround_->setMeshSource("TD_S3.mesh"); 233 tower_ = NULL;234 type_ = STREET;233 tower_ = nullptr; 234 type_ = TowerDefenseFieldType::STREET; 235 235 setUpgrade(0); 236 236 setAngle(orientation); … … 241 241 modelGround_->setMeshSource("TD_F1.mesh"); 242 242 modelObject_->setMeshSource("TD_O1.mesh"); 243 tower_ = NULL;244 type_ = OBSTACLE;243 tower_ = nullptr; 244 type_ = TowerDefenseFieldType::OBSTACLE; 245 245 setUpgrade(0); 246 246 setAngle(orientation); … … 249 249 void TowerDefenseField::createTower(int upgrade) 250 250 { 251 if (tower_ == NULL)251 if (tower_ == nullptr) 252 252 { 253 253 modelGround_->setMeshSource("TD_F1.mesh"); 254 254 tower_ = new TowerDefenseTower(center_->getContext()); 255 255 attach(tower_); 256 type_ = T OWER;256 type_ = TowerDefenseFieldType::TOWER; 257 257 setUpgrade(upgrade); 258 if (upgrade_ > 0 && modelObject_ != NULL)258 if (upgrade_ > 0 && modelObject_ != nullptr) 259 259 { 260 260 switch (upgrade_) … … 287 287 void TowerDefenseField::destroyTower() 288 288 { 289 if (tower_ != NULL)289 if (tower_ != nullptr) 290 290 { 291 291 tower_->destroy(); 292 tower_ = NULL;292 tower_ = nullptr; 293 293 } 294 294 } -
code/trunk/src/modules/towerdefense/TowerDefenseField.h
r11052 r11071 46 46 namespace orxonox 47 47 { 48 enum TowerDefenseFieldType48 enum class TowerDefenseFieldType 49 49 { 50 50 FREE, … … 62 62 TowerDefenseField(Context* context); 63 63 virtual ~TowerDefenseField() {} 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 65 65 const bool isFree() const 66 { return type_== FREE; }66 { return type_==TowerDefenseFieldType::FREE; } 67 67 virtual void create(char object, char param); 68 68 virtual void setCenterpoint(TowerDefenseCenterpoint* center); -
code/trunk/src/modules/towerdefense/TowerDefenseHUDController.cc
r10629 r11071 39 39 { 40 40 RegisterObject(TowerDefenseHUDController); 41 this->td = 0;41 this->td = nullptr; 42 42 } 43 43 … … 89 89 else 90 90 { 91 this->td = 0;91 this->td = nullptr; 92 92 } 93 93 } -
code/trunk/src/modules/towerdefense/TowerDefenseHUDController.h
r10258 r11071 53 53 54 54 55 virtual void tick(float dt) ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;57 virtual void changedOwner() ;55 virtual void tick(float dt) override; 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 virtual void changedOwner() override; 58 58 void setShowlives(bool temp) 59 59 { this->showlives = temp; } -
code/trunk/src/modules/towerdefense/TowerDefenseSelecter.cc
r11052 r11071 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "core/XMLPort.h"38 37 #include "graphics/Model.h" 39 38 … … 59 58 { 60 59 61 }62 63 void TowerDefenseSelecter::XMLPort(Element& xmlelement, XMLPort::Mode mode)64 {65 SUPER(TowerDefenseSelecter, XMLPort, xmlelement, mode);66 60 } 67 61 -
code/trunk/src/modules/towerdefense/TowerDefenseSelecter.h
r10629 r11071 41 41 TowerDefenseSelecter(Context* context); //!< Constructor. Registers and initializes the object. 42 42 virtual ~TowerDefenseSelecter(); 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 44 virtual void tick(float dt); 45 virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down. 46 virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down. 47 virtual void rotateYaw(const Vector2& value); 48 virtual void rotatePitch(const Vector2& value); 49 virtual void rotateRoll(const Vector2& value); 43 virtual void tick(float dt) override; 44 virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 45 virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down. 46 virtual void rotateYaw(const Vector2& value) override; 47 virtual void rotatePitch(const Vector2& value) override; 48 virtual void rotateRoll(const Vector2& value) override; 50 49 void fire(unsigned int firemode); 51 virtual void fired(unsigned int firemode) ;52 virtual void boost(bool bBoost) ;50 virtual void fired(unsigned int firemode) override; 51 virtual void boost(bool bBoost) override; 53 52 virtual void setSelectedPosition(TDCoordinate* newPos); 54 53 virtual void setSelectedPosition(int x, int y); -
code/trunk/src/modules/towerdefense/TowerDefenseTower.cc
r11052 r11071 25 25 { 26 26 RegisterObject(TowerDefenseTower); 27 game_ = NULL;28 this->setCollisionType(WorldEntity:: None);27 game_ =nullptr; 28 this->setCollisionType(WorldEntity::CollisionType::None); 29 29 upgrade = 1; 30 30 -
code/trunk/src/modules/weapons/IceGunFreezer.cc
r11052 r11071 63 63 /** 64 64 @brief 65 The controlling happens here. This method defines what the controller has to do each tick.66 @param dt67 The duration of the tick.68 */69 void IceGunFreezer::tick(float dt)70 {71 SUPER(IceGunFreezer, tick, dt);72 73 74 }75 76 /**77 @brief78 65 Sets the freeze time variable to the passed value. 79 66 */ … … 101 88 102 89 // Check if the freezer is attached to a parent and check if the parent is a SpaceShip 103 if (parent != NULL&& parent->isA(Class(SpaceShip)))90 if (parent != nullptr && parent->isA(Class(SpaceShip))) 104 91 { 105 92 freezedSpaceShip_ = orxonox_cast<SpaceShip*>(parent); … … 118 105 void IceGunFreezer::stopFreezing() 119 106 { 120 if (freezedSpaceShip_ != NULL&& freezeFactor_ != 0.0)107 if (freezedSpaceShip_ != nullptr && freezeFactor_ != 0.0) 121 108 { 122 109 freezedSpaceShip_->addSpeedFactor(1/freezeFactor_); -
code/trunk/src/modules/weapons/IceGunFreezer.h
r11052 r11071 37 37 #include "weapons/WeaponsPrereqs.h" 38 38 39 #include "tools/interfaces/Tickable.h"40 39 #include "worldentities/StaticEntity.h" 41 40 #include "graphics/Model.h" … … 50 49 @ingroup Weapons 51 50 */ 52 class _WeaponsExport IceGunFreezer : public StaticEntity , public Tickable51 class _WeaponsExport IceGunFreezer : public StaticEntity 53 52 { 54 53 public: 55 54 IceGunFreezer(Context* context); 56 55 virtual ~IceGunFreezer(); 57 virtual void tick(float dt);58 56 virtual void startFreezing(); 59 57 virtual void stopFreezing(); -
code/trunk/src/modules/weapons/RocketController.cc
r10258 r11071 38 38 #include "projectiles/SimpleRocket.h" 39 39 #include "weaponmodes/SimpleRocketFire.h" 40 #include "core/CoreIncludes.h" 40 41 41 42 namespace orxonox -
code/trunk/src/modules/weapons/RocketController.h
r9667 r11071 55 55 virtual ~RocketController(); 56 56 57 virtual void tick(float dt) ;57 virtual void tick(float dt) override; 58 58 /** 59 59 @brief Get the rocket that is controlled by this controller. -
code/trunk/src/modules/weapons/munitions/FusionMunition.cc
r11052 r11071 34 34 #include "FusionMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 namespace orxonox … … 57 56 this->reloadTime_ = 0.5f; 58 57 } 59 60 void FusionMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)61 {62 SUPER(FusionMunition, XMLPort, xmlelement, mode);63 }64 58 } -
code/trunk/src/modules/weapons/munitions/FusionMunition.h
r11052 r11071 52 52 public: 53 53 FusionMunition(Context* context); 54 virtual ~FusionMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~FusionMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/munitions/GravityBombMunition.cc
r11052 r11071 7 7 #include "GravityBombMunition.h" 8 8 #include "core/CoreIncludes.h" 9 #include "core/XMLPort.h"10 9 11 10 namespace orxonox … … 27 26 this->reloadTime_ = 0.0f; 28 27 } 29 30 void GravityBombMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)31 {32 SUPER(GravityBombMunition, XMLPort, xmlelement, mode);33 }34 28 } 35 29 -
code/trunk/src/modules/weapons/munitions/GravityBombMunition.h
r11052 r11071 27 27 public: 28 28 GravityBombMunition(Context* context); 29 virtual ~GravityBombMunition() {} 30 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 29 virtual ~GravityBombMunition() = default; 31 30 }; 32 31 -
code/trunk/src/modules/weapons/munitions/IceMunition.cc
r11052 r11071 34 34 #include "IceMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 namespace orxonox … … 55 54 this->reloadTime_ = 0.5f; 56 55 } 57 58 void IceMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(IceMunition, XMLPort, xmlelement, mode);61 }62 56 } -
code/trunk/src/modules/weapons/munitions/IceMunition.h
r11052 r11071 52 52 public: 53 53 IceMunition(Context* context); 54 virtual ~IceMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~IceMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/munitions/LaserMunition.cc
r11052 r11071 34 34 #include "LaserMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 namespace orxonox … … 58 57 this->reloadTime_ = 0.5f; 59 58 } 60 61 void LaserMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)62 {63 SUPER(LaserMunition, XMLPort, xmlelement, mode);64 }65 59 } -
code/trunk/src/modules/weapons/munitions/LaserMunition.h
r11052 r11071 52 52 public: 53 53 LaserMunition(Context* context); 54 virtual ~LaserMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~LaserMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/munitions/LightningMunition.cc
r11052 r11071 34 34 #include "LightningMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 namespace orxonox … … 55 54 this->reloadTime_ = 0.5f; 56 55 } 57 58 void LightningMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(LightningMunition, XMLPort, xmlelement, mode);61 }62 56 } -
code/trunk/src/modules/weapons/munitions/LightningMunition.h
r11052 r11071 52 52 public: 53 53 LightningMunition(Context* context); 54 virtual ~LightningMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~LightningMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/munitions/MineMunition.cc
r11052 r11071 54 54 this->reloadTime_ = 0.5f; 55 55 } 56 57 void MineMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)58 {59 SUPER(MineMunition, XMLPort, xmlelement, mode);60 }61 56 } -
code/trunk/src/modules/weapons/munitions/MineMunition.h
r11052 r11071 52 52 public: 53 53 MineMunition(Context* context); 54 virtual ~MineMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~MineMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/munitions/RocketMunition.cc
r11052 r11071 34 34 #include "RocketMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 namespace orxonox … … 55 54 this->reloadTime_ = 0.5f; 56 55 } 57 58 void RocketMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(RocketMunition, XMLPort, xmlelement, mode);61 }62 56 } -
code/trunk/src/modules/weapons/munitions/RocketMunition.h
r11052 r11071 52 52 public: 53 53 RocketMunition(Context* context); 54 virtual ~RocketMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~RocketMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/munitions/SplitMunition.cc
r11052 r11071 34 34 #include "SplitMunition.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 namespace orxonox … … 55 54 this->reloadTime_ = 0.5f; 56 55 } 57 58 void SplitMunition::XMLPort(Element& xmlelement, XMLPort::Mode mode)59 {60 SUPER(SplitMunition, XMLPort, xmlelement, mode);61 }62 56 } -
code/trunk/src/modules/weapons/munitions/SplitMunition.h
r11052 r11071 52 52 public: 53 53 SplitMunition(Context* context); 54 virtual ~SplitMunition() {} 55 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 54 virtual ~SplitMunition() = default; 56 55 }; 57 56 } -
code/trunk/src/modules/weapons/projectiles/BasicProjectile.cc
r11052 r11071 88 88 // The projectile is destroyed by its tick()-function (in the following tick). 89 89 90 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is NULL90 Pawn* victim = orxonox_cast<Pawn*>(otherObject); // If otherObject isn't a Pawn, then victim is nullptr 91 91 92 92 WorldEntity* entity = orxonox_cast<WorldEntity*>(this); … … 146 146 bool BasicProjectile::isObjectRelatedToShooter(WorldEntity* otherObject) 147 147 { 148 for (WorldEntity* shooter = this->getShooter(); shooter != NULL; shooter = shooter->getParent())148 for (WorldEntity* shooter = this->getShooter(); shooter != nullptr; shooter = shooter->getParent()) 149 149 if (otherObject == shooter) 150 150 return true; 151 for (WorldEntity* object = otherObject; object != NULL; object = object->getParent())151 for (WorldEntity* object = otherObject; object != nullptr; object = object->getParent()) 152 152 if (otherObject == this->getShooter()) 153 153 return true; -
code/trunk/src/modules/weapons/projectiles/BillboardProjectile.h
r10629 r11071 61 61 virtual void setMaterial(const std::string& material); 62 62 virtual const std::string& getMaterial(); 63 virtual void changedVisibility() ;63 virtual void changedVisibility() override; 64 64 65 65 private: -
code/trunk/src/modules/weapons/projectiles/GravityBomb.cc
r10622 r11071 28 28 this->timeToLife_= LIFETIME; 29 29 this->setCollisionResponse(false); 30 this->setCollisionType(WorldEntity:: Dynamic);30 this->setCollisionType(WorldEntity::CollisionType::Dynamic); 31 31 this->enableCollisionCallback(); 32 32 -
code/trunk/src/modules/weapons/projectiles/GravityBomb.h
r10622 r11071 41 41 GravityBomb(Context* context); 42 42 virtual ~GravityBomb(); 43 virtual void tick(float dt) ;43 virtual void tick(float dt) override; 44 44 45 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;45 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 46 46 void detonate(); 47 47 private: -
code/trunk/src/modules/weapons/projectiles/GravityBombField.cc
r11052 r11071 41 41 //Make the Field visible on Radar and minimap. 42 42 this->setRadarObjectColour(ColourValue(1.0, 0.0, 0.2,1)); // Red 43 this->setRadarObjectShape(RadarViewable:: Dot);43 this->setRadarObjectShape(RadarViewable::Shape::Dot); 44 44 this->setRadarObjectScale(1.0f); 45 45 … … 125 125 126 126 //Check if any pawn is inside the shockwave and hit it with dammage proportional to the distance between explosion centre and pawn. Make sure, the same pawn is damaged only once. 127 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)127 for (Pawn* pawn : ObjectList<Pawn>()) 128 128 { 129 Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();129 Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition(); 130 130 //orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl; 131 131 if(distanceVector.length()< forceSphereRadius_) 132 132 { 133 133 //orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length(); 134 if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(), *it) == victimsAlreadyDamaged_.end())134 if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),pawn) == victimsAlreadyDamaged_.end()) 135 135 { 136 136 //orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl; 137 137 float damage = FORCE_FIELD_EXPLOSION_DAMMAGE*(1-distanceVector.length()/EXPLOSION_RADIUS); 138 138 //orxout(debug_output) << "Damage: " << damage << endl; 139 it->hit(shooter_, it->getWorldPosition(), NULL, damage, 0,0);140 victimsAlreadyDamaged_.push_back( *it);139 pawn->hit(shooter_, pawn->getWorldPosition(), nullptr, damage, 0,0); 140 victimsAlreadyDamaged_.push_back(pawn); 141 141 } 142 142 } -
code/trunk/src/modules/weapons/projectiles/GravityBombField.h
r10622 r11071 39 39 GravityBombField(Context* context); 40 40 virtual ~GravityBombField(); 41 virtual void tick(float dt) ;41 virtual void tick(float dt) override; 42 42 virtual void destroy(); 43 43 -
code/trunk/src/modules/weapons/projectiles/IceGunProjectile.cc
r11052 r11071 120 120 Vector3 offset = this->getWorldPosition() - otherObject->getWorldPosition(); 121 121 freezer->setPosition(Vector3(0,0,0)); 122 freezer->translate(offset, WorldEntity:: World);122 freezer->translate(offset, WorldEntity::TransformSpace::World); 123 123 // Start the freezing effect. 124 124 freezer->startFreezing(); -
code/trunk/src/modules/weapons/projectiles/IceGunProjectile.h
r11052 r11071 62 62 63 63 protected: 64 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;64 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 65 65 static const float particleDestructionDelay_; 66 66 private: -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.cc
r10622 r11071 48 48 this->textureIndex_ = 1; 49 49 this->setMass(2); 50 this->setCollisionType( Dynamic);50 this->setCollisionType(CollisionType::Dynamic); 51 51 this->maxTextureIndex_ = 8; 52 52 this->textureTimer_.setTimer(0.01f, true, createExecutor(createFunctor(&LightningGunProjectile::changeTexture, this))); -
code/trunk/src/modules/weapons/projectiles/LightningGunProjectile.h
r9667 r11071 58 58 virtual ~LightningGunProjectile() {} 59 59 60 virtual void setMaterial(const std::string& material) ;60 virtual void setMaterial(const std::string& material) override; 61 61 62 62 private: -
code/trunk/src/modules/weapons/projectiles/MineProjectile.cc
r11052 r11071 112 112 modelRing4_->yaw(Degree(270)); 113 113 114 emitter_ = NULL;114 emitter_ = nullptr; 115 115 116 116 if (GameMode::isMaster()) … … 121 121 this->enableCollisionCallback(); 122 122 this->setCollisionResponse(true); 123 this->setCollisionType( Dynamic);123 this->setCollisionType(CollisionType::Dynamic); 124 124 125 125 // Create a sphere collision shape and attach it to the projectile. … … 217 217 { 218 218 // Damage all pawns within the damage radius 219 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)219 for (Pawn* pawn : ObjectList<Pawn>()) 220 220 { 221 Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();221 Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition(); 222 222 if(distanceVector.length()< damageRadius_) 223 223 { 224 it->hit(this->getShooter(), it->getWorldPosition(), NULL, this->getDamage(), this->getHealthDamage(), this->getShieldDamage());224 pawn->hit(this->getShooter(), pawn->getWorldPosition(), nullptr, this->getDamage(), this->getHealthDamage(), this->getShieldDamage()); 225 225 } 226 226 } -
code/trunk/src/modules/weapons/projectiles/MineProjectile.h
r11052 r11071 57 57 virtual ~MineProjectile(); 58 58 59 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;59 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 60 60 61 v irtual void setMaxTimeUntilExplosion(float maxTimeUntilExplosion);62 v irtual void setTimeUntilActivation(float timeUntilActivation);61 void setMaxTimeUntilExplosion(float maxTimeUntilExplosion); 62 void setTimeUntilActivation(float timeUntilActivation); 63 63 protected: 64 64 static const float triggerRadius_; … … 84 84 WeakPtr<DistanceTrigger> distanceTrigger_; 85 85 86 v irtual void destructionEffect();87 v irtual void allowExplosion();88 v irtual void explode();86 void destructionEffect(); 87 void allowExplosion(); 88 void explode(); 89 89 }; 90 90 } -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.cc
r10624 r11071 58 58 } 59 59 else 60 this->particles_ = 0;60 this->particles_ = nullptr; 61 61 } 62 62 -
code/trunk/src/modules/weapons/projectiles/ParticleProjectile.h
r9667 r11071 53 53 ParticleProjectile(Context* context); 54 54 virtual ~ParticleProjectile(); 55 virtual void changedVisibility() ;55 virtual void changedVisibility() override; 56 56 57 57 private: -
code/trunk/src/modules/weapons/projectiles/Projectile.cc
r10629 r11071 57 57 this->enableCollisionCallback(); 58 58 this->setCollisionResponse(false); 59 this->setCollisionType( Dynamic);59 this->setCollisionType(CollisionType::Dynamic); 60 60 61 61 // Create a sphere collision shape and attach it to the projectile. … … 94 94 void Projectile::setCollisionShapeRadius(float radius) 95 95 { 96 if (collisionShape_ != NULL&& radius > 0)96 if (collisionShape_ != nullptr && radius > 0) 97 97 { 98 98 collisionShape_->setRadius(radius); -
code/trunk/src/modules/weapons/projectiles/Projectile.h
r11052 r11071 64 64 void setConfigValues(); 65 65 66 virtual void tick(float dt) ;67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;66 virtual void tick(float dt) override; 67 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 68 68 69 69 protected: -
code/trunk/src/modules/weapons/projectiles/Rocket.cc
r11052 r11071 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->setVelocity(0,0,-100); 74 74 … … 92 92 this->enableCollisionCallback(); 93 93 this->setCollisionResponse(false); 94 this->setCollisionType( Kinematic);94 this->setCollisionType(CollisionType::Kinematic); 95 95 96 96 // Add collision shape … … 117 117 else 118 118 { 119 this->defSndWpnEngine_ = 0;120 this->defSndWpnLaunch_ = 0;119 this->defSndWpnEngine_ = nullptr; 120 this->defSndWpnLaunch_ = nullptr; 121 121 } 122 122 … … 128 128 129 129 this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange 130 this->setRadarObjectShape(RadarViewable:: Triangle);130 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 131 131 this->setRadarObjectScale(0.5f); 132 132 } -
code/trunk/src/modules/weapons/projectiles/Rocket.h
r11052 r11071 62 62 virtual ~Rocket(); 63 63 64 virtual void tick(float dt) ; //!< Defines which actions the Rocket has to take in each tick.64 virtual void tick(float dt) override; //!< Defines which actions the Rocket has to take in each tick. 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;67 virtual void destroyObject(void) ;66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 67 virtual void destroyObject(void) override; 68 68 void destructionEffect(); 69 69 70 virtual void moveFrontBack(const Vector2& value) {}71 virtual void moveRightLeft(const Vector2& value) {}72 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) override {} 71 virtual void moveRightLeft(const Vector2& value) override {} 72 virtual void moveUpDown(const Vector2& value) override {} 73 73 74 virtual void rotateYaw(const Vector2& value) ;75 virtual void rotatePitch(const Vector2& value) ;76 virtual void rotateRoll(const Vector2& value) ;74 virtual void rotateYaw(const Vector2& value) override; 75 virtual void rotatePitch(const Vector2& value) override; 76 virtual void rotateRoll(const Vector2& value) override; 77 77 78 78 /** … … 114 114 { this->rotateRoll(Vector2(value, 0)); } 115 115 116 virtual void setShooter(Pawn* shooter) ;116 virtual void setShooter(Pawn* shooter) override; 117 117 118 virtual void fired(unsigned int firemode) ;118 virtual void fired(unsigned int firemode) override; 119 119 120 120 /** 121 121 @brief Set the maximum lifetime of the rocket. 122 122 */ 123 v irtual void setMaxFuel(float fuel);123 void setMaxFuel(float fuel); 124 124 /** 125 125 @brief Get the maximum lifetime of the rocket. … … 127 127 inline float getMaxFuel() const 128 128 { return lifetime_; } 129 virtualfloat getFuel() const;129 float getFuel() const; 130 130 131 131 private: -
code/trunk/src/modules/weapons/projectiles/RocketOld.cc
r10622 r11071 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->setVelocity(0,0,-100); 74 74 … … 92 92 this->enableCollisionCallback(); 93 93 this->setCollisionResponse(false); 94 this->setCollisionType( Kinematic);94 this->setCollisionType(CollisionType::Kinematic); 95 95 96 96 // Add collision shape … … 117 117 else 118 118 { 119 this->defSndWpnEngine_ = 0;120 this->defSndWpnLaunch_ = 0;119 this->defSndWpnEngine_ = nullptr; 120 this->defSndWpnLaunch_ = nullptr; 121 121 } 122 122 … … 128 128 129 129 this->setRadarObjectColour(ColourValue(1.0, 0.5, 0.0)); // orange 130 this->setRadarObjectShape(RadarViewable:: Triangle);130 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 131 131 this->setRadarObjectScale(0.5f); 132 132 } -
code/trunk/src/modules/weapons/projectiles/RocketOld.h
r10622 r11071 62 62 virtual ~RocketOld(); 63 63 64 virtual void tick(float dt) ; //!< Defines which actions the RocketOld has to take in each tick.64 virtual void tick(float dt) override; //!< Defines which actions the RocketOld has to take in each tick. 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;67 virtual void destroyObject(void) ;66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 67 virtual void destroyObject(void) override; 68 68 void destructionEffect(); 69 69 70 virtual void moveFrontBack(const Vector2& value) {}71 virtual void moveRightLeft(const Vector2& value) {}72 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) override {} 71 virtual void moveRightLeft(const Vector2& value) override {} 72 virtual void moveUpDown(const Vector2& value) override {} 73 73 74 virtual void rotateYaw(const Vector2& value) ;75 virtual void rotatePitch(const Vector2& value) ;76 virtual void rotateRoll(const Vector2& value) ;74 virtual void rotateYaw(const Vector2& value) override; 75 virtual void rotatePitch(const Vector2& value) override; 76 virtual void rotateRoll(const Vector2& value) override; 77 77 78 78 /** … … 114 114 { this->rotateRoll(Vector2(value, 0)); } 115 115 116 virtual void setShooter(Pawn* shooter) ;116 virtual void setShooter(Pawn* shooter) override; 117 117 118 virtual void fired(unsigned int firemode) ;118 virtual void fired(unsigned int firemode) override; 119 119 120 120 private: -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.cc
r11052 r11071 70 70 if (GameMode::isMaster()) 71 71 { 72 this->setCollisionType(WorldEntity:: Kinematic);72 this->setCollisionType(WorldEntity::CollisionType::Kinematic); 73 73 this->fuel_ = true; 74 74 … … 87 87 this->enableCollisionCallback(); 88 88 this->setCollisionResponse(false); 89 this->setCollisionType( Kinematic);89 this->setCollisionType(CollisionType::Kinematic); 90 90 91 91 // Add collision shape. … … 101 101 102 102 this->setRadarObjectColour(ColourValue(1.0, 1.0, 0.0)); // yellow 103 this->setRadarObjectShape(RadarViewable:: Triangle);103 this->setRadarObjectShape(RadarViewable::Shape::Triangle); 104 104 this->setRadarObjectScale(0.5f); 105 105 } -
code/trunk/src/modules/weapons/projectiles/SimpleRocket.h
r10216 r11071 62 62 SimpleRocket(Context* context); 63 63 virtual ~SimpleRocket(); 64 virtual void tick(float dt) ;64 virtual void tick(float dt) override; 65 65 66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;66 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 67 67 68 68 void disableFire(); //!< Method to disable the fire and stop all acceleration 69 69 70 virtual void moveFrontBack(const Vector2& value) {}71 virtual void moveRightLeft(const Vector2& value) {}72 virtual void moveUpDown(const Vector2& value) {}70 virtual void moveFrontBack(const Vector2& value) override{} 71 virtual void moveRightLeft(const Vector2& value) override{} 72 virtual void moveUpDown(const Vector2& value) override{} 73 73 74 virtual void rotateYaw(const Vector2& value) ;75 virtual void rotatePitch(const Vector2& value) ;76 virtual void rotateRoll(const Vector2& value) ;74 virtual void rotateYaw(const Vector2& value) override; 75 virtual void rotatePitch(const Vector2& value) override; 76 virtual void rotateRoll(const Vector2& value) override; 77 77 void setDestroy(); 78 78 … … 115 115 { this->rotateRoll(Vector2(value, 0)); } 116 116 117 virtual void setShooter(Pawn* shooter) ;117 virtual void setShooter(Pawn* shooter) override; 118 118 119 119 inline bool hasFuel() const -
code/trunk/src/modules/weapons/weaponmodes/EnergyDrink.h
r9667 r11071 57 57 virtual ~EnergyDrink() {} 58 58 59 virtual void fire() ;60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;59 virtual void fire() override; 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 61 61 62 62 private: -
code/trunk/src/modules/weapons/weaponmodes/FusionFire.h
r9667 r11071 54 54 virtual ~FusionFire() {} 55 55 56 virtual void fire() ;56 virtual void fire() override; 57 57 58 58 private: -
code/trunk/src/modules/weapons/weaponmodes/GravityBombFire.h
r10622 r11071 34 34 virtual ~GravityBombFire(); 35 35 36 virtual void fire() ;36 virtual void fire() override; 37 37 38 38 private: -
code/trunk/src/modules/weapons/weaponmodes/HsW01.h
r9945 r11071 56 56 virtual ~HsW01(); 57 57 58 virtual void fire() ;59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;58 virtual void fire() override; 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 60 60 61 61 protected: -
code/trunk/src/modules/weapons/weaponmodes/IceGun.h
r11052 r11071 54 54 virtual ~IceGun(); 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;57 virtual void fire() ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 virtual void fire() override; 58 58 59 59 inline void setFreezeTime(float freezeTime) -
code/trunk/src/modules/weapons/weaponmodes/LaserFire.h
r9667 r11071 54 54 virtual ~LaserFire() {} 55 55 56 virtual void fire() ;56 virtual void fire() override; 57 57 58 58 private: -
code/trunk/src/modules/weapons/weaponmodes/LightningGun.h
r9667 r11071 54 54 virtual ~LightningGun(); 55 55 56 virtual void fire() ;56 virtual void fire() override; 57 57 58 58 private: -
code/trunk/src/modules/weapons/weaponmodes/MineGun.h
r11052 r11071 59 59 virtual ~MineGun(); 60 60 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;62 virtual void fire() ;61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 62 virtual void fire() override; 63 63 64 64 inline float getMaxTimeUntilExplosion() const -
code/trunk/src/modules/weapons/weaponmodes/RocketFire.h
r11052 r11071 54 54 virtual ~RocketFire(); 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 57 58 virtual void fire() ;58 virtual void fire() override; 59 59 inline void setFuel(float fuel) 60 60 { this->fuel_ = fuel; } -
code/trunk/src/modules/weapons/weaponmodes/RocketFireOld.h
r10622 r11071 54 54 virtual ~RocketFireOld(); 55 55 56 virtual void fire() ;56 virtual void fire() override; 57 57 58 58 private: -
code/trunk/src/modules/weapons/weaponmodes/SimpleRocketFire.h
r9667 r11071 53 53 virtual ~SimpleRocketFire(); 54 54 void deactivateFire(); 55 virtual void fire() ;55 virtual void fire() override; 56 56 57 57 private: -
code/trunk/src/modules/weapons/weaponmodes/SplitGun.h
r11052 r11071 54 54 virtual ~SplitGun(); 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;57 virtual void fire() ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 virtual void fire() override; 58 58 59 59 inline void setNumberOfSplits(int numberOfSplits)
Note: See TracChangeset
for help on using the changeset viewer.