Changeset 11054 for code/branches/cpp11_v3/src/orxonox
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 185 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
code/branches/cpp11_v3/src/orxonox/CameraManager.cc
r10624 r11054 60 60 return this->cameraList_.front(); 61 61 else 62 return 0;62 return nullptr; 63 63 } 64 64 … … 93 93 this->cameraList_.front()->setFocus(); 94 94 else 95 this->useCamera( NULL);95 this->useCamera(nullptr); 96 96 } 97 97 else -
code/branches/cpp11_v3/src/orxonox/CameraManager.h
r9667 r11054 59 59 60 60 private: 61 CameraManager(const CameraManager&); // don't use 61 // non-copyable: 62 CameraManager(const CameraManager&) = delete; 63 CameraManager& operator=(const CameraManager&) = delete; 62 64 63 65 std::list<Camera*> cameraList_; -
code/branches/cpp11_v3/src/orxonox/Level.cc
r10624 r11054 30 30 31 31 #include "util/Math.h" 32 #include "util/SubString.h" 32 33 #include "core/CoreIncludes.h" 33 34 #include "core/Loader.h" … … 54 55 this->registerVariables(); 55 56 this->xmlfilename_ = this->getFilename(); 56 this->xmlfile_ = 0;57 this->xmlfile_ = nullptr; 57 58 } 58 59 … … 105 106 void Level::networkCallbackTemplatesChanged() 106 107 { 107 for( std::set<std::string>::iterator it = this->networkTemplateNames_.begin(); it!=this->networkTemplateNames_.end(); ++it)108 { 109 assert(Template::getTemplate( *it));110 Template::getTemplate( *it)->applyOn(this);108 for(const std::string& name : this->networkTemplateNames_) 109 { 110 assert(Template::getTemplate(name)); 111 Template::getTemplate(name)->applyOn(this); 111 112 } 112 113 } … … 134 135 // objects alive when ~Level is called. This is the reason why we cannot directly destroy() the Plugins - instead we need 135 136 // to call destroyLater() to ensure that no instances from this plugin exist anymore. 136 for ( std::list<PluginReference*>::iterator it = this->plugins_.begin(); it != this->plugins_.end(); ++it)137 (*it)->destroyLater();137 for (PluginReference* plugin : this->plugins_) 138 plugin->destroyLater(); 138 139 this->plugins_.clear(); 139 140 } … … 172 173 { 173 174 unsigned int i = 0; 174 for ( std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)175 for (BaseObject* object : this->objects_) 175 176 { 176 177 if (i == index) 177 return (*it);178 return object; 178 179 ++i; 179 180 } 180 return 0;181 return nullptr; 181 182 } 182 183 … … 195 196 return this->lodInformation_.find(meshName)->second; 196 197 197 return 0;198 return nullptr; 198 199 } 199 200 … … 207 208 { 208 209 orxout(internal_info) << "player left level (id: " << player->getClientID() << ", name: " << player->getName() << ')' << endl; 209 player->switchGametype( 0);210 player->switchGametype(nullptr); 210 211 } 211 212 } -
code/branches/cpp11_v3/src/orxonox/Level.h
r10624 r11054 37 37 #include "core/BaseObject.h" 38 38 #include "network/synchronisable/Synchronisable.h" 39 #include "core/object/Context.h" 39 40 #include "graphics/MeshLodInformation.h" 40 41 … … 47 48 virtual ~Level(); 48 49 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;50 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 50 51 51 52 void playerEntered(PlayerInfo* player); -
code/branches/cpp11_v3/src/orxonox/LevelInfo.cc
r9667 r11054 106 106 { 107 107 SubString substr = SubString(tags, ",", " "); // Split the string into tags. 108 const std::vector<std::string>& strings = substr.getAllStrings();109 for ( std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)110 this->addTag( *it, false);108 const std::vector<std::string>& tokens = substr.getAllStrings(); 109 for (const std::string& token : tokens) 110 this->addTag(token, false); 111 111 112 112 this->tagsUpdated(); … … 121 121 { 122 122 SubString substr = SubString(ships, ",", " "); // Split the string into tags. 123 const std::vector<std::string>& strings = substr.getAllStrings();124 for( std::vector<std::string>::const_iterator it = strings.begin(); it != strings.end(); it++)125 this->addStartingShip( *it, false);123 const std::vector<std::string>& tokens = substr.getAllStrings(); 124 for(const std::string& token : tokens) 125 this->addStartingShip(token, false); 126 126 127 127 this->startingshipsUpdated(); -
code/branches/cpp11_v3/src/orxonox/LevelInfo.h
r9667 r11054 207 207 virtual ~LevelInfo(); 208 208 209 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Creates a LevelInfo object through XML.209 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Creates a LevelInfo object through XML. 210 210 211 211 /** -
code/branches/cpp11_v3/src/orxonox/LevelManager.cc
r11020 r11054 78 78 { 79 79 // Delete all the LevelInfoItem objects because the LevelManager created them 80 std::set<LevelInfoItem*, LevelInfoCompare>::iterator it = availableLevels_.begin(); 81 for (; it != availableLevels_.end(); ++it) 82 (*it)->destroy(); 80 for (LevelInfoItem* info : availableLevels_) 81 info->destroy(); 83 82 } 84 83 … … 154 153 Get the currently active Level. 155 154 @return 156 Returns a pointer to the currently active level or NULLif there currently are no active Levels.155 Returns a pointer to the currently active level or nullptr if there currently are no active Levels. 157 156 */ 158 157 Level* LevelManager::getActiveLevel() … … 161 160 return this->levels_.front(); 162 161 else 163 return 0;162 return nullptr; 164 163 } 165 164 … … 175 174 this->levels_.front()->setActive(true); 176 175 // Make every player enter the newly activated level. 177 for ( std::map<unsigned int, PlayerInfo*>::const_iterator it = PlayerManager::getInstance().getClients().begin(); it != PlayerManager::getInstance().getClients().end(); ++it)178 this->levels_.front()->playerEntered( it->second);176 for (const auto& mapEntry : PlayerManager::getInstance().getClients()) 177 this->levels_.front()->playerEntered(mapEntry.second); 179 178 } 180 179 } … … 218 217 { 219 218 if(index >= this->availableLevels_.size()) 220 return NULL;219 return nullptr; 221 220 222 221 // If this index directly follows the last we can optimize a lot. … … 272 271 if (it->find("old/") != 0) 273 272 { 274 LevelInfoItem* info = NULL;273 LevelInfoItem* info = nullptr; 275 274 276 275 // Load the LevelInfo object from the level file. … … 279 278 280 279 // Find the LevelInfo object we've just loaded (if there was one) 281 for( ObjectList<LevelInfo>::iterator item = ObjectList<LevelInfo>::begin(); item != ObjectList<LevelInfo>::end(); ++item)282 if( item->getXMLFilename() == *it)283 info = item->copy();280 for(LevelInfo* levelInfo : ObjectList<LevelInfo>()) 281 if(levelInfo->getXMLFilename() == *it) 282 info = levelInfo->copy(); 284 283 285 284 // We don't need the loaded stuff anymore 286 285 Loader::getInstance().unload(&file); 287 286 288 if(info == NULL)287 if(info == nullptr) 289 288 { 290 289 // Create a default LevelInfoItem object that merely contains the name -
code/branches/cpp11_v3/src/orxonox/LevelManager.h
r10258 r11054 109 109 110 110 private: 111 LevelManager(const LevelManager&); 111 // non-copyable: 112 LevelManager(const LevelManager&) = delete; 113 LevelManager& operator=(const LevelManager&) = delete; 112 114 113 115 void activateNextLevel(); //!< Activate the next level. -
code/branches/cpp11_v3/src/orxonox/MoodManager.cc
r10624 r11054 103 103 /*static*/ void MoodListener::changedMood(const std::string& mood) 104 104 { 105 for ( ObjectList<MoodListener>::iterator it = ObjectList<MoodListener>::begin(); it; ++it)106 it->moodChanged(mood);105 for (MoodListener* listener : ObjectList<MoodListener>()) 106 listener->moodChanged(mood); 107 107 } 108 108 } -
code/branches/cpp11_v3/src/orxonox/PlayerManager.cc
r10624 r11054 62 62 63 63 // create new HumanPlayer instance 64 HumanPlayer* player = new HumanPlayer( 0);64 HumanPlayer* player = new HumanPlayer(nullptr); 65 65 player->setClientID(clientID); 66 66 … … 111 111 else 112 112 { 113 for ( ObjectList<PlayerInfo>::iterator it = ObjectList<PlayerInfo>::begin(); it != ObjectList<PlayerInfo>::end(); ++it)114 if (i t->getClientID() == clientID)115 return (*it);113 for (PlayerInfo* info : ObjectList<PlayerInfo>()) 114 if (info->getClientID() == clientID) 115 return info; 116 116 } 117 return 0;117 return nullptr; 118 118 } 119 119 } -
code/branches/cpp11_v3/src/orxonox/PlayerManager.h
r5966 r11054 50 50 { return this->clients_; } 51 51 52 v oid clientConnected(unsigned int clientID);53 v oid clientDisconnected(unsigned int clientID);52 virtual void clientConnected(unsigned int clientID) override; 53 virtual void clientDisconnected(unsigned int clientID) override; 54 54 void disconnectAllClients(); 55 55 -
code/branches/cpp11_v3/src/orxonox/Radar.cc
r10624 r11054 49 49 50 50 Radar::Radar() 51 : itFocus_( 0)52 , focus_( 0)51 : itFocus_(nullptr) 52 , focus_(nullptr) 53 53 , objectTypeCounter_(0) 54 54 { … … 84 84 this->radarObjects_.insert(rv); 85 85 // iterate through all radarlisteners and notify them 86 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)87 { 88 (*itListener)->addObject(rv);86 for (RadarListener* listener : ObjectList<RadarListener>()) 87 { 88 listener->addObject(rv); 89 89 } 90 90 } … … 95 95 this->radarObjects_.erase(rv); 96 96 // iterate through all radarlisteners and notify them 97 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)98 { 99 (*itListener)->removeObject(rv);97 for (RadarListener* listener : ObjectList<RadarListener>()) 98 { 99 listener->removeObject(rv); 100 100 } 101 101 } … … 106 106 return *(this->itFocus_); 107 107 else 108 return 0;108 return nullptr; 109 109 } 110 110 … … 126 126 { 127 127 // focus object was deleted, release focus 128 this->focus_ = 0;129 this->itFocus_ = 0;130 } 131 132 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)133 { 134 (*itListener)->radarTick(dt);128 this->focus_ = nullptr; 129 this->itFocus_ = nullptr; 130 } 131 132 for (RadarListener* listener : ObjectList<RadarListener>()) 133 { 134 listener->radarTick(dt); 135 135 } 136 136 } … … 138 138 void Radar::cycleFocus() 139 139 { 140 if (ObjectList<RadarViewable>::begin() == ObjectList<RadarViewable>::end()) 140 ObjectList<RadarViewable> listRadarViewable; 141 if (listRadarViewable.size() == 0) 141 142 { 142 143 // list is empty 143 this->itFocus_ = 0;144 this->focus_ = 0;144 this->itFocus_ = nullptr; 145 this->focus_ = nullptr; 145 146 } 146 147 … … 156 157 float nextDistance = FLT_MAX; 157 158 float minimumDistance = FLT_MAX; 158 ObjectList<RadarViewable>::iterator itFallback = 0;159 160 for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it)159 ObjectList<RadarViewable>::iterator itFallback = nullptr; 160 161 for (ObjectList<RadarViewable>::iterator it = listRadarViewable.begin(); it; ++it) 161 162 { 162 163 if (*it == static_cast<RadarViewable*>(HumanController::getLocalControllerEntityAsPawn())) … … 191 192 void Radar::releaseFocus() 192 193 { 193 this->itFocus_ = 0;194 this->focus_ = 0;194 this->itFocus_ = nullptr; 195 this->focus_ = nullptr; 195 196 } 196 197 … … 200 201 // iterate through all Radar Objects 201 202 unsigned int i = 0; 202 for (ObjectList<RadarViewable>::iterator it = ObjectList<RadarViewable>::begin(); it; ++it, ++i) 203 { 204 orxout(debug_output) << i++ << ": " << (*it)->getRVWorldPosition() << endl; 203 for (RadarViewable* viewable : ObjectList<RadarViewable>()) 204 { 205 orxout(debug_output) << i++ << ": " << viewable->getRVWorldPosition() << endl; 206 ++i; 205 207 } 206 208 } … … 208 210 void Radar::radarObjectChanged(RadarViewable* rv) 209 211 { 210 for ( ObjectList<RadarListener>::iterator itListener = ObjectList<RadarListener>::begin(); itListener; ++itListener)211 { 212 (*itListener)->objectChanged(rv);212 for (RadarListener* listener : ObjectList<RadarListener>()) 213 { 214 listener->objectChanged(rv); 213 215 } 214 216 } -
code/branches/cpp11_v3/src/orxonox/Radar.h
r9667 r11054 54 54 virtual ~Radar(); 55 55 56 virtual void tick(float dt) ;56 virtual void tick(float dt) override; 57 57 58 58 const RadarViewable* getFocus(); -
code/branches/cpp11_v3/src/orxonox/Scene.cc
r10727 r11054 66 66 this->bShadows_ = true; 67 67 this->bDebugDrawPhysics_ = false; 68 this->debugDrawer_ = NULL;68 this->debugDrawer_ = nullptr; 69 69 this->soundReferenceDistance_ = 20.0; 70 70 this->bIsUpdatingPhysics_ = false; … … 84 84 this->rootSceneNode_ = this->sceneManager_->getRootSceneNode(); 85 85 86 this->radar_ = 0;86 this->radar_ = nullptr; 87 87 } 88 88 … … 92 92 this->positiveWorldRange_ = Vector3::UNIT_SCALE * defaultMaxWorldSize; 93 93 this->gravity_ = Vector3::ZERO; 94 this->physicalWorld_ = 0;95 this->solver_ = 0;96 this->dispatcher_ = 0;97 this->collisionConfig_ = 0;98 this->broadphase_ = 0;94 this->physicalWorld_ = nullptr; 95 this->solver_ = nullptr; 96 this->dispatcher_ = nullptr; 97 this->collisionConfig_ = nullptr; 98 this->broadphase_ = nullptr; 99 99 100 100 this->registerVariables(); … … 220 220 { 221 221 // Remove all WorldEntities and shove them to the queue since they would still like to be in a physical world. 222 for (std::set<WorldEntity*>::const_iterator it = this->physicalObjects_.begin(); 223 it != this->physicalObjects_.end(); ++it) 222 for (WorldEntity* object : this->physicalObjects_) 224 223 { 225 this->physicalWorld_->removeRigidBody( (*it)->physicalBody_);226 this->physicalObjectQueue_.insert( *it);224 this->physicalWorld_->removeRigidBody(object->physicalBody_); 225 this->physicalObjectQueue_.insert(object); 227 226 } 228 227 this->physicalObjects_.clear(); … … 234 233 delete this->collisionConfig_; 235 234 delete this->broadphase_; 236 this->physicalWorld_ = 0;237 this->solver_ = 0;238 this->dispatcher_ = 0;239 this->collisionConfig_ = 0;240 this->broadphase_ = 0;235 this->physicalWorld_ = nullptr; 236 this->solver_ = nullptr; 237 this->dispatcher_ = nullptr; 238 this->collisionConfig_ = nullptr; 239 this->broadphase_ = nullptr; 241 240 } 242 241 } … … 256 255 { 257 256 // Add all scheduled WorldEntities 258 for (std::set<WorldEntity*>::const_iterator it = this->physicalObjectQueue_.begin(); 259 it != this->physicalObjectQueue_.end(); ++it) 257 for (WorldEntity* object : this->physicalObjectQueue_) 260 258 { 261 this->physicalWorld_->addRigidBody( (*it)->physicalBody_);262 this->physicalObjects_.insert( *it);259 this->physicalWorld_->addRigidBody(object->physicalBody_); 260 this->physicalObjects_.insert(object); 263 261 } 264 262 this->physicalObjectQueue_.clear(); … … 321 319 { 322 320 unsigned int i = 0; 323 for ( std::list<BaseObject*>::const_iterator it = this->objects_.begin(); it != this->objects_.end(); ++it)321 for (BaseObject* object : this->objects_) 324 322 { 325 323 if (i == index) 326 return (*it);324 return object; 327 325 ++i; 328 326 } 329 return 0;327 return nullptr; 330 328 } 331 329 … … 391 389 /*static*/ void Scene::consoleCommand_debugDrawPhysics(bool bDraw, bool bFill, float fillAlpha) 392 390 { 393 for ( ObjectListIterator<Scene> it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it)394 it->setDebugDrawPhysics(bDraw, bFill, fillAlpha);391 for (Scene* scene : ObjectList<Scene>()) 392 scene->setDebugDrawPhysics(bDraw, bFill, fillAlpha); 395 393 } 396 394 } -
code/branches/cpp11_v3/src/orxonox/Scene.h
r10624 r11054 40 40 #include "util/OgreForwardRefs.h" 41 41 #include "core/BaseObject.h" 42 #include "core/object/Context.h" 42 43 #include "network/synchronisable/Synchronisable.h" 43 44 #include "tools/interfaces/Tickable.h" … … 51 52 virtual ~Scene(); 52 53 53 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 54 55 void registerVariables(); 55 56 … … 79 80 { return this->radar_; } 80 81 81 inline virtual uint32_t getSceneID() const{ return this->getObjectID(); }82 virtual inline uint32_t getSceneID() const override { return this->getObjectID(); } 82 83 83 virtual void tick(float dt) ;84 virtual void tick(float dt) override; 84 85 85 86 private: … … 111 112 public: 112 113 inline bool hasPhysics() const 113 { return this->physicalWorld_ != 0; }114 { return this->physicalWorld_ != nullptr; } 114 115 void setPhysicalWorld(bool wantsPhysics); 115 116 -
code/branches/cpp11_v3/src/orxonox/Test.cc
r10624 r11054 54 54 registerMemberNetworkFunction( Test, printBlaBla ); 55 55 56 Test* Test::instance_ = 0;56 Test* Test::instance_ = nullptr; 57 57 58 58 Test::Test(Context* context) : BaseObject(context), Synchronisable(context) 59 59 { 60 assert(instance_== 0);60 assert(instance_==nullptr); 61 61 instance_=this; 62 62 RegisterObject ( Test ); … … 64 64 registerVariables(); 65 65 setSyncMode(0x3); 66 this->pointer_ = 0;66 this->pointer_ = nullptr; 67 67 } 68 68 69 69 Test::~Test() 70 70 { 71 instance_= 0;71 instance_=nullptr; 72 72 } 73 73 -
code/branches/cpp11_v3/src/orxonox/chat/ChatHistory.cc
r10624 r11054 30 30 #include "core/singleton/ScopedSingletonIncludes.h" 31 31 #include "core/ConfigurablePaths.h" 32 #include "core/CoreIncludes.h" 32 33 33 34 #ifndef CHATTEST … … 159 160 void ChatHistory::debug_printhist() 160 161 { 161 /* create deque iterator */162 std::deque<std::string>::iterator it;163 164 162 /* output all the strings */ 165 for( it = this->hist_buffer.begin(); it != this->hist_buffer.end(); 166 ++it ) 167 orxout(debug_output) << *it << endl; 163 for( const std::string& hist : this->hist_buffer ) 164 orxout(debug_output) << hist << endl; 168 165 169 166 /* output size */ -
code/branches/cpp11_v3/src/orxonox/chat/ChatHistory.h
r10624 r11054 82 82 * \param senderID Identification number of the sender 83 83 */ 84 virtual void incomingChat(const std::string& message, const std::string& name) ;84 virtual void incomingChat(const std::string& message, const std::string& name) override; 85 85 86 86 /** Synchronize logfile onto the hard drive -
code/branches/cpp11_v3/src/orxonox/chat/ChatInputHandler.cc
r10624 r11054 79 79 this->inpbuf = new InputBuffer(); 80 80 this->disp_offset = 0; 81 assert( this->inpbuf != NULL);81 assert( this->inpbuf != nullptr ); 82 82 83 83 /* generate chatbox ui and chatbox-inputonly ui */ -
code/branches/cpp11_v3/src/orxonox/chat/ChatInputHandler.h
r9675 r11054 125 125 * history window of the full chat window) 126 126 */ 127 v oid incomingChat(const std::string& message, const std::string& name);127 virtual void incomingChat(const std::string& message, const std::string& name) override; 128 128 129 129 /** \param full true means show full chat window with history, -
code/branches/cpp11_v3/src/orxonox/chat/ChatManager.cc
r10624 r11054 107 107 108 108 // notify all listeners 109 for ( ObjectList<ChatListener>::iterator it = ObjectList<ChatListener>::begin(); it != ObjectList<ChatListener>::end(); ++it)110 it->incomingChat(text, name);109 for (ChatListener* listener : ObjectList<ChatListener>()) 110 listener->incomingChat(text, name); 111 111 } 112 112 -
code/branches/cpp11_v3/src/orxonox/chat/ChatManager.h
r8858 r11054 47 47 public: 48 48 ChatManager(); 49 virtual ~ChatManager() {}49 virtual ~ChatManager() = default; 50 50 51 51 static void message(const std::string& message, unsigned int targetID = NETWORK_PEER_ID_BROADCAST); … … 53 53 54 54 protected: 55 ChatManager(const ChatManager&); 55 // non-copyable: 56 ChatManager(const ChatManager&) = delete; 57 ChatManager& operator=(const ChatManager&) = delete; 56 58 57 virtual void incomingChat(const std::string& message, unsigned int sourceID) ;59 virtual void incomingChat(const std::string& message, unsigned int sourceID) override; 58 60 59 61 static ChatManager* singletonPtr_s; -
code/branches/cpp11_v3/src/orxonox/collisionshapes/CollisionShape.cc
r10624 r11054 57 57 RegisterObject(CollisionShape); 58 58 59 this->parent_ = 0;59 this->parent_ = nullptr; 60 60 this->parentID_ = OBJECTID_UNKNOWN; 61 this->collisionShape_ = 0;61 this->collisionShape_ = nullptr; 62 62 this->position_ = Vector3::ZERO; 63 63 this->orientation_ = Quaternion::IDENTITY; … … 154 154 void CollisionShape::notifyDetached() 155 155 { 156 this->parent_ = 0;156 this->parent_ = nullptr; 157 157 this->parentID_ = OBJECTID_UNKNOWN; 158 158 } -
code/branches/cpp11_v3/src/orxonox/collisionshapes/CollisionShape.h
r9667 r11054 61 61 virtual ~CollisionShape(); 62 62 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 64 64 65 65 /** … … 181 181 182 182 btCollisionShape* collisionShape_; //!< The bullet collision shape of this CollisionShape. 183 CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, NULLif it doesn't belong to one.183 CompoundCollisionShape* parent_; //!< The CompoundCollisionShape this CollisionShape belongs to, nullptr if it doesn't belong to one. 184 184 unsigned int parentID_; //!< The objectID of the parent of this CollisionShape, which can either be a CompoundCollisionShape or a WorldEntity. 185 185 -
code/branches/cpp11_v3/src/orxonox/collisionshapes/CompoundCollisionShape.cc
r10624 r11054 65 65 { 66 66 // Delete all children 67 for (std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); 68 it != this->attachedShapes_.end(); ++it) 67 for (const auto& mapEntry : this->attachedShapes_) 69 68 { 70 69 // make sure that the child doesn't want to detach itself --> speedup because of the missing update 71 it->first->notifyDetached();72 it->first->destroy();73 if (this->collisionShape_ == it->second)74 this->collisionShape_ = NULL; // don't destroy it twice70 mapEntry.first->notifyDetached(); 71 mapEntry.first->destroy(); 72 if (this->collisionShape_ == mapEntry.second) 73 this->collisionShape_ = nullptr; // don't destroy it twice 75 74 } 76 75 77 76 delete this->compoundShape_; 78 77 if (this->collisionShape_ == this->compoundShape_) 79 this->collisionShape_ = NULL; // don't destroy it twice78 this->collisionShape_ = nullptr; // don't destroy it twice 80 79 } 81 80 } … … 96 95 void CompoundCollisionShape::attach(CollisionShape* shape) 97 96 { 98 // If either the input shape is NULLor we try to attach the CollisionShape to itself.97 // If either the input shape is nullptr or we try to attach the CollisionShape to itself. 99 98 if (!shape || static_cast<CollisionShape*>(this) == shape) 100 99 return; … … 197 196 void CompoundCollisionShape::updatePublicShape() 198 197 { 199 btCollisionShape* primitive = 0; // The primitive shape, if there is one.198 btCollisionShape* primitive = nullptr; // The primitive shape, if there is one. 200 199 bool bPrimitive = true; // Whether the CompoundCollisionShape has just one non-empty CollisionShape. And that shape also has no transformation. 201 200 bool bEmpty = true; // Whether the CompoundCollisionShape is empty. 202 201 // Iterate over all CollisionShapes that belong to this CompoundCollisionShape. 203 for ( std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)202 for (const auto& mapEntry : this->attachedShapes_) 204 203 { 205 204 // TODO: Make sure this is correct. 206 if ( it->second)205 if (mapEntry.second) 207 206 { 208 207 bEmpty = false; 209 if (! it->first->hasTransform() && bPrimitive)210 primitive = it->second;208 if (!mapEntry.first->hasTransform() && bPrimitive) 209 primitive = mapEntry.second; 211 210 else 212 211 { … … 221 220 { 222 221 // If there was none all along, nothing needs to be changed. 223 if (this->collisionShape_ == 0)222 if (this->collisionShape_ == nullptr) 224 223 return; 225 this->collisionShape_ = 0;224 this->collisionShape_ = nullptr; 226 225 } 227 226 // If the CompoundCollisionShape is just a primitive. … … 247 246 { 248 247 unsigned int i = 0; 249 for ( std::map<CollisionShape*, btCollisionShape*>::const_iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); ++it)248 for (const auto& mapEntry : this->attachedShapes_) 250 249 { 251 250 if (i == index) 252 return it->first;251 return mapEntry.first; 253 252 ++i; 254 253 } 255 return 0;254 return nullptr; 256 255 } 257 256 … … 267 266 std::vector<CollisionShape*> shapes; 268 267 // Iterate through all attached CollisionShapes and add them to the list of shapes. 269 for( std::map<CollisionShape*, btCollisionShape*>::iterator it = this->attachedShapes_.begin(); it != this->attachedShapes_.end(); it++)270 shapes.push_back( it->first);268 for(const auto& mapEntry : this->attachedShapes_) 269 shapes.push_back(mapEntry.first); 271 270 272 271 // Delete the compound shape and create a new one. … … 275 274 276 275 // Re-attach all CollisionShapes. 277 for(std::vector<CollisionShape*>::iterator it = shapes.begin(); it != shapes.end(); it++) 278 { 279 CollisionShape* shape = *it; 276 for(CollisionShape* shape : shapes) 277 { 280 278 shape->setScale3D(this->getScale3D()); 281 279 // Only actually attach if we didn't pick a CompoundCollisionShape with no content. -
code/branches/cpp11_v3/src/orxonox/collisionshapes/CompoundCollisionShape.h
r9667 r11054 61 61 virtual ~CompoundCollisionShape(); 62 62 63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;63 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 64 64 65 65 void attach(CollisionShape* shape); … … 70 70 void updateAttachedShape(CollisionShape* shape); 71 71 72 virtual void changedScale() ;72 virtual void changedScale() override; 73 73 74 74 private: 75 75 void updatePublicShape(); 76 inline virtual btCollisionShape* createNewShape() const77 { assert(false); return 0; }76 virtual inline btCollisionShape* createNewShape() const override 77 { assert(false); return nullptr; } 78 78 79 79 btCompoundShape* compoundShape_; -
code/branches/cpp11_v3/src/orxonox/collisionshapes/WorldEntityCollisionShape.cc
r10624 r11054 43 43 RegisterObject(WorldEntityCollisionShape); 44 44 45 this->worldEntityOwner_ = NULL;45 this->worldEntityOwner_ = nullptr; 46 46 // suppress synchronisation 47 47 this->setSyncMode(ObjectDirection::None); … … 54 54 CollisionShape::updateParent(); 55 55 56 assert(this->worldEntityOwner_ != 0);56 assert(this->worldEntityOwner_ != nullptr); 57 57 this->worldEntityOwner_->notifyCollisionShapeChanged(); 58 58 } -
code/branches/cpp11_v3/src/orxonox/collisionshapes/WorldEntityCollisionShape.h
r10624 r11054 46 46 47 47 protected: 48 virtual void updateParent() ;48 virtual void updateParent() override; 49 49 50 50 private: 51 v oid parentChanged();51 virtual void parentChanged() override; 52 52 53 53 WorldEntity* worldEntityOwner_; -
code/branches/cpp11_v3/src/orxonox/controllers/AIController.cc
r9667 r11054 249 249 } 250 250 else 251 this->setPreviousMode();//If bot dies -> getControllableEntity == NULL-> get out of ROCKET mode251 this->setPreviousMode();//If bot dies -> getControllableEntity == nullptr -> get out of ROCKET mode 252 252 }//END_OF ROCKET MODE 253 253 -
code/branches/cpp11_v3/src/orxonox/controllers/AIController.h
r9667 r11054 44 44 virtual ~AIController(); 45 45 46 virtual void tick(float dt) ; //<! Carrying out the targets set in action().46 virtual void tick(float dt) override; //<! Carrying out the targets set in action(). 47 47 48 48 protected: -
code/branches/cpp11_v3/src/orxonox/controllers/ActionpointController.cc
r11052 r11054 506 506 if (targetName == "") 507 507 break; 508 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)508 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 509 509 { 510 510 if (!this || !this->getControllableEntity()) … … 541 541 if (protectName == "reservedKeyword:human") 542 542 { 543 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)543 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 544 544 { 545 545 if (orxonox_cast<ControllableEntity*>(*itP) && ((*itP)->getController()) && ((*itP)->getController()->getIdentifier()->getName() == "NewHumanController")) … … 551 551 else 552 552 { 553 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)553 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 554 554 { 555 555 if (CommonController::getName(*itP) == protectName) … … 578 578 std::string targetName = p.name; 579 579 580 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)580 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 581 581 { 582 582 if (CommonController::getName(*itP) == targetName) … … 707 707 float minDistance = std::numeric_limits<float>::infinity(); 708 708 Gametype* gt = this->getGametype(); 709 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)709 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 710 710 { 711 711 if (!this || !this->getControllableEntity()) -
code/branches/cpp11_v3/src/orxonox/controllers/ArtificialController.cc
r11052 r11054 56 56 this->currentWaypoint_ = 0; 57 57 this->setAccuracy(5); 58 this->defaultWaypoint_ = NULL;58 this->defaultWaypoint_ = nullptr; 59 59 this->mode_ = DEFAULT;//Vector-implementation: mode_.push_back(DEFAULT); 60 60 } … … 177 177 { 178 178 this->weaponModes_.clear(); // reset previous weapon information 179 WeaponSlot* wSlot = 0;179 WeaponSlot* wSlot = nullptr; 180 180 for(int l=0; (wSlot = pawn->getWeaponSlot(l)) ; l++) 181 181 { 182 WeaponMode* wMode = 0;182 WeaponMode* wMode = nullptr; 183 183 for(int i=0; (wMode = wSlot->getWeapon()->getWeaponmode(i)) ; i++) 184 184 { … … 207 207 void ArtificialController::setAllBotLevel(float level) 208 208 { 209 for ( ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)210 it->setBotLevel(level);209 for (ArtificialController* controller : ObjectList<ArtificialController>()) 210 controller->setBotLevel(level); 211 211 } 212 212 … … 222 222 { 223 223 SpaceShip* ship = orxonox_cast<SpaceShip*>(this->getControllableEntity()); 224 if(ship == NULL) return;224 if(ship == nullptr) return; 225 225 if(ship->getBoostPower()*1.5f > ship->getInitialBoostPower() ) //upper limit ->boost 226 226 this->getControllableEntity()->boost(true); … … 231 231 int ArtificialController::getFiremode(std::string name) 232 232 { 233 for ( std::map< std::string, int >::iterator it = this->weaponModes_.begin(); it != this->weaponModes_.end(); ++it)234 { 235 if ( it->first == name)236 return it->second;233 for (const auto& mapEntry : this->weaponModes_) 234 { 235 if (mapEntry.first == name) 236 return mapEntry.second; 237 237 } 238 238 return -1; … … 249 249 return this->waypoints_[index]; 250 250 else 251 return 0;251 return nullptr; 252 252 } 253 253 … … 258 258 void ArtificialController::updatePointsOfInterest(std::string name, float searchDistance) 259 259 { 260 WorldEntity* waypoint = NULL;261 for ( ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)262 { 263 if( (*it)->getIdentifier() == ClassByString(name))260 WorldEntity* waypoint = nullptr; 261 for (WorldEntity* we : ObjectList<WorldEntity>()) 262 { 263 if(we->getIdentifier() == ClassByString(name)) 264 264 { 265 265 ControllableEntity* controllable = this->getControllableEntity(); 266 266 if(!controllable) continue; 267 float actualDistance = ( (*it)->getPosition() - controllable->getPosition() ).length();267 float actualDistance = ( we->getPosition() - controllable->getPosition() ).length(); 268 268 if(actualDistance > searchDistance || actualDistance < 5.0f) continue; 269 269 // TODO: PickupSpawner: adjust waypoint accuracy to PickupSpawner's triggerdistance … … 271 271 else 272 272 { 273 waypoint = *it;273 waypoint = we; 274 274 break; 275 275 } -
code/branches/cpp11_v3/src/orxonox/controllers/ArtificialController.h
r9667 r11054 42 42 virtual ~ArtificialController(); 43 43 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 45 45 46 46 void abandonTarget(Pawn* target); 47 47 48 virtual void changedControllableEntity() ;48 virtual void changedControllableEntity() override; 49 49 50 50 virtual void doFire(); … … 89 89 90 90 //WAYPOINT DATA 91 std::vector<WeakPtr<WorldEntity> 91 std::vector<WeakPtr<WorldEntity>> waypoints_; 92 92 size_t currentWaypoint_; 93 93 float squaredaccuracy_; -
code/branches/cpp11_v3/src/orxonox/controllers/Controller.cc
r9797 r11054 40 40 RegisterObject(Controller); 41 41 42 this->player_ = 0;43 this->controllableEntity_ = 0;42 this->player_ = nullptr; 43 this->controllableEntity_ = nullptr; 44 44 this->bGodMode_ = false; 45 45 this->team_=-1; -
code/branches/cpp11_v3/src/orxonox/controllers/Controller.h
r9797 r11054 45 45 Controller(Context* context); 46 46 virtual ~Controller(); 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 48 48 inline void setPlayer(PlayerInfo* player) 49 49 { this->player_ = player; } -
code/branches/cpp11_v3/src/orxonox/controllers/ControllerDirector.cc
r10622 r11054 32 32 33 33 // Initialize member variables 34 this->player_ = NULL;35 this->entity_ = NULL;36 this->pTrigger_ = NULL;34 this->player_ = nullptr; 35 this->entity_ = nullptr; 36 this->pTrigger_ = nullptr; 37 37 this->context_ = context; 38 38 } … … 110 110 { 111 111 this->pTrigger_ = orxonox_cast<PlayerTrigger*>(trigger); 112 this->player_ = NULL;112 this->player_ = nullptr; 113 113 114 114 orxout(verbose) << "Preparation to take Control!" << endl; 115 115 116 116 // Check whether it is a player trigger and extract pawn from it 117 if(this->pTrigger_ != NULL)117 if(this->pTrigger_ != nullptr) 118 118 { 119 119 // Get the object which triggered the event. … … 121 121 122 122 // Check if there actually was a player returned. 123 if( this->player_ == NULL) return false;123 if( this->player_ == nullptr) return false; 124 124 } 125 125 else -
code/branches/cpp11_v3/src/orxonox/controllers/ControllerDirector.h
r10622 r11054 43 43 virtual ~ControllerDirector() { } 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 bool party(bool bTriggered, BaseObject* trigger); 47 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 48 48 49 49 inline void setScriptName(const std::string& name) { this->scriptname_ = name; } -
code/branches/cpp11_v3/src/orxonox/controllers/DroneController.cc
r9667 r11054 49 49 RegisterObject(DroneController); 50 50 51 this->owner_ = 0;52 this->drone_ = 0;51 this->owner_ = nullptr; 52 this->drone_ = nullptr; 53 53 this->isShooting_ = false; 54 54 this->setAccuracy(10); -
code/branches/cpp11_v3/src/orxonox/controllers/DroneController.h
r9667 r11054 53 53 virtual ~DroneController(); 54 54 55 virtual void tick(float dt) ; //!< The controlling happens here. This method defines what the controller has to do each tick.55 virtual void tick(float dt) override; //!< The controlling happens here. This method defines what the controller has to do each tick. 56 56 57 57 void setOwner(Pawn* owner); -
code/branches/cpp11_v3/src/orxonox/controllers/FightingController.cc
r11052 r11054 248 248 float minDistance = std::numeric_limits<float>::infinity(); 249 249 Gametype* gt = this->getGametype(); 250 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)250 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 251 251 { 252 252 if ( CommonController::sameTeam (this->getControllableEntity(), static_cast<ControllableEntity*>(*itP), gt) ) -
code/branches/cpp11_v3/src/orxonox/controllers/FormationController.cc
r11052 r11054 58 58 RegisterClass(FormationController); 59 59 60 static const unsigned int STANDARD_MAX_FORMATION_SIZE = 9;61 static const int RADIUS_TO_SEARCH_FOR_MASTERS = 5000;62 static const float FORMATION_LENGTH = 110;63 static const float FORMATION_WIDTH = 110;64 static const int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy65 static const float SPEED_MASTER = 0.6f;66 static const float ROTATEFACTOR_MASTER = 0.2f;67 static const float SPEED_FREE = 0.8f;68 static const float ROTATEFACTOR_FREE = 0.8f;60 static constexpr unsigned int STANDARD_MAX_FORMATION_SIZE = 9; 61 static constexpr int RADIUS_TO_SEARCH_FOR_MASTERS = 5000; 62 static constexpr float FORMATION_LENGTH = 110; 63 static constexpr float FORMATION_WIDTH = 110; 64 static constexpr int FREEDOM_COUNT = 4; //seconds the slaves in a formation will be set free when master attacks an enemy 65 static constexpr float SPEED_MASTER = 0.6f; 66 static constexpr float ROTATEFACTOR_MASTER = 0.2f; 67 static constexpr float SPEED_FREE = 0.8f; 68 static constexpr float ROTATEFACTOR_FREE = 0.8f; 69 69 70 70 FormationController::FormationController(Context* context) : Controller(context) … … 72 72 RegisterObject(FormationController); 73 73 74 this->target_ = 0;74 this->target_ = nullptr; 75 75 this->formationFlight_ = false; 76 76 this->passive_ = false; 77 77 this->maxFormationSize_ = STANDARD_MAX_FORMATION_SIZE; 78 this->myMaster_ = 0;78 this->myMaster_ = nullptr; 79 79 this->freedomCount_ = 0; 80 80 … … 97 97 this->removeFromFormation(); 98 98 99 for ( ObjectList<FormationController>::iterator it = ObjectList<FormationController>::begin(); it; ++it)100 { 101 if ( *it!= this)99 for (FormationController* controller : ObjectList<FormationController>()) 100 { 101 if (controller != this) 102 102 { 103 if ( it->myMaster_ == this)103 if (controller->myMaster_ == this) 104 104 { 105 orxout(internal_error) << this << " is still master in " << (*it)<< endl;106 it->myMaster_ = 0;105 orxout(internal_error) << this << " is still master in " << controller << endl; 106 controller->myMaster_ = nullptr; 107 107 } 108 108 109 109 while (true) 110 110 { 111 std::vector<FormationController*>::iterator it2 = std::find( it->slaves_.begin(), it->slaves_.end(), this);112 if (it2 != it->slaves_.end())111 std::vector<FormationController*>::iterator it2 = std::find(controller->slaves_.begin(), controller->slaves_.end(), this); 112 if (it2 != controller->slaves_.end()) 113 113 { 114 orxout(internal_error) << this << " is still slave in " << (*it)<< endl;115 it->slaves_.erase(it2);114 orxout(internal_error) << this << " is still slave in " << controller << endl; 115 controller->slaves_.erase(it2); 116 116 } 117 117 else … … 140 140 void FormationController::formationflight(const bool form) 141 141 { 142 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)143 { 144 Controller* controller = 0;145 146 if ( it->getController())147 controller = it->getController();148 else if ( it->getXMLController())149 controller = it->getXMLController();142 for (Pawn* pawn : ObjectList<Pawn>()) 143 { 144 Controller* controller = nullptr; 145 146 if (pawn->getController()) 147 controller = pawn->getController(); 148 else if (pawn->getXMLController()) 149 controller = pawn->getXMLController(); 150 150 151 151 if (!controller) … … 171 171 void FormationController::masteraction(const int action) 172 172 { 173 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)174 { 175 Controller* controller = 0;176 177 if ( it->getController())178 controller = it->getController();179 else if ( it->getXMLController())180 controller = it->getXMLController();173 for (Pawn* pawn : ObjectList<Pawn>()) 174 { 175 Controller* controller = nullptr; 176 177 if (pawn->getController()) 178 controller = pawn->getController(); 179 else if (pawn->getXMLController()) 180 controller = pawn->getXMLController(); 181 181 182 182 if (!controller) … … 201 201 void FormationController::passivebehaviour(const bool passive) 202 202 { 203 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)204 { 205 Controller* controller = 0;206 207 if ( it->getController())208 controller = it->getController();209 else if ( it->getXMLController())210 controller = it->getXMLController();203 for (Pawn* pawn : ObjectList<Pawn>()) 204 { 205 Controller* controller = nullptr; 206 207 if (pawn->getController()) 208 controller = pawn->getController(); 209 else if (pawn->getXMLController()) 210 controller = pawn->getXMLController(); 211 211 212 212 if (!controller) … … 228 228 void FormationController::formationsize(const int size) 229 229 { 230 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)231 { 232 Controller* controller = 0;233 234 if ( it->getController())235 controller = it->getController();236 else if ( it->getXMLController())237 controller = it->getXMLController();230 for (Pawn* pawn : ObjectList<Pawn>()) 231 { 232 Controller* controller = nullptr; 233 234 if (pawn->getController()) 235 controller = pawn->getController(); 236 else if (pawn->getXMLController()) 237 controller = pawn->getXMLController(); 238 238 239 239 if (!controller) … … 383 383 } 384 384 385 this->myMaster_ = 0;385 this->myMaster_ = nullptr; 386 386 this->state_ = FREE; 387 387 } … … 398 398 int teamSize = 0; 399 399 //go through all pawns 400 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)400 for (Pawn* pawn : ObjectList<Pawn>()) 401 401 { 402 402 … … 405 405 if (!gt) 406 406 { 407 gt= it->getGametype();408 } 409 if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>( *it),gt))407 gt=pawn->getGametype(); 408 } 409 if (!FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn),gt)) 410 410 continue; 411 411 412 412 //has it an FormationController? 413 Controller* controller = 0;414 415 if ( it->getController())416 controller = it->getController();417 else if ( it->getXMLController())418 controller = it->getXMLController();413 Controller* controller = nullptr; 414 415 if (pawn->getController()) 416 controller = pawn->getController(); 417 else if (pawn->getXMLController()) 418 controller = pawn->getXMLController(); 419 419 420 420 if (!controller) … … 422 422 423 423 //is pawn oneself? 424 if (orxonox_cast<ControllableEntity*>( *it) == this->getControllableEntity())424 if (orxonox_cast<ControllableEntity*>(pawn) == this->getControllableEntity()) 425 425 continue; 426 426 … … 433 433 continue; 434 434 435 float distance = ( it->getPosition() - this->getControllableEntity()->getPosition()).length();435 float distance = (pawn->getPosition() - this->getControllableEntity()->getPosition()).length(); 436 436 437 437 // is pawn in range? … … 440 440 if(newMaster->slaves_.size() > this->maxFormationSize_) continue; 441 441 442 for( std::vector<FormationController*>::iterator itSlave = this->slaves_.begin(); itSlave != this->slaves_.end(); itSlave++)442 for(FormationController* slave : this->slaves_) 443 443 { 444 (*itSlave)->myMaster_ = newMaster;445 newMaster->slaves_.push_back( *itSlave);444 slave->myMaster_ = newMaster; 445 newMaster->slaves_.push_back(slave); 446 446 } 447 447 this->slaves_.clear(); … … 458 458 { 459 459 this->state_ = MASTER; 460 this->myMaster_ = 0;460 this->myMaster_ = nullptr; 461 461 } 462 462 } … … 486 486 int i = 1; 487 487 488 for( std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)488 for(FormationController* slave : slaves_) 489 489 { 490 490 pos = Vector3::ZERO; … … 497 497 dest+=FORMATION_LENGTH*(orient*WorldEntity::BACK); 498 498 } 499 (*it)->setTargetOrientation(orient);500 (*it)->setTargetPosition(pos);499 slave->setTargetOrientation(orient); 500 slave->setTargetPosition(pos); 501 501 left=!left; 502 502 } … … 518 518 newMaster->state_ = MASTER; 519 519 newMaster->slaves_ = this->slaves_; 520 newMaster->myMaster_ = 0;521 522 for( std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)523 { 524 (*it)->myMaster_ = newMaster;520 newMaster->myMaster_ = nullptr; 521 522 for(FormationController* slave : newMaster->slaves_) 523 { 524 slave->myMaster_ = newMaster; 525 525 } 526 526 } … … 547 547 newMaster->state_ = MASTER; 548 548 newMaster->slaves_ = this->slaves_; 549 newMaster->myMaster_ = 0;550 551 for( std::vector<FormationController*>::iterator it = newMaster->slaves_.begin(); it != newMaster->slaves_.end(); it++)549 newMaster->myMaster_ = nullptr; 550 551 for(FormationController* slave : newMaster->slaves_) 552 552 { 553 (*it)->myMaster_ = newMaster;553 slave->myMaster_ = newMaster; 554 554 } 555 555 } … … 569 569 if(this->state_ != MASTER) return; 570 570 571 for( std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)572 { 573 (*it)->state_ = FREE;574 (*it)->myMaster_ = 0;571 for(FormationController* slave : slaves_) 572 { 573 slave->state_ = FREE; 574 slave->myMaster_ = nullptr; 575 575 } 576 576 this->slaves_.clear(); … … 584 584 if(this->state_ != MASTER) return; 585 585 586 for( std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)587 { 588 (*it)->state_ = FREE;589 (*it)->forceFreedom();590 (*it)->targetPosition_ = this->targetPosition_;591 (*it)->bShooting_ = true;586 for(FormationController* slave : slaves_) 587 { 588 slave->state_ = FREE; 589 slave->forceFreedom(); 590 slave->targetPosition_ = this->targetPosition_; 591 slave->bShooting_ = true; 592 592 // (*it)->getControllableEntity()->fire(0);// fire once for fun 593 593 } … … 629 629 630 630 //search new Master, then take lead 631 if (this->state_==FREE && this->myMaster_== 0)631 if (this->state_==FREE && this->myMaster_==nullptr) 632 632 { 633 633 searchNewMaster(); … … 650 650 this->slaves_.push_back(this->myMaster_); 651 651 //set this as new master 652 for( std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)653 { 654 (*it)->myMaster_=this;655 } 656 this->myMaster_= 0;652 for(FormationController* slave : slaves_) 653 { 654 slave->myMaster_=this; 655 } 656 this->myMaster_=nullptr; 657 657 this->state_=MASTER; 658 658 } … … 694 694 if (this->state_ == MASTER) 695 695 { 696 for( std::vector<FormationController*>::iterator it = slaves_.begin(); it != slaves_.end(); it++)697 { 698 (*it)->formationMode_ = val;696 for(FormationController* slave : slaves_) 697 { 698 slave->formationMode_ = val; 699 699 if (val == ATTACK) 700 (*it)->forgetTarget();700 slave->forgetTarget(); 701 701 } 702 702 } … … 773 773 { 774 774 775 Pawn *humanPawn = NULL;776 NewHumanController *currentHumanController = NULL;775 Pawn *humanPawn = nullptr; 776 NewHumanController *currentHumanController = nullptr; 777 777 std::vector<FormationController*> allMasters; 778 778 779 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)780 { 781 Controller* controller = 0;782 783 if ( it->getController())784 controller = it->getController();785 else if ( it->getXMLController())786 controller = it->getXMLController();779 for (Pawn* pawn : ObjectList<Pawn>()) 780 { 781 Controller* controller = nullptr; 782 783 if (pawn->getController()) 784 controller = pawn->getController(); 785 else if (pawn->getXMLController()) 786 controller = pawn->getXMLController(); 787 787 788 788 if (!controller) … … 791 791 currentHumanController = orxonox_cast<NewHumanController*>(controller); 792 792 793 if(currentHumanController) humanPawn = *it;793 if(currentHumanController) humanPawn = pawn; 794 794 795 795 FormationController *aiController = orxonox_cast<FormationController*>(controller); … … 800 800 } 801 801 802 if((humanPawn != NULL) && (allMasters.size() != 0))802 if((humanPawn != nullptr) && (allMasters.size() != 0)) 803 803 { 804 804 float posHuman = humanPawn->getPosition().length(); … … 808 808 int i = 0; 809 809 810 for( std::vector<FormationController*>::iterator it = allMasters.begin(); it != allMasters.end(); it++, i++)811 { 812 if (!FormationController::sameTeam( (*it)->getControllableEntity(), humanPawn, (*it)->getGametype())) continue;813 distance = posHuman - (*it)->getControllableEntity()->getPosition().length();810 for(FormationController* master : allMasters) 811 { 812 if (!FormationController::sameTeam(master->getControllableEntity(), humanPawn, master->getGametype())) continue; 813 distance = posHuman - master->getControllableEntity()->getPosition().length(); 814 814 if(distance < minDistance) index = i; 815 i++; 815 816 } 816 817 allMasters[index]->followInit(humanPawn); … … 826 827 void FormationController::followInit(Pawn* pawn, const bool always, const int secondsToFollow) 827 828 { 828 if (pawn == NULL|| this->state_ != MASTER)829 if (pawn == nullptr || this->state_ != MASTER) 829 830 return; 830 831 this->specificMasterAction_ = FOLLOW; … … 844 845 { 845 846 846 Pawn *humanPawn = NULL;847 NewHumanController *currentHumanController = NULL;848 849 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)850 { 851 if (! it->getController())847 Pawn *humanPawn = nullptr; 848 NewHumanController *currentHumanController = nullptr; 849 850 for (Pawn* pawn : ObjectList<Pawn>()) 851 { 852 if (!pawn->getController()) 852 853 continue; 853 854 854 currentHumanController = orxonox_cast<NewHumanController*>( it->getController());855 currentHumanController = orxonox_cast<NewHumanController*>(pawn->getController()); 855 856 if(currentHumanController) 856 857 { 857 if (!FormationController::sameTeam(this->getControllableEntity(), *it, this->getGametype())) continue;858 humanPawn = *it;858 if (!FormationController::sameTeam(this->getControllableEntity(), pawn, this->getGametype())) continue; 859 humanPawn = pawn; 859 860 break; 860 861 } 861 862 } 862 863 863 if((humanPawn != NULL))864 if((humanPawn != nullptr)) 864 865 this->followInit(humanPawn); 865 866 } … … 918 919 this->forgetTarget(); 919 920 920 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it; ++it)921 { 922 if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>( *it), this->getGametype()))921 for (Pawn* pawn : ObjectList<Pawn>()) 922 { 923 if (FormationController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype())) 923 924 continue; 924 925 925 926 /* So AI won't choose invisible Spaceships as target */ 926 if (! it->getRadarVisibility())927 if (!pawn->getRadarVisibility()) 927 928 continue; 928 929 929 if (static_cast<ControllableEntity*>( *it) != this->getControllableEntity())930 if (static_cast<ControllableEntity*>(pawn) != this->getControllableEntity()) 930 931 { 931 932 float speed = this->getControllableEntity()->getVelocity().length(); 932 933 Vector3 distanceCurrent = this->targetPosition_ - this->getControllableEntity()->getPosition(); 933 Vector3 distanceNew = it->getPosition() - this->getControllableEntity()->getPosition();934 if (!this->target_ || it->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi)934 Vector3 distanceNew = pawn->getPosition() - this->getControllableEntity()->getPosition(); 935 if (!this->target_ || pawn->getPosition().squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceNew) / speed / distanceNew.length()) / math::twoPi) 935 936 < this->targetPosition_.squaredDistance(this->getControllableEntity()->getPosition()) * (1.5f + acos((this->getControllableEntity()->getOrientation() * WorldEntity::FRONT).dotProduct(distanceCurrent) / speed / distanceCurrent.length()) / math::twoPi) + rnd(-250, 250)) 936 937 { 937 this->setTarget( *it);938 this->setTarget(pawn); 938 939 } 939 940 } … … 943 944 void FormationController::forgetTarget() 944 945 { 945 this->target_ = 0;946 this->target_ = nullptr; 946 947 this->bShooting_ = false; 947 948 } … … 963 964 int team2 = entity2->getTeam(); 964 965 965 Controller* controller = 0;966 Controller* controller = nullptr; 966 967 if (entity1->getController()) 967 968 controller = entity1->getController(); … … 1000 1001 } 1001 1002 1002 TeamBaseMatchBase* base = 0;1003 TeamBaseMatchBase* base = nullptr; 1003 1004 base = orxonox_cast<TeamBaseMatchBase*>(entity1); 1004 1005 if (base) … … 1034 1035 } 1035 1036 1036 DroneController* droneController = 0;1037 DroneController* droneController = nullptr; 1037 1038 droneController = orxonox_cast<DroneController*>(entity1->getController()); 1038 1039 if (droneController && static_cast<ControllableEntity*>(droneController->getOwner()) == entity2) -
code/branches/cpp11_v3/src/orxonox/controllers/FormationController.h
r10631 r11054 50 50 virtual ~FormationController(); 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 53 54 54 … … 93 93 { return this->formationMode_; } 94 94 95 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) ;95 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override; 96 96 97 97 FormationController* getMaster( void ) { return myMaster_; } … … 99 99 FormationController* getSlave( void ) { return this->slaves_.back(); } 100 100 101 virtual void changedControllableEntity() ;101 virtual void changedControllableEntity() override; 102 102 103 103 protected: -
code/branches/cpp11_v3/src/orxonox/controllers/HumanController.cc
r11052 r11054 65 65 RegisterUnloadableClass(HumanController); 66 66 67 HumanController* HumanController::localController_s = 0;67 HumanController* HumanController::localController_s = nullptr; 68 68 69 69 HumanController::HumanController(Context* context) : FormationController(context) … … 81 81 HumanController::localController_s->removeFromFormation(); 82 82 } 83 HumanController::localController_s = 0;83 HumanController::localController_s = nullptr; 84 84 } 85 85 … … 321 321 return orxonox_cast<Pawn*>(HumanController::localController_s->getControllableEntity()); 322 322 else 323 return NULL;323 return nullptr; 324 324 } 325 325 -
code/branches/cpp11_v3/src/orxonox/controllers/HumanController.h
r10624 r11054 47 47 virtual ~HumanController(); 48 48 49 virtual void tick(float dt) ;49 virtual void tick(float dt) override; 50 50 51 51 static void moveFrontBack(const Vector2& value); -
code/branches/cpp11_v3/src/orxonox/controllers/MasterController.cc
r11052 r11054 58 58 { 59 59 //fill the vector in the first tick 60 for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController> ::begin(); it; ++it)60 for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it) 61 61 { 62 62 //----0ptr?---- -
code/branches/cpp11_v3/src/orxonox/controllers/NewHumanController.cc
r10631 r11054 58 58 RegisterUnloadableClass(NewHumanController); 59 59 60 NewHumanController* NewHumanController::localController_s = 0;60 NewHumanController* NewHumanController::localController_s = nullptr; 61 61 62 62 NewHumanController::NewHumanController(Context* context) 63 63 : HumanController(context) 64 , crossHairOverlay_( NULL)65 , centerOverlay_( NULL)66 , damageOverlayTop_( NULL)67 , damageOverlayRight_( NULL)68 , damageOverlayBottom_( NULL)69 , damageOverlayLeft_( NULL)64 , crossHairOverlay_(nullptr) 65 , centerOverlay_(nullptr) 66 , damageOverlayTop_(nullptr) 67 , damageOverlayRight_(nullptr) 68 , damageOverlayBottom_(nullptr) 69 , damageOverlayLeft_(nullptr) 70 70 , damageOverlayTT_(0) 71 71 , damageOverlayTR_(0) 72 72 , damageOverlayTB_(0) 73 73 , damageOverlayTL_(0) 74 , arrowsOverlay1_( NULL)75 , arrowsOverlay2_( NULL)76 , arrowsOverlay3_( NULL)77 , arrowsOverlay4_( NULL)74 , arrowsOverlay1_(nullptr) 75 , arrowsOverlay2_(nullptr) 76 , arrowsOverlay3_(nullptr) 77 , arrowsOverlay4_(nullptr) 78 78 { 79 79 RegisterObject(NewHumanController); … … 445 445 pawn->setAimPosition( mouseRay.getOrigin() + mouseRay.getDirection() * 3000 ); 446 446 447 if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != 0)448 this->getControllableEntity()->setTarget( 0);447 if( this->getControllableEntity() && this->getControllableEntity()->getTarget() != nullptr ) 448 this->getControllableEntity()->setTarget( nullptr ); 449 449 450 450 //return this->controllableEntity_->getWorldPosition() + (this->controllableEntity_->getWorldOrientation() * Vector3::NEGATIVE_UNIT_Z * 2000); -
code/branches/cpp11_v3/src/orxonox/controllers/NewHumanController.h
r9667 r11054 45 45 virtual ~NewHumanController(); 46 46 47 virtual void tick(float dt) ;47 virtual void tick(float dt) override; 48 48 49 virtual void frontback(const Vector2& value) ;50 virtual void yaw(const Vector2& value) ;51 virtual void pitch(const Vector2& value) ;49 virtual void frontback(const Vector2& value) override; 50 virtual void yaw(const Vector2& value) override; 51 virtual void pitch(const Vector2& value) override; 52 52 53 53 static void accelerate(); 54 54 static void decelerate(); 55 55 56 virtual void doFire(unsigned int firemode) ;56 virtual void doFire(unsigned int firemode) override; 57 57 58 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) ;58 virtual void hit(Pawn* originator, btManifoldPoint& contactpoint, float damage) override; 59 59 60 60 static void unfire(); … … 65 65 static void changeMode(); 66 66 67 virtual void changedControllableEntity() ;68 virtual void doPauseControl() ;69 virtual void doResumeControl() ;67 virtual void changedControllableEntity() override; 68 virtual void doPauseControl() override; 69 virtual void doResumeControl() override; 70 70 71 71 float getCurrentYaw(){ return this->currentYaw_; } -
code/branches/cpp11_v3/src/orxonox/controllers/ScriptController.cc
r10622 r11054 64 64 /* Set default values for all variables */ 65 65 /* - pointers to zero */ 66 this->player_ = NULL;67 this->entity_ = NULL;66 this->player_ = nullptr; 67 this->entity_ = nullptr; 68 68 69 69 /* - times */ … … 121 121 122 122 /* Debugging: print all the scriptcontroller object pointers */ 123 for(ObjectList<ScriptController>::iterator it = 124 ObjectList<ScriptController>::begin(); 125 it != ObjectList<ScriptController>::end(); ++it) 126 { orxout(verbose) << "Have object in list: " << *it << endl; } 123 for(ScriptController* controller : ObjectList<ScriptController>()) 124 { orxout(verbose) << "Have object in list: " << controller << endl; } 127 125 128 126 /* Find the first one with a nonzero ID */ 129 for(ObjectList<ScriptController>::iterator it = 130 ObjectList<ScriptController>::begin(); 131 it != ObjectList<ScriptController>::end(); ++it) 127 for(ScriptController* controller : ObjectList<ScriptController>()) 132 128 { 133 129 // TODO: do some selection here. Currently just returns the first one 134 if( (*it)->getID() > 0 )135 { orxout(verbose) << "Controller to return: " << *it<< endl;136 return *it;130 if( controller->getID() > 0 ) 131 { orxout(verbose) << "Controller to return: " << controller << endl; 132 return controller; 137 133 } 138 134 139 135 } 140 return NULL;136 return nullptr; 141 137 } 142 138 -
code/branches/cpp11_v3/src/orxonox/controllers/ScriptController.h
r10622 r11054 71 71 void setPlayer(PlayerInfo* player) { this->player_ = player; } 72 72 73 virtual void tick(float dt) ;73 virtual void tick(float dt) override; 74 74 75 75 // LUA interface -
code/branches/cpp11_v3/src/orxonox/controllers/SectionController.cc
r11052 r11054 147 147 Vector3 divisionTargetPosition = this->myDivisionLeader_->getTarget()->getWorldPosition(); 148 148 Gametype* gt = this->getGametype(); 149 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn> ::begin(); itP; ++itP)149 for (ObjectList<Pawn>::iterator itP = ObjectList<Pawn>().begin(); itP; ++itP) 150 150 { 151 151 //----is enemy?---- … … 231 231 float minDistance = std::numeric_limits<float>::infinity(); 232 232 //go through all pawns 233 for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController> ::begin(); it; ++it)233 for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it) 234 234 { 235 235 //0ptr or not DivisionController? -
code/branches/cpp11_v3/src/orxonox/controllers/WaypointController.cc
r9667 r11054 44 44 WaypointController::~WaypointController() 45 45 { 46 for ( size_t i = 0; i < this->waypoints_.size(); ++i)46 for (WorldEntity* waypoint : this->waypoints_) 47 47 { 48 if( this->waypoints_[i])49 this->waypoints_[i]->destroy();48 if(waypoint) 49 waypoint->destroy(); 50 50 } 51 51 } -
code/branches/cpp11_v3/src/orxonox/controllers/WaypointController.h
r9667 r11054 44 44 virtual ~WaypointController(); 45 45 46 virtual void tick(float dt) ;46 virtual void tick(float dt) override; 47 47 48 48 protected: -
code/branches/cpp11_v3/src/orxonox/controllers/WaypointPatrolController.cc
r9716 r11054 87 87 float shortestsqdistance = (float)static_cast<unsigned int>(-1); 88 88 89 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)89 for (Pawn* pawn : ObjectList<Pawn>()) 90 90 { 91 if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>( *it), this->getGametype()))91 if (ArtificialController::sameTeam(this->getControllableEntity(), static_cast<ControllableEntity*>(pawn), this->getGametype())) 92 92 continue; 93 93 94 float sqdistance = it->getPosition().squaredDistance(myposition);94 float sqdistance = pawn->getPosition().squaredDistance(myposition); 95 95 if (sqdistance < shortestsqdistance) 96 96 { 97 97 shortestsqdistance = sqdistance; 98 this->target_ = (*it);98 this->target_ = pawn; 99 99 } 100 100 } 101 101 102 102 if (shortestsqdistance > (this->alertnessradius_ * this->alertnessradius_)) 103 this->target_ = 0;103 this->target_ = nullptr; 104 104 } 105 105 } -
code/branches/cpp11_v3/src/orxonox/controllers/WaypointPatrolController.h
r9716 r11054 43 43 virtual ~WaypointPatrolController() {} 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void tick(float dt) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 virtual void tick(float dt) override; 47 47 48 48 inline void setAlertnessRadius(float radius) -
code/branches/cpp11_v3/src/orxonox/controllers/WingmanController.cc
r11052 r11054 192 192 Gametype* gt = this->getGametype(); 193 193 194 for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController> ::begin(); it; ++it)194 for (ObjectList<ActionpointController>::iterator it = ObjectList<ActionpointController>().begin(); it; ++it) 195 195 { 196 196 //----0ptr or not a leader or dead?---- -
code/branches/cpp11_v3/src/orxonox/gamestates/GSClient.h
r7163 r11054 43 43 ~GSClient(); 44 44 45 v oid activate();46 v oid deactivate();47 v oid update(const Clock& time);45 virtual void activate() override; 46 virtual void deactivate() override; 47 virtual void update(const Clock& time) override; 48 48 }; 49 49 } -
code/branches/cpp11_v3/src/orxonox/gamestates/GSGraphics.h
r6417 r11054 53 53 ~GSGraphics(); 54 54 55 v oid activate();56 v oid deactivate();57 v oid update(const Clock& time);55 virtual void activate() override; 56 virtual void deactivate() override; 57 virtual void update(const Clock& time) override; 58 58 59 59 private: -
code/branches/cpp11_v3/src/orxonox/gamestates/GSLevel.cc
r10624 r11054 65 65 GSLevel::GSLevel(const GameStateInfo& info) 66 66 : GameState(info) 67 , gameInputState_( 0)68 , guiMouseOnlyInputState_( 0)69 , guiKeysOnlyInputState_( 0)70 , startFile_( 0)67 , gameInputState_(nullptr) 68 , guiMouseOnlyInputState_(nullptr) 69 , guiKeysOnlyInputState_(nullptr) 70 , startFile_(nullptr) 71 71 , bShowIngameGUI_(false) 72 72 { … … 143 143 #endif 144 144 145 gameInputState_->setHandler( 0);146 guiMouseOnlyInputState_->setHandler( 0);147 guiKeysOnlyInputState_->setHandler( 0);145 gameInputState_->setHandler(nullptr); 146 guiMouseOnlyInputState_->setHandler(nullptr); 147 guiKeysOnlyInputState_->setHandler(nullptr); 148 148 InputManager::getInstance().destroyState("game"); 149 149 InputManager::getInstance().destroyState("guiKeysOnly"); … … 156 156 { 157 157 ModifyConsoleCommand(__CC_changeGame_name).deactivate(); 158 ModifyConsoleCommand(__CC_reloadLevel_name).setObject( NULL).deactivate();158 ModifyConsoleCommand(__CC_reloadLevel_name).setObject(nullptr).deactivate(); 159 159 } 160 160 } … … 164 164 // Note: Temporarily moved to GSRoot. 165 165 //// Call the scene objects 166 //for ( ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)167 // it->tick(time.getDeltaTime() * this->timeFactor_);166 //for (Tickable* tickable : ObjectList<Tickable>()) 167 // tickable->tick(time.getDeltaTime() * this->timeFactor_); 168 168 } 169 169 170 170 void GSLevel::prepareObjectTracking() 171 171 { 172 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)173 this->staticObjects_.insert( *it);172 for (BaseObject* baseObject : ObjectList<BaseObject>()) 173 this->staticObjects_.insert(baseObject); 174 174 } 175 175 … … 178 178 orxout(internal_info) << "Remaining objects:" << endl; 179 179 unsigned int i = 0; 180 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)181 { 182 std::set<BaseObject*>::const_iterator find = this->staticObjects_.find( *it);180 for (BaseObject* baseObject : ObjectList<BaseObject>()) 181 { 182 std::set<BaseObject*>::const_iterator find = this->staticObjects_.find(baseObject); 183 183 if (find == this->staticObjects_.end()) 184 184 { 185 orxout(internal_warning) << ++i << ": " << it->getIdentifier()->getName() << " (" << *it << "), references: " << it->getReferenceCount() << endl;185 orxout(internal_warning) << ++i << ": " << baseObject->getIdentifier()->getName() << " (" << baseObject << "), references: " << baseObject->getReferenceCount() << endl; 186 186 } 187 187 } … … 215 215 void GSLevel::unloadLevelAsClient() 216 216 { 217 for (ObjectList<Level>::iterator it = ObjectList<Level>::begin(); it != ObjectList<Level>::end(); ) 217 ObjectList<Level> listLevel; 218 for (ObjectList<Level>::iterator it = listLevel.begin(); it != listLevel.end(); ) 218 219 { 219 220 StrongPtr<Level> level = *(it++); // StrongPtr prevents that the Level gets destroyed while we loop over it 220 for (ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(level); it != ObjectList<BaseObject>::end(level); ) 221 ObjectList<BaseObject> listBaseObject(level); 222 for (ObjectList<BaseObject>::iterator it = listBaseObject.begin(); it != listBaseObject.end(); ) 221 223 (it++)->destroy(); 222 224 } 223 225 224 for (ObjectList<Synchronisable>::iterator it = ObjectList<Synchronisable>::begin(); it != ObjectList<Synchronisable>::end(); ) 226 ObjectList<Synchronisable> listSynchronisable; 227 for (ObjectList<Synchronisable>::iterator it = listSynchronisable.begin(); it != listSynchronisable.end(); ) 225 228 { 226 229 if (it->getSyncMode() != 0x0) … … 235 238 // export all states 236 239 std::vector<GSLevelMementoState*> states; 237 for ( ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)238 { 239 GSLevelMementoState* state = it->exportMementoState();240 for (GSLevelMemento* memento : ObjectList<GSLevelMemento>()) 241 { 242 GSLevelMementoState* state = memento->exportMementoState(); 240 243 if (state) 241 244 states.push_back(state); … … 247 250 248 251 // import all states 249 for ( ObjectList<GSLevelMemento>::iterator it = ObjectList<GSLevelMemento>::begin(); it != ObjectList<GSLevelMemento>::end(); ++it)250 it->importMementoState(states);252 for (GSLevelMemento* memento : ObjectList<GSLevelMemento>()) 253 memento->importMementoState(states); 251 254 252 255 // delete states 253 for ( size_t i = 0; i < states.size(); ++i)254 delete state s[i];256 for (GSLevelMementoState* state : states) 257 delete state; 255 258 } 256 259 -
code/branches/cpp11_v3/src/orxonox/gamestates/GSLevel.h
r10624 r11054 44 44 ~GSLevel(); 45 45 46 v oid activate();47 v oid deactivate();48 v oid update(const Clock& time);46 virtual void activate() override; 47 virtual void deactivate() override; 48 virtual void update(const Clock& time) override; 49 49 50 50 static void startMainMenu(void); //!< Starts the MainMenu -
code/branches/cpp11_v3/src/orxonox/gamestates/GSLevelMemento.h
r10281 r11054 48 48 protected: 49 49 /** 50 * Returns the state of this memento. Returns NULLif no state needed to persist.50 * Returns the state of this memento. Returns nullptr if no state needed to persist. 51 51 */ 52 52 virtual GSLevelMementoState* exportMementoState() = 0; -
code/branches/cpp11_v3/src/orxonox/gamestates/GSMainMenu.cc
r10624 r11054 73 73 74 74 // create an empty Scene 75 this->scene_ = new Scene( NULL);75 this->scene_ = new Scene(nullptr); 76 76 this->scene_->setSyncMode( 0x0 ); 77 77 // and a Camera … … 132 132 InputManager::getInstance().leaveState("MainMenuHackery"); 133 133 134 GraphicsManager::getInstance().setCamera( 0);134 GraphicsManager::getInstance().setCamera(nullptr); 135 135 GUIManager::getInstance().setBackgroundImage(""); 136 136 GUIManager::hideGUI("MainMenu"); … … 140 140 ModifyConsoleCommand(__CC_startClient_name ).deactivate(); 141 141 ModifyConsoleCommand(__CC_startDedicated_name ).deactivate(); 142 ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject( 0);142 ModifyConsoleCommand(__CC_setMainMenuSoundPath_name).setObject(nullptr); 143 143 } 144 144 -
code/branches/cpp11_v3/src/orxonox/gamestates/GSMainMenu.h
r9667 r11054 44 44 ~GSMainMenu(); 45 45 46 v oid activate();47 v oid deactivate();48 v oid update(const Clock& time);46 virtual void activate() override; 47 virtual void deactivate() override; 48 virtual void update(const Clock& time) override; 49 49 50 50 void setConfigValues(); -
code/branches/cpp11_v3/src/orxonox/gamestates/GSMasterServer.h
r7801 r11054 45 45 ~GSMasterServer(); 46 46 47 v oid activate();48 v oid deactivate();49 v oid update(const Clock& time);47 virtual void activate() override; 48 virtual void deactivate() override; 49 virtual void update(const Clock& time) override; 50 50 51 51 private: -
code/branches/cpp11_v3/src/orxonox/gamestates/GSRoot.cc
r10624 r11054 34 34 #include "core/GameMode.h" 35 35 #include "core/command/ConsoleCommandIncludes.h" 36 #include "core/object/ObjectList.h" 36 37 #include "network/NetworkFunctionIncludes.h" 37 38 #include "tools/Timer.h" … … 73 74 { 74 75 unsigned int nr=0; 75 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it; ++it)76 { 77 Synchronisable* synchronisable = orxonox_cast<Synchronisable*>( *it);76 for (BaseObject* baseObject : ObjectList<BaseObject>()) 77 { 78 Synchronisable* synchronisable = orxonox_cast<Synchronisable*>(baseObject); 78 79 if (synchronisable) 79 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl;80 orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << " id: " << synchronisable->getObjectID() << endl; 80 81 else 81 orxout(debug_output) << "object: " << it->getIdentifier()->getName() << endl;82 orxout(debug_output) << "object: " << baseObject->getIdentifier()->getName() << endl; 82 83 nr++; 83 84 } … … 98 99 void GSRoot::deactivate() 99 100 { 100 ModifyConsoleCommand(__CC_setTimeFactor_name).setObject( 0);101 ModifyConsoleCommand(__CC_getTimeFactor_name).setObject( 0);102 ModifyConsoleCommand(__CC_setPause_name).setObject( 0);103 ModifyConsoleCommand(__CC_pause_name).setObject( 0);101 ModifyConsoleCommand(__CC_setTimeFactor_name).setObject(nullptr); 102 ModifyConsoleCommand(__CC_getTimeFactor_name).setObject(nullptr); 103 ModifyConsoleCommand(__CC_setPause_name).setObject(nullptr); 104 ModifyConsoleCommand(__CC_pause_name).setObject(nullptr); 104 105 } 105 106 … … 112 113 } 113 114 114 for (ObjectList<Timer>::iterator it = ObjectList<Timer>::begin(); it; ) 115 ObjectList<Timer> listTimer; 116 for (ObjectList<Timer>::iterator it = listTimer.begin(); it; ) 115 117 { 116 118 Timer* object = *it; … … 128 130 } 129 131 float realdt = leveldt * TimeFactorListener::getTimeFactor(); 130 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ) 132 ObjectList<Tickable> listTickable; 133 for (ObjectList<Tickable>::iterator it = listTickable.begin(); it; ) 131 134 { 132 135 Tickable* object = *it; -
code/branches/cpp11_v3/src/orxonox/gamestates/GSRoot.h
r8706 r11054 44 44 static void printObjects(); 45 45 46 v oid activate();47 v oid deactivate();48 v oid update(const Clock& time);46 virtual void activate() override; 47 virtual void deactivate() override; 48 virtual void update(const Clock& time) override; 49 49 50 50 // this has to be public because proteced triggers a bug in msvc … … 59 59 60 60 protected: 61 virtual void changedTimeFactor(float factor_new, float factor_old) ;61 virtual void changedTimeFactor(float factor_new, float factor_old) override; 62 62 63 63 private: -
code/branches/cpp11_v3/src/orxonox/gamestates/GSServer.cc
r10624 r11054 44 44 GSServer::GSServer(const GameStateInfo& info) 45 45 : GameState(info) 46 , server_( 0)46 , server_(nullptr) 47 47 { 48 48 } -
code/branches/cpp11_v3/src/orxonox/gamestates/GSServer.h
r5929 r11054 43 43 ~GSServer(); 44 44 45 v oid activate();46 v oid deactivate();47 v oid update(const Clock& time);45 virtual void activate() override; 46 virtual void deactivate() override; 47 virtual void update(const Clock& time) override; 48 48 49 49 private: -
code/branches/cpp11_v3/src/orxonox/gamestates/GSStandalone.h
r5929 r11054 41 41 ~GSStandalone(); 42 42 43 v oid activate();44 v oid deactivate();45 v oid update(const Clock& time);43 virtual void activate() override; 44 virtual void deactivate() override; 45 virtual void update(const Clock& time) override; 46 46 47 47 private: -
code/branches/cpp11_v3/src/orxonox/gametypes/Asteroids.h
r9667 r11054 41 41 virtual ~Asteroids() {} 42 42 43 virtual void tick(float dt) ;43 virtual void tick(float dt) override; 44 44 45 virtual void start() ;46 virtual void end() ;45 virtual void start() override; 46 virtual void end() override; 47 47 48 48 inline void firstCheckpointReached(bool reached) … … 50 50 51 51 protected: 52 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);52 virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override; 53 53 54 54 private: -
code/branches/cpp11_v3/src/orxonox/gametypes/Deathmatch.h
r9667 r11054 41 41 virtual ~Deathmatch() {} 42 42 43 virtual void start() ;44 virtual void end() ;45 virtual void playerEntered(PlayerInfo* player) ;46 virtual bool playerLeft(PlayerInfo* player) ;47 virtual bool playerChangedName(PlayerInfo* player) ;43 virtual void start() override; 44 virtual void end() override; 45 virtual void playerEntered(PlayerInfo* player) override; 46 virtual bool playerLeft(PlayerInfo* player) override; 47 virtual bool playerChangedName(PlayerInfo* player) override; 48 48 49 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);50 virtual void playerScored(PlayerInfo* player, int score = 1) ;49 virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override; 50 virtual void playerScored(PlayerInfo* player, int score = 1) override; 51 51 }; 52 52 } -
code/branches/cpp11_v3/src/orxonox/gametypes/Dynamicmatch.cc
r11052 r11054 413 413 void Dynamicmatch::rewardPig() 414 414 { 415 for ( std::map< PlayerInfo*, int >::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it) //durch alle Spieler iterieren und alle piggys finden416 { 417 if ( it->second==piggy)//Spieler mit der Pig-party frags++418 { 419 this->playerScored( it->first);415 for (const auto& mapEntry : this->playerParty_) //durch alle Spieler iterieren und alle piggys finden 416 { 417 if (mapEntry.second==piggy)//Spieler mit der Pig-party frags++ 418 { 419 this->playerScored(mapEntry.first); 420 420 } 421 421 } … … 430 430 431 431 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 432 for ( std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)433 { 434 if ( (*it)->isA(Class(TeamColourable)))432 for (WorldEntity* pawnAttachment : pawnAttachments) 433 { 434 if (pawnAttachment->isA(Class(TeamColourable))) 435 435 { 436 TeamColourable* tc = orxonox_cast<TeamColourable*>( *it);436 TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment); 437 437 tc->setTeamColour(this->partyColours_[it_player->second]); 438 438 } … … 449 449 if (tutorial) // Announce selectionphase 450 450 { 451 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)452 { 453 if (! it->first)//in order to catch nullpointer451 for (const auto& mapEntry : this->playerParty_) 452 { 453 if (!mapEntry.first)//in order to catch nullpointer 454 454 continue; 455 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)455 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 456 456 continue; 457 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));457 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 458 458 } 459 459 } … … 464 464 if(tutorial&&(!notEnoughKillers)&&(!notEnoughChasers)) //Selection phase over 465 465 { 466 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)466 for (const auto& mapEntry : this->playerParty_) 467 467 { 468 if (! it->first)//in order to catch nullpointer468 if (!mapEntry.first)//in order to catch nullpointer 469 469 continue; 470 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)470 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 471 471 continue; 472 else if ( it->second==chaser)472 else if (mapEntry.second==chaser) 473 473 { 474 474 if (numberOf[killer]>0) 475 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);475 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 476 476 else 477 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);477 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 478 478 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 479 479 } 480 else if ( it->second==piggy)481 { 482 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[chaser]);480 else if (mapEntry.second==piggy) 481 { 482 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]); 483 483 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 484 484 } 485 else if ( it->second==killer)486 { 487 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[chaser]);485 else if (mapEntry.second==killer) 486 { 487 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]); 488 488 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 489 489 } … … 498 498 if (tutorial) // Announce selectionphase 499 499 { 500 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)501 { 502 if (! it->first)//in order to catch nullpointer500 for (const auto& mapEntry : this->playerParty_) 501 { 502 if (!mapEntry.first)//in order to catch nullpointer 503 503 continue; 504 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)504 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 505 505 continue; 506 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));506 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 507 507 } 508 508 } … … 513 513 if(tutorial&&(!notEnoughPigs)&&(!notEnoughChasers)) //Selection phase over 514 514 { 515 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)515 for (const auto& mapEntry : this->playerParty_) 516 516 { 517 if (! it->first)517 if (!mapEntry.first) 518 518 continue; 519 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)519 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 520 520 continue; 521 else if ( it->second==chaser)521 else if (mapEntry.second==chaser) 522 522 { 523 523 if (numberOf[killer]>0) 524 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);524 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 525 525 else 526 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);526 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 527 527 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 528 528 } 529 else if ( it->second==piggy)530 { 531 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[piggy]);529 else if (mapEntry.second==piggy) 530 { 531 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[piggy]); 532 532 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 533 533 } 534 else if ( it->second==killer)535 { 536 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[piggy]);534 else if (mapEntry.second==killer) 535 { 536 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[piggy]); 537 537 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 538 538 } … … 548 548 if (tutorial) // Announce selectionphase 549 549 { 550 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)551 { 552 if (! it->first)//in order to catch nullpointer550 for (const auto& mapEntry : this->playerParty_) 551 { 552 if (!mapEntry.first)//in order to catch nullpointer 553 553 continue; 554 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)554 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 555 555 continue; 556 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));556 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 557 557 } 558 558 } … … 563 563 if(tutorial&&(!notEnoughPigs)&&(!notEnoughKillers)) //Selection phase over 564 564 { 565 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)565 for (const auto& mapEntry : this->playerParty_) 566 566 { 567 if (! it->first)567 if (!mapEntry.first) 568 568 continue; 569 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)569 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 570 570 continue; 571 else if ( it->second==chaser)571 else if (mapEntry.second==chaser) 572 572 { 573 573 if (numberOf[killer]>0) 574 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.", it->first->getClientID(),partyColours_[piggy]);574 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible. Defend yourself against the killers.",mapEntry.first->getClientID(),partyColours_[piggy]); 575 575 else 576 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.", it->first->getClientID(),partyColours_[piggy]);576 this->gtinfo_->sendStaticMessage("Shoot at the victim as often as possible.",mapEntry.first->getClientID(),partyColours_[piggy]); 577 577 //this->gtinfo_->sendFadingMessage("You're now a chaser.",it->first->getClientID()); 578 578 } 579 else if ( it->second==piggy)580 { 581 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.", it->first->getClientID(),partyColours_[chaser]);579 else if (mapEntry.second==piggy) 580 { 581 this->gtinfo_->sendStaticMessage("Either hide or shoot a chaser.",mapEntry.first->getClientID(),partyColours_[chaser]); 582 582 //this->gtinfo_->sendFadingMessage("You're now a victim.",it->first->getClientID()); 583 583 } 584 else if ( it->second==killer)585 { 586 this->gtinfo_->sendStaticMessage("Take the chasers down.", it->first->getClientID(),partyColours_[chaser]);584 else if (mapEntry.second==killer) 585 { 586 this->gtinfo_->sendStaticMessage("Take the chasers down.",mapEntry.first->getClientID(),partyColours_[chaser]); 587 587 //this->gtinfo_->sendFadingMessage("You're now a killer.",it->first->getClientID()); 588 588 } … … 631 631 else if(tutorial) // Announce selectionphase 632 632 { 633 for ( std::map<PlayerInfo*, int>::iterator it = this->playerParty_.begin(); it != this->playerParty_.end(); ++it)634 { 635 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)633 for (const auto& mapEntry : this->playerParty_) 634 { 635 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 636 636 continue; 637 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.", it->first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f));637 this->gtinfo_->sendStaticMessage("Selection phase: Shoot at everything that moves.",mapEntry.first->getClientID(),ColourValue(1.0f, 1.0f, 0.5f)); 638 638 } 639 639 } … … 687 687 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 688 688 unsigned int index = 0; 689 for ( std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)689 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 690 690 { 691 691 if (index == randomspawn) 692 return (*it);692 return teamSpawnPoint; 693 693 694 694 ++index; … … 696 696 } 697 697 698 return 0;698 return nullptr; 699 699 } 700 700 -
code/branches/cpp11_v3/src/orxonox/gametypes/Dynamicmatch.h
r11052 r11054 65 65 bool tutorial; //goal: new players receive messages how the new gametype works - later it can be switched off. 66 66 67 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //ok - score function and management of parties68 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //ok - simple69 virtual void start() ;70 virtual void end() ; //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht?71 virtual void playerEntered(PlayerInfo* player) ;72 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) ;//is used to initialize the player's party and colour73 virtual bool playerLeft(PlayerInfo* player) ;74 virtual bool playerChangedName(PlayerInfo* player) ;//unchanged67 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //ok - score function and management of parties 68 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //ok - simple 69 virtual void start() override; 70 virtual void end() override; //Wie geht das mit der Punkteausgabe aendern? Z.B: Persoenliche Nachricht? 71 virtual void playerEntered(PlayerInfo* player) override; 72 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override;//is used to initialize the player's party and colour 73 virtual bool playerLeft(PlayerInfo* player) override; 74 virtual bool playerChangedName(PlayerInfo* player) override;//unchanged 75 75 76 76 /*virtual void instructions(); … … 79 79 void grantPigBoost(SpaceShip* spaceship); // Grant the piggy a boost. 80 80 void resetSpeedFactor(SpaceShip* spaceship, Timer* timer); 81 v oid tick (float dt);// used to end the game82 SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;81 virtual void tick (float dt) override;// used to end the game 82 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const override; 83 83 84 84 -
code/branches/cpp11_v3/src/orxonox/gametypes/Gametype.cc
r10624 r11054 66 66 67 67 this->defaultControllableEntity_ = Class(Spectator); 68 this->scoreboard_ = 0;68 this->scoreboard_ = nullptr; 69 69 70 70 this->bAutoStart_ = false; … … 92 92 this->gtinfo_->destroy(); 93 93 94 ModifyConsoleCommand(__CC_addBots_name).setObject( NULL);95 ModifyConsoleCommand(__CC_killBots_name).setObject( NULL);94 ModifyConsoleCommand(__CC_addBots_name).setObject(nullptr); 95 ModifyConsoleCommand(__CC_killBots_name).setObject(nullptr); 96 96 } 97 97 } … … 139 139 if (!this->gtinfo_->hasStarted()) 140 140 { 141 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)141 for (const auto& mapEntry : this->players_) 142 142 { 143 143 // Inform the GametypeInfo that the player is ready to spawn. 144 if( it->first->isHumanPlayer() && it->first->isReadyToSpawn())145 this->gtinfo_->playerReadyToSpawn( it->first);144 if(mapEntry.first->isHumanPlayer() && mapEntry.first->isReadyToSpawn()) 145 this->gtinfo_->playerReadyToSpawn(mapEntry.first); 146 146 } 147 147 … … 169 169 } 170 170 171 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)172 { 173 if ( it->first->getControllableEntity())174 { 175 ControllableEntity* oldentity = it->first->getControllableEntity();171 for (const auto& mapEntry : this->players_) 172 { 173 if (mapEntry.first->getControllableEntity()) 174 { 175 ControllableEntity* oldentity = mapEntry.first->getControllableEntity(); 176 176 177 177 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(oldentity->getContext()); … … 186 186 entity->setOrientation(oldentity->getWorldOrientation()); 187 187 } 188 it->first->startControl(entity);188 mapEntry.first->startControl(entity); 189 189 } 190 190 else 191 this->spawnPlayerAsDefaultPawn( it->first);191 this->spawnPlayerAsDefaultPawn(mapEntry.first); 192 192 } 193 193 } … … 337 337 { 338 338 // Fallback spawn point if there is no active one, choose a random one. 339 SpawnPoint* fallbackSpawnPoint = NULL;339 SpawnPoint* fallbackSpawnPoint = nullptr; 340 340 unsigned int randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(this->spawnpoints_.size()))); 341 341 unsigned int index = 0; 342 342 std::vector<SpawnPoint*> activeSpawnPoints; 343 for ( std::set<SpawnPoint*>::const_iterator it = this->spawnpoints_.begin(); it != this->spawnpoints_.end(); ++it)343 for (SpawnPoint* spawnpoint : this->spawnpoints_) 344 344 { 345 345 if (index == randomspawn) 346 fallbackSpawnPoint = (*it);347 348 if ( *it != NULL && (*it)->isActive())349 activeSpawnPoints.push_back( *it);346 fallbackSpawnPoint = spawnpoint; 347 348 if (spawnpoint != nullptr && spawnpoint->isActive()) 349 activeSpawnPoints.push_back(spawnpoint); 350 350 351 351 ++index; … … 361 361 return fallbackSpawnPoint; 362 362 } 363 return 0;363 return nullptr; 364 364 } 365 365 366 366 void Gametype::assignDefaultPawnsIfNeeded() 367 367 { 368 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)369 { 370 if (! it->first->getControllableEntity())371 { 372 it->second.state_ = PlayerState::Dead;373 374 if (! it->first->isReadyToSpawn() || !this->gtinfo_->hasStarted())375 { 376 this->spawnPlayerAsDefaultPawn( it->first);377 it->second.state_ = PlayerState::Dead;368 for (auto& mapEntry : this->players_) 369 { 370 if (!mapEntry.first->getControllableEntity()) 371 { 372 mapEntry.second.state_ = PlayerState::Dead; 373 374 if (!mapEntry.first->isReadyToSpawn() || !this->gtinfo_->hasStarted()) 375 { 376 this->spawnPlayerAsDefaultPawn(mapEntry.first); 377 mapEntry.second.state_ = PlayerState::Dead; 378 378 } 379 379 } … … 404 404 bool allplayersready = true; 405 405 bool hashumanplayers = false; 406 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)406 for (const auto& mapEntry : this->players_) 407 407 { 408 if (! it->first->isReadyToSpawn())408 if (!mapEntry.first->isReadyToSpawn()) 409 409 allplayersready = false; 410 if ( it->first->isHumanPlayer())410 if (mapEntry.first->isHumanPlayer()) 411 411 hashumanplayers = true; 412 412 } … … 430 430 void Gametype::spawnPlayersIfRequested() 431 431 { 432 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)433 { 434 if ( it->first->isReadyToSpawn() || this->bForceSpawn_)435 this->spawnPlayer( it->first);432 for (const auto& mapEntry : this->players_) 433 { 434 if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_) 435 this->spawnPlayer(mapEntry.first); 436 436 } 437 437 } … … 439 439 void Gametype::spawnDeadPlayersIfRequested() 440 440 { 441 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)442 if ( it->second.state_ == PlayerState::Dead)443 if ( it->first->isReadyToSpawn() || this->bForceSpawn_)444 this->spawnPlayer( it->first);441 for (const auto& mapEntry : this->players_) 442 if (mapEntry.second.state_ == PlayerState::Dead) 443 if (mapEntry.first->isReadyToSpawn() || this->bForceSpawn_) 444 this->spawnPlayer(mapEntry.first); 445 445 } 446 446 … … 492 492 { 493 493 unsigned int i = 0; 494 for (ObjectList<Bot>::iterator it = ObjectList<Bot>::begin(); (it != ObjectList<Bot>::end()) && ((amount == 0) || (i < amount)); ) 494 ObjectList<Bot> list; 495 for (ObjectList<Bot>::iterator it = list.begin(); (it != list.end()) && ((amount == 0) || (i < amount)); ) 495 496 { 496 497 if (it->getGametype() == this) … … 538 539 GSLevelMementoState* Gametype::exportMementoState() 539 540 { 540 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)541 { 542 if ( it->first->isHumanPlayer() && it->first->getControllableEntity() && it->first->getControllableEntity()->getCamera())543 { 544 Camera* camera = it->first->getControllableEntity()->getCamera();541 for (const auto& mapEntry : this->players_) 542 { 543 if (mapEntry.first->isHumanPlayer() && mapEntry.first->getControllableEntity() && mapEntry.first->getControllableEntity()->getCamera()) 544 { 545 Camera* camera = mapEntry.first->getControllableEntity()->getCamera(); 545 546 546 547 GametypeMementoState* state = new GametypeMementoState(); … … 552 553 } 553 554 554 return NULL;555 return nullptr; 555 556 } 556 557 … … 558 559 { 559 560 // find correct memento state 560 GametypeMementoState* state = NULL;561 for ( size_t i = 0; i < states.size(); ++i)562 { 563 state = dynamic_cast<GametypeMementoState*>( states[i]);561 GametypeMementoState* state = nullptr; 562 for (GSLevelMementoState* temp : states) 563 { 564 state = dynamic_cast<GametypeMementoState*>(temp); 564 565 if (state) 565 566 break; … … 570 571 571 572 // find correct scene 572 Scene* scene = NULL;573 for ( ObjectList<Scene>::iterator it = ObjectList<Scene>::begin(); it != ObjectList<Scene>::end(); ++it)574 { 575 if ( it->getName() == state->sceneName_)576 { 577 scene = *it;573 Scene* scene = nullptr; 574 for (Scene* someScene : ObjectList<Scene>()) 575 { 576 if (someScene->getName() == state->sceneName_) 577 { 578 scene = someScene; 578 579 break; 579 580 } … … 587 588 588 589 // find correct player and assign default entity with original position & orientation 589 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)590 { 591 if ( it->first->isHumanPlayer())590 for (const auto& mapEntry : this->players_) 591 { 592 if (mapEntry.first->isHumanPlayer()) 592 593 { 593 594 ControllableEntity* entity = this->defaultControllableEntity_.fabricate(scene->getContext()); 594 595 entity->setPosition(state->cameraPosition_); 595 596 entity->setOrientation(state->cameraOrientation_); 596 it->first->startControl(entity);597 mapEntry.first->startControl(entity); 597 598 break; 598 599 } -
code/branches/cpp11_v3/src/orxonox/gametypes/Gametype.h
r10624 r11054 76 76 void setConfigValues(); 77 77 78 virtual void tick(float dt) ;78 virtual void tick(float dt) override; 79 79 80 80 inline const GametypeInfo* getGametypeInfo() const … … 96 96 virtual void playerScored(PlayerInfo* player, int score = 1); 97 97 98 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);99 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);100 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);101 102 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);98 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr); 99 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr); 100 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr); 101 102 virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr); 103 103 virtual void pawnPreSpawn(Pawn* pawn); 104 104 virtual void pawnPostSpawn(Pawn* pawn); … … 175 175 virtual void spawnDeadPlayersIfRequested(); 176 176 177 virtual GSLevelMementoState* exportMementoState() ;178 virtual void importMementoState(const std::vector<GSLevelMementoState*>& states) ;177 virtual GSLevelMementoState* exportMementoState() override; 178 virtual void importMementoState(const std::vector<GSLevelMementoState*>& states) override; 179 179 180 180 WeakPtr<GametypeInfo> gtinfo_; -
code/branches/cpp11_v3/src/orxonox/gametypes/LastManStanding.cc
r9667 r11054 56 56 void LastManStanding::spawnDeadPlayersIfRequested() 57 57 { 58 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)59 if ( it->second.state_ == PlayerState::Dead)60 { 61 bool alive = (0<playerLives_[ it->first]&&(inGame_[it->first]));62 if (alive&&( it->first->isReadyToSpawn() || this->bForceSpawn_))63 { 64 this->spawnPlayer( it->first);58 for (const auto& mapEntry : this->players_) 59 if (mapEntry.second.state_ == PlayerState::Dead) 60 { 61 bool alive = (0<playerLives_[mapEntry.first]&&(inGame_[mapEntry.first])); 62 if (alive&&(mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 63 { 64 this->spawnPlayer(mapEntry.first); 65 65 } 66 66 } … … 114 114 { 115 115 int min=lives; 116 for ( std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)117 { 118 if ( it->second<=0)116 for (const auto& mapEntry : this->playerLives_) 117 { 118 if (mapEntry.second<=0) 119 119 continue; 120 if ( it->second<lives)121 min= it->second;120 if (mapEntry.second<lives) 121 min=mapEntry.second; 122 122 } 123 123 return min; … … 128 128 Gametype::end(); 129 129 130 for ( std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)131 { 132 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)130 for (const auto& mapEntry : this->playerLives_) 131 { 132 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 133 133 continue; 134 134 135 if ( it->second > 0)136 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());135 if (mapEntry.second > 0) 136 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 137 137 else 138 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());138 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 139 139 } 140 140 } … … 237 237 this->end(); 238 238 } 239 for ( std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)240 { 241 if (playerGetLives( it->first)<=0)//Players without lives shouldn't be affected by time.239 for (auto& mapEntry : this->timeToAct_) 240 { 241 if (playerGetLives(mapEntry.first)<=0)//Players without lives shouldn't be affected by time. 242 242 continue; 243 it->second-=dt;//Decreases punishment time.244 if (!inGame_[ it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.245 { 246 playerDelayTime_[ it->first]-=dt;247 if (playerDelayTime_[ it->first]<=0)248 this->inGame_[ it->first]=true;249 250 if ( it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)243 mapEntry.second-=dt;//Decreases punishment time. 244 if (!inGame_[mapEntry.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 245 { 246 playerDelayTime_[mapEntry.first]-=dt; 247 if (playerDelayTime_[mapEntry.first]<=0) 248 this->inGame_[mapEntry.first]=true; 249 250 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 251 251 continue; 252 int output=1+(int)playerDelayTime_[ it->first];252 int output=1+(int)playerDelayTime_[mapEntry.first]; 253 253 const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown 254 this->gtinfo_->sendFadingMessage(message, it->first->getClientID());255 } 256 else if ( it->second<0.0f)257 { 258 it->second=timeRemaining+3.0f;//reset punishment-timer259 if (playerGetLives( it->first)>0)254 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 255 } 256 else if (mapEntry.second<0.0f) 257 { 258 mapEntry.second=timeRemaining+3.0f;//reset punishment-timer 259 if (playerGetLives(mapEntry.first)>0) 260 260 { 261 this->punishPlayer( it->first);262 if ( it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)261 this->punishPlayer(mapEntry.first); 262 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 263 263 return; 264 264 const std::string& message = ""; // resets Camper-Warning-message 265 this->gtinfo_->sendFadingMessage(message, it->first->getClientID());265 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 266 266 } 267 267 } 268 else if ( it->second<timeRemaining/5)//Warning message269 { 270 if ( it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)268 else if (mapEntry.second<timeRemaining/5)//Warning message 269 { 270 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 271 271 continue; 272 272 const std::string& message = "Camper Warning! Don't forget to shoot."; 273 this->gtinfo_->sendFadingMessage(message, it->first->getClientID());273 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 274 274 } 275 275 } -
code/branches/cpp11_v3/src/orxonox/gametypes/LastManStanding.h
r9667 r11054 61 61 bool bHardPunishment; //!< Switches between damage and death as punishment. 62 62 float punishDamageRate; //!< Makes Damage adjustable. 63 virtual void spawnDeadPlayersIfRequested() ; //!< Prevents dead players to respawn.63 virtual void spawnDeadPlayersIfRequested() override; //!< Prevents dead players to respawn. 64 64 virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped; 65 65 … … 69 69 void setConfigValues(); //!< Makes values configurable. 70 70 71 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.72 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each players lives.71 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //!< If a player shoot's an opponent, his punishment countdown will be resetted. 72 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //!< Manages each players lives. 73 73 74 virtual void end() ; //!< Sends an end message.74 virtual void end() override; //!< Sends an end message. 75 75 int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_". 76 76 int getNumPlayersAlive() const; //!< Returns the number of players that are still alive. 77 virtual void playerEntered(PlayerInfo* player) ; //!< Initializes values.78 virtual bool playerLeft(PlayerInfo* player) ; //!< Manages all local variables.79 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) ; //!< Resets punishment time and respawn delay.77 virtual void playerEntered(PlayerInfo* player) override; //!< Initializes values. 78 virtual bool playerLeft(PlayerInfo* player) override; //!< Manages all local variables. 79 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override; //!< Resets punishment time and respawn delay. 80 80 81 81 void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining". 82 v oid tick (float dt); //!< used to end the game82 virtual void tick (float dt) override; //!< used to end the game 83 83 }; 84 84 } -
code/branches/cpp11_v3/src/orxonox/gametypes/LastTeamStanding.cc
r9941 r11054 145 145 void LastTeamStanding::spawnDeadPlayersIfRequested() 146 146 { 147 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)148 if ( it->second.state_ == PlayerState::Dead)149 { 150 bool alive = (0 < playerLives_[ it->first]&&(inGame_[it->first]));151 if (alive&&( it->first->isReadyToSpawn() || this->bForceSpawn_))152 { 153 this->spawnPlayer( it->first);147 for (const auto& mapEntry : this->players_) 148 if (mapEntry.second.state_ == PlayerState::Dead) 149 { 150 bool alive = (0 < playerLives_[mapEntry.first]&&(inGame_[mapEntry.first])); 151 if (alive&&(mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 152 { 153 this->spawnPlayer(mapEntry.first); 154 154 } 155 155 } … … 184 184 this->end(); 185 185 } 186 for ( std::map<PlayerInfo*, float>::iterator it = this->timeToAct_.begin(); it != this->timeToAct_.end(); ++it)187 { 188 if (playerGetLives( it->first) <= 0)//Players without lives shouldn't be affected by time.186 for (auto& mapEntry : this->timeToAct_) 187 { 188 if (playerGetLives(mapEntry.first) <= 0)//Players without lives shouldn't be affected by time. 189 189 continue; 190 it->second -= dt;//Decreases punishment time.191 if (!inGame_[ it->first])//Manages respawn delay - player is forced to respawn after the delaytime is used up.192 { 193 playerDelayTime_[ it->first] -= dt;194 if (playerDelayTime_[ it->first] <= 0)195 this->inGame_[ it->first] = true;196 197 if ( it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)190 mapEntry.second -= dt;//Decreases punishment time. 191 if (!inGame_[mapEntry.first])//Manages respawn delay - player is forced to respawn after the delaytime is used up. 192 { 193 playerDelayTime_[mapEntry.first] -= dt; 194 if (playerDelayTime_[mapEntry.first] <= 0) 195 this->inGame_[mapEntry.first] = true; 196 197 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 198 198 continue; 199 int output = 1 + (int)playerDelayTime_[ it->first];199 int output = 1 + (int)playerDelayTime_[mapEntry.first]; 200 200 const std::string& message = "Respawn in " +multi_cast<std::string>(output)+ " seconds." ;//Countdown 201 this->gtinfo_->sendFadingMessage(message, it->first->getClientID());202 } 203 else if ( it->second < 0.0f)204 { 205 it->second = timeRemaining + 3.0f;//reset punishment-timer206 if (playerGetLives( it->first) > 0)201 this->gtinfo_->sendFadingMessage(message,mapEntry.first->getClientID()); 202 } 203 else if (mapEntry.second < 0.0f) 204 { 205 mapEntry.second = timeRemaining + 3.0f;//reset punishment-timer 206 if (playerGetLives(mapEntry.first) > 0) 207 207 { 208 this->punishPlayer( it->first);209 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)208 this->punishPlayer(mapEntry.first); 209 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 210 210 return; 211 211 const std::string& message = ""; // resets Camper-Warning-message 212 this->gtinfo_->sendFadingMessage(message, it->first->getClientID());212 this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID()); 213 213 } 214 214 } 215 else if ( it->second < timeRemaining/5)//Warning message216 { 217 if ( it->first->getClientID()== NETWORK_PEER_ID_UNKNOWN)215 else if (mapEntry.second < timeRemaining/5)//Warning message 216 { 217 if (mapEntry.first->getClientID()== NETWORK_PEER_ID_UNKNOWN) 218 218 continue; 219 219 const std::string& message = "Camper Warning! Don't forget to shoot."; 220 this->gtinfo_->sendFadingMessage(message, it->first->getClientID());220 this->gtinfo_->sendFadingMessage(message, mapEntry.first->getClientID()); 221 221 } 222 222 } … … 229 229 int party = -1; 230 230 //find a player who survived 231 for ( std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)232 { 233 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)231 for (const auto& mapEntry : this->playerLives_) 232 { 233 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 234 234 continue; 235 235 236 if ( it->second > 0)//a player that is alive236 if (mapEntry.second > 0)//a player that is alive 237 237 { 238 238 //which party has survived? 239 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find( it->first);239 std::map<PlayerInfo*, int>::iterator it2 = this->teamnumbers_.find(mapEntry.first); 240 240 if (it2 != this->teamnumbers_.end()) 241 241 { … … 255 255 { 256 256 int min = lives; 257 for ( std::map<PlayerInfo*, int>::iterator it = this->playerLives_.begin(); it != this->playerLives_.end(); ++it)258 { 259 if ( it->second <= 0)257 for (const auto& mapEntry : this->playerLives_) 258 { 259 if (mapEntry.second <= 0) 260 260 continue; 261 if ( it->second < lives)262 min = it->second;261 if (mapEntry.second < lives) 262 min = mapEntry.second; 263 263 } 264 264 return min; -
code/branches/cpp11_v3/src/orxonox/gametypes/LastTeamStanding.h
r9667 r11054 67 67 std::map<PlayerInfo*, bool> inGame_; //!< Indicates each Player's state. 68 68 69 virtual void spawnDeadPlayersIfRequested() ; //!< Prevents dead players to respawn.69 virtual void spawnDeadPlayersIfRequested() override; //!< Prevents dead players to respawn. 70 70 virtual int getMinLives(); //!< Returns minimum of each player's lives; players with 0 lives are skipped; 71 71 … … 74 74 virtual ~LastTeamStanding(); //!< Default Destructor. 75 75 76 virtual void playerEntered(PlayerInfo* player) ; //!< Initializes values.77 virtual bool playerLeft(PlayerInfo* player) ; //!< Manages all local variables.76 virtual void playerEntered(PlayerInfo* player) override; //!< Initializes values. 77 virtual bool playerLeft(PlayerInfo* player) override; //!< Manages all local variables. 78 78 79 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0); //!< Manages each player's lost lives.80 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0); //!< If a player shoot's an opponent, his punishment countdown will be resetted.81 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) ; //!< Resets punishment time and respawn delay.82 v oid tick (float dt); //!< used to end the game83 virtual void end() ; //!< Sends an end message.79 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; //!< Manages each player's lost lives. 80 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; //!< If a player shoot's an opponent, his punishment countdown will be resetted. 81 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override; //!< Resets punishment time and respawn delay. 82 virtual void tick (float dt) override; //!< used to end the game 83 virtual void end() override; //!< Sends an end message. 84 84 void punishPlayer(PlayerInfo* player); //!< Function in order to kill a player. Punishment for hiding longer than "timeRemaining". 85 85 int playerGetLives(PlayerInfo* player); //!< getFunction for the map "playerLives_". -
code/branches/cpp11_v3/src/orxonox/gametypes/Mission.cc
r10624 r11054 101 101 void Mission::setTeams() 102 102 { //Set pawn-colours 103 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)103 for (Pawn* pawn : ObjectList<Pawn>()) 104 104 { 105 Pawn* pawn = static_cast<Pawn*>(*it);106 105 if (!pawn) 107 106 continue; … … 111 110 void Mission::endMission(bool accomplished) 112 111 { 113 for ( ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)112 for (Mission* mission : ObjectList<Mission>()) 114 113 { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would end ALL missions! 115 it->setMissionAccomplished(accomplished);116 it->end();114 mission->setMissionAccomplished(accomplished); 115 mission->end(); 117 116 } 118 117 } … … 120 119 void Mission::setLivesWrapper(unsigned int amount) 121 120 { 122 for ( ObjectList<Mission>::iterator it = ObjectList<Mission>::begin(); it != ObjectList<Mission>::end(); ++it)121 for (Mission* mission : ObjectList<Mission>()) 123 122 { //TODO: make sure that only the desired mission is ended !! This is a dirty HACK, that would affect ALL missions! 124 it->setLives(amount);123 mission->setLives(amount); 125 124 } 126 125 } -
code/branches/cpp11_v3/src/orxonox/gametypes/Mission.h
r9729 r11054 42 42 virtual ~Mission() {} 43 43 44 virtual void tick(float dt) ;44 virtual void tick(float dt) override; 45 45 46 virtual void start() ;47 virtual void end() ;46 virtual void start() override; 47 virtual void end() override; 48 48 virtual void setTeams(); 49 virtual void addBots(unsigned int amount) {} //<! overwrite function in order to bypass the addbots command49 virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command 50 50 inline void setLives(unsigned int amount) 51 51 {this->lives_ = amount;} … … 58 58 59 59 protected: 60 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);60 virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override; 61 61 bool missionAccomplished_; //<! indicates if player successfully finsihed the mission; 62 62 int lives_; //<! amount of player's lives <-> nr. of retries -
code/branches/cpp11_v3/src/orxonox/gametypes/TeamBaseMatch.cc
r9667 r11054 152 152 int amountControlled2 = 0; 153 153 154 for ( std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)155 { 156 if( (*it)->getState() == BaseState::ControlTeam1)154 for (TeamBaseMatchBase* base : this->bases_) 155 { 156 if(base->getState() == BaseState::ControlTeam1) 157 157 { 158 158 amountControlled++; 159 159 } 160 if( (*it)->getState() == BaseState::ControlTeam2)160 if(base->getState() == BaseState::ControlTeam2) 161 161 { 162 162 amountControlled2++; … … 187 187 } 188 188 189 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)190 { 191 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)189 for (const auto& mapEntry : this->teamnumbers_) 190 { 191 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 192 192 continue; 193 193 194 if ( it->second == winningteam)195 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());194 if (mapEntry.second == winningteam) 195 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 196 196 else 197 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());197 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 198 198 } 199 199 … … 238 238 int count = 0; 239 239 240 for ( std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)241 { 242 if ( (*it)->getState() == BaseState::ControlTeam1 && team == 0)240 for (TeamBaseMatchBase* base : this->bases_) 241 { 242 if (base->getState() == BaseState::ControlTeam1 && team == 0) 243 243 count++; 244 if ( (*it)->getState() == BaseState::ControlTeam2 && team == 1)244 if (base->getState() == BaseState::ControlTeam2 && team == 1) 245 245 count++; 246 246 } … … 258 258 { 259 259 unsigned int i = 0; 260 for ( std::set<TeamBaseMatchBase*>::const_iterator it = this->bases_.begin(); it != this->bases_.end(); ++it)260 for (TeamBaseMatchBase* base : this->bases_) 261 261 { 262 262 i++; 263 263 if (i > index) 264 return (*it);265 } 266 return 0;264 return base; 265 } 266 return nullptr; 267 267 } 268 268 -
code/branches/cpp11_v3/src/orxonox/gametypes/TeamBaseMatch.h
r9667 r11054 44 44 virtual ~TeamBaseMatch() {} 45 45 46 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);47 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) ;46 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; 47 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator) override; 48 48 49 virtual void playerScored(PlayerInfo* player, int score = 1) ;49 virtual void playerScored(PlayerInfo* player, int score = 1) override; 50 50 virtual void showPoints(); 51 51 virtual void endGame(); -
code/branches/cpp11_v3/src/orxonox/gametypes/TeamDeathmatch.cc
r9941 r11054 69 69 int winnerTeam = 0; 70 70 int highestScore = 0; 71 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)71 for (const auto& mapEntry : this->players_) 72 72 { 73 if ( this->getTeamScore( it->first) > highestScore )73 if ( this->getTeamScore(mapEntry.first) > highestScore ) 74 74 { 75 winnerTeam = this->getTeam( it->first);76 highestScore = this->getTeamScore( it->first);75 winnerTeam = this->getTeam(mapEntry.first); 76 highestScore = this->getTeamScore(mapEntry.first); 77 77 } 78 78 } -
code/branches/cpp11_v3/src/orxonox/gametypes/TeamDeathmatch.h
r9941 r11054 42 42 43 43 void setConfigValues(); 44 virtual void start() ;45 virtual void end() ;46 virtual void playerEntered(PlayerInfo* player) ;47 virtual bool playerLeft(PlayerInfo* player) ;48 virtual bool playerChangedName(PlayerInfo* player) ;44 virtual void start() override; 45 virtual void end() override; 46 virtual void playerEntered(PlayerInfo* player) override; 47 virtual bool playerLeft(PlayerInfo* player) override; 48 virtual bool playerChangedName(PlayerInfo* player) override; 49 49 50 virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);51 virtual void playerScored(PlayerInfo* player, int score = 1) ;50 virtual void pawnKilled(Pawn* victim, Pawn* killer = nullptr) override; 51 virtual void playerScored(PlayerInfo* player, int score = 1) override; 52 52 protected: 53 53 int maxScore_; -
code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.cc
r9941 r11054 75 75 void TeamGametype::playerEntered(PlayerInfo* player) 76 76 { 77 if(player == NULL) return; // catch null pointers77 if(player == nullptr) return; // catch null pointers 78 78 Gametype::playerEntered(player); 79 79 this->findAndSetTeam(player); … … 96 96 void TeamGametype::findAndSetTeam(PlayerInfo* player) 97 97 { 98 if(player == NULL) return; // catch null pointers98 if(player == nullptr) return; // catch null pointers 99 99 std::vector<unsigned int> playersperteam(this->teams_, 0); 100 100 101 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)102 if ( it->second < static_cast<int>(this->teams_) && it->second >= 0)103 playersperteam[ it->second]++;101 for (const auto& mapEntry : this->teamnumbers_) 102 if (mapEntry.second < static_cast<int>(this->teams_) && mapEntry.second >= 0) 103 playersperteam[mapEntry.second]++; 104 104 105 105 unsigned int minplayers = static_cast<unsigned int>(-1); … … 123 123 if( (this->players_.size() >= maxPlayers_) && (allowedInGame_[player] == true) ) // if there's a "waiting list" 124 124 { 125 for ( std::map<PlayerInfo*, bool>::iterator it = this->allowedInGame_.begin(); it != this->allowedInGame_.end(); ++it)126 { 127 if( it->second == false) // waiting player found128 { it->second = true; break;} // allow player to enter125 for (auto& mapEntry : this->allowedInGame_) 126 { 127 if(mapEntry.second == false) // waiting player found 128 {mapEntry.second = true; break;} // allow player to enter 129 129 } 130 130 } … … 141 141 void TeamGametype::spawnDeadPlayersIfRequested() 142 142 { 143 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)\144 { 145 if(allowedInGame_[ it->first] == false)//check if dead player is allowed to enter143 for (const auto& mapEntry : this->players_)\ 144 { 145 if(allowedInGame_[mapEntry.first] == false)//check if dead player is allowed to enter 146 146 { 147 147 continue; 148 148 } 149 if ( it->second.state_ == PlayerState::Dead)150 { 151 if (( it->first->isReadyToSpawn() || this->bForceSpawn_))149 if (mapEntry.second.state_ == PlayerState::Dead) 150 { 151 if ((mapEntry.first->isReadyToSpawn() || this->bForceSpawn_)) 152 152 { 153 this->spawnPlayer( it->first);153 this->spawnPlayer(mapEntry.first); 154 154 } 155 155 } … … 178 178 if(!player || this->getTeam(player) == -1) 179 179 return 0; 180 for ( std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)181 { 182 if ( this->getTeam( it->first) == this->getTeam(player) )183 { 184 teamscore += it->second.frags_;180 for (const auto& mapEntry : this->players_) 181 { 182 if ( this->getTeam(mapEntry.first) == this->getTeam(player) ) 183 { 184 teamscore += mapEntry.second.frags_; 185 185 } 186 186 } … … 191 191 { 192 192 int teamSize = 0; 193 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)194 { 195 if ( it->second == team)193 for (const auto& mapEntry : this->teamnumbers_) 194 { 195 if (mapEntry.second == team) 196 196 teamSize++; 197 197 } … … 202 202 { 203 203 int teamSize = 0; 204 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)205 { 206 if ( it->second == team && it->first->isHumanPlayer())204 for (const auto& mapEntry : this->teamnumbers_) 205 { 206 if (mapEntry.second == team && mapEntry.first->isHumanPlayer()) 207 207 teamSize++; 208 208 } … … 235 235 } 236 236 237 SpawnPoint* fallbackSpawnPoint = NULL;237 SpawnPoint* fallbackSpawnPoint = nullptr; 238 238 if (teamSpawnPoints.size() > 0) 239 239 { … … 241 241 unsigned int index = 0; 242 242 // Get random fallback spawnpoint in case there is no active SpawnPoint. 243 for ( std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)243 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 244 244 { 245 245 if (index == randomspawn) 246 246 { 247 fallbackSpawnPoint = (*it);247 fallbackSpawnPoint = teamSpawnPoint; 248 248 break; 249 249 } … … 266 266 randomspawn = static_cast<unsigned int>(rnd(static_cast<float>(teamSpawnPoints.size()))); 267 267 index = 0; 268 for ( std::set<SpawnPoint*>::const_iterator it = teamSpawnPoints.begin(); it != teamSpawnPoints.end(); ++it)268 for (SpawnPoint* teamSpawnPoint : teamSpawnPoints) 269 269 { 270 270 if (index == randomspawn) 271 return (*it);271 return teamSpawnPoint; 272 272 273 273 ++index; … … 277 277 } 278 278 279 return 0;279 return nullptr; 280 280 } 281 281 … … 328 328 void TeamGametype::setDefaultObjectColour(Pawn* pawn) 329 329 { 330 if(pawn == NULL)330 if(pawn == nullptr) 331 331 return; 332 332 … … 340 340 ControllableEntity* entity = orxonox_cast<ControllableEntity*>(pawn); 341 341 342 Controller* controller = 0;342 Controller* controller = nullptr; 343 343 if (entity->getController()) 344 344 controller = entity->getController(); … … 350 350 ArtificialController* artificial = orxonox_cast<ArtificialController*>(controller); 351 351 //get Teamnumber - get the data 352 if(artificial == NULL)352 if(artificial == nullptr) 353 353 return; 354 354 teamnumber= artificial->getTeam(); … … 360 360 void TeamGametype::colourPawn(Pawn* pawn, int teamNr) 361 361 {// catch: no-colouring-case and wrong input 362 if(teamNr < 0 || teamNr+1 > int(this->teamcolours_.size()) ||pawn == NULL) return;362 if(teamNr < 0 || teamNr+1 > int(this->teamcolours_.size()) ||pawn == nullptr) return; 363 363 pawn->setRadarObjectColour(this->teamcolours_[teamNr]); 364 364 365 365 std::set<WorldEntity*> pawnAttachments = pawn->getAttachedObjects(); 366 for ( std::set<WorldEntity*>::iterator it = pawnAttachments.begin(); it != pawnAttachments.end(); ++it)367 { 368 if ( (*it)->isA(Class(TeamColourable)))369 { 370 TeamColourable* tc = orxonox_cast<TeamColourable*>( *it);366 for (WorldEntity* pawnAttachment : pawnAttachments) 367 { 368 if (pawnAttachment->isA(Class(TeamColourable))) 369 { 370 TeamColourable* tc = orxonox_cast<TeamColourable*>(pawnAttachment); 371 371 tc->setTeamColour(this->teamcolours_[teamNr]); 372 372 } … … 376 376 void TeamGametype::announceTeamWin(int winnerTeam) 377 377 { 378 for ( std::map<PlayerInfo*, int>::iterator it3 = this->teamnumbers_.begin(); it3 != this->teamnumbers_.end(); ++it3)379 { 380 if ( it3->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)378 for (const auto& mapEntry : this->teamnumbers_) 379 { 380 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 381 381 continue; 382 if ( it3->second == winnerTeam)383 { 384 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", it3->first->getClientID());382 if (mapEntry.second == winnerTeam) 383 { 384 this->gtinfo_->sendAnnounceMessage("Your team has won the match!", mapEntry.first->getClientID()); 385 385 } 386 386 else 387 387 { 388 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", it3->first->getClientID());388 this->gtinfo_->sendAnnounceMessage("Your team has lost the match!", mapEntry.first->getClientID()); 389 389 } 390 390 } -
code/branches/cpp11_v3/src/orxonox/gametypes/TeamGametype.h
r9941 r11054 46 46 void setConfigValues(); 47 47 48 virtual void playerEntered(PlayerInfo* player) ;48 virtual void playerEntered(PlayerInfo* player) override; 49 49 virtual void findAndSetTeam(PlayerInfo* player); 50 virtual bool playerLeft(PlayerInfo* player) ;51 virtual void spawnDeadPlayersIfRequested() ; //!< Prevents players to respawn.50 virtual bool playerLeft(PlayerInfo* player) override; 51 virtual void spawnDeadPlayersIfRequested() override; //!< Prevents players to respawn. 52 52 53 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);54 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);55 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);53 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr) override; 54 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; 55 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; 56 56 57 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) ;57 virtual void playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) override; 58 58 59 59 … … 67 67 68 68 protected: 69 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const ;69 virtual SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const override; 70 70 bool pawnsAreInTheSameTeam(Pawn* pawn1, Pawn* pawn2); 71 71 -
code/branches/cpp11_v3/src/orxonox/gametypes/UnderAttack.cc
r9941 r11054 48 48 this->gameTime_ = 180; 49 49 this->teams_ = 2; 50 this->destroyer_ = 0;50 this->destroyer_ = nullptr; 51 51 this->destroyer_.setCallback(createFunctor(&UnderAttack::killedDestroyer, this)); 52 52 this->gameEnded_ = false; … … 74 74 this->gameEnded_ = true; 75 75 76 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)77 { 78 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)76 for (const auto& mapEntry : this->teamnumbers_) 77 { 78 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 79 79 continue; 80 80 81 if ( it->second == attacker_)82 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());81 if (mapEntry.second == attacker_) 82 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 83 83 else 84 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());84 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 85 85 } 86 86 } … … 155 155 ChatManager::message(message); 156 156 157 for ( std::map<PlayerInfo*, int>::iterator it = this->teamnumbers_.begin(); it != this->teamnumbers_.end(); ++it)158 { 159 if ( it->first->getClientID() == NETWORK_PEER_ID_UNKNOWN)157 for (const auto& mapEntry : this->teamnumbers_) 158 { 159 if (mapEntry.first->getClientID() == NETWORK_PEER_ID_UNKNOWN) 160 160 continue; 161 161 162 if ( it->second == 1)163 this->gtinfo_->sendAnnounceMessage("You have won the match!", it->first->getClientID());162 if (mapEntry.second == 1) 163 this->gtinfo_->sendAnnounceMessage("You have won the match!", mapEntry.first->getClientID()); 164 164 else 165 this->gtinfo_->sendAnnounceMessage("You have lost the match!", it->first->getClientID());165 this->gtinfo_->sendAnnounceMessage("You have lost the match!", mapEntry.first->getClientID()); 166 166 } 167 167 } … … 202 202 void UnderAttack::setTransporterHealth() 203 203 { 204 if (this->destroyer_ != 0)204 if (this->destroyer_ != nullptr) 205 205 { 206 206 //Calculation: Each attacker deals about 3500 damage. A human attacker deals 1500 damage additionally. -
code/branches/cpp11_v3/src/orxonox/gametypes/UnderAttack.h
r9941 r11054 43 43 44 44 void setConfigValues(); 45 v oid tick (float dt);45 virtual void tick (float dt) override; 46 46 void addDestroyer(Destroyer* destroyer); 47 47 inline Destroyer* getDestroyer() const 48 48 { return this->destroyer_; } 49 49 50 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = 0);51 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = 0);52 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = 0);53 virtual void playerEntered(PlayerInfo* player) ;50 virtual bool allowPawnHit(Pawn* victim, Pawn* originator = nullptr) override; 51 virtual bool allowPawnDamage(Pawn* victim, Pawn* originator = nullptr) override; 52 virtual bool allowPawnDeath(Pawn* victim, Pawn* originator = nullptr) override; 53 virtual void playerEntered(PlayerInfo* player) override; 54 54 55 55 protected: -
code/branches/cpp11_v3/src/orxonox/graphics/AnimatedModel.h
r9667 r11054 44 44 virtual ~AnimatedModel(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 void registerVariables(); 48 48 … … 51 51 virtual void setAnimEnabled(bool enabled); 52 52 virtual void setAnimLoop(bool loop); 53 virtual void tick(float dt) ;53 virtual void tick(float dt) override; 54 54 virtual void changedMesh(); 55 55 -
code/branches/cpp11_v3/src/orxonox/graphics/Backlight.cc
r9667 r11054 51 51 RegisterObject(Backlight); 52 52 53 this->ribbonTrail_ = 0;54 this->ribbonTrailNode_ = 0;53 this->ribbonTrail_ = nullptr; 54 this->ribbonTrailNode_ = nullptr; 55 55 56 56 this->width_ = 0; -
code/branches/cpp11_v3/src/orxonox/graphics/Backlight.h
r9667 r11054 44 44 virtual ~Backlight(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 virtual void tick(float dt) ;49 virtual void changedVisibility() ;48 virtual void tick(float dt) override; 49 virtual void changedVisibility() override; 50 50 51 51 inline void setWidth(float width) … … 74 74 { return this->trailmaterial_; } 75 75 76 virtual void changedScale() ;76 virtual void changedScale() override; 77 77 78 78 protected: 79 virtual void changedTimeFactor(float factor_new, float factor_old) ;79 virtual void changedTimeFactor(float factor_new, float factor_old) override; 80 80 81 81 private: 82 82 void registerVariables(); 83 virtual void startturnonoff() ;84 virtual void stopturnonoff() ;85 virtual void poststopturnonoff() ;86 virtual void changedColour() ;83 virtual void startturnonoff() override; 84 virtual void stopturnonoff() override; 85 virtual void poststopturnonoff() override; 86 virtual void changedColour() override; 87 87 void update_width(); 88 88 void update_lifetime(); -
code/branches/cpp11_v3/src/orxonox/graphics/Billboard.cc
r9667 r11054 139 139 { 140 140 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 141 if( bSet != NULL)141 if( bSet != nullptr ) 142 142 { 143 143 bSet->setBillboardType(bbt); … … 148 148 { 149 149 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 150 if( bSet != NULL)150 if( bSet != nullptr ) 151 151 { 152 152 bSet->setCommonDirection( vec ); … … 157 157 { 158 158 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 159 if( bSet != NULL)159 if( bSet != nullptr ) 160 160 { 161 161 bSet->setCommonUpVector( vec ); … … 166 166 { 167 167 Ogre::BillboardSet* bSet = this->billboard_.getBillboardSet(); 168 if( bSet != NULL)168 if( bSet != nullptr ) 169 169 { 170 170 bSet->setDefaultDimensions(width, height); -
code/branches/cpp11_v3/src/orxonox/graphics/Billboard.h
r9667 r11054 47 47 virtual ~Billboard(); 48 48 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 50 50 51 virtual void changedVisibility() ;51 virtual void changedVisibility() override; 52 52 53 53 inline const BillboardSet& getBillboardSet() const … … 71 71 72 72 73 virtual void setTeamColour(const ColourValue& colour) 73 virtual void setTeamColour(const ColourValue& colour) override 74 74 { this->setColour(colour); } 75 75 -
code/branches/cpp11_v3/src/orxonox/graphics/BlinkingBillboard.h
r9667 r11054 44 44 virtual ~BlinkingBillboard(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 virtual void tick(float dt) ;48 virtual void tick(float dt) override; 49 49 50 50 inline void setAmplitude(float amplitude) -
code/branches/cpp11_v3/src/orxonox/graphics/Camera.h
r9667 r11054 50 50 51 51 void setConfigValues(); 52 virtual void tick(float dt) ;52 virtual void tick(float dt) override; 53 53 54 54 void requestFocus(); … … 72 72 void configvaluecallback_changedNearClipDistance(); 73 73 74 v oid windowResized(unsigned int newWidth, unsigned int newHeight);74 virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override; 75 75 76 76 Ogre::Camera* camera_; -
code/branches/cpp11_v3/src/orxonox/graphics/FadingBillboard.h
r9667 r11054 45 45 virtual ~FadingBillboard(); 46 46 47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;47 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 48 48 49 virtual void tick(float dt) ;50 virtual void changedActivity() ;51 virtual void changedVisibility() ;49 virtual void tick(float dt) override; 50 virtual void changedActivity() override; 51 virtual void changedVisibility() override; 52 52 53 53 inline void setTurnOnTime(float turnontime) … … 69 69 virtual void stopturnonoff(); 70 70 virtual void poststopturnonoff(); 71 virtual void changedColour() ;71 virtual void changedColour() override; 72 72 73 73 float turnontime_; -
code/branches/cpp11_v3/src/orxonox/graphics/GlobalShader.h
r9667 r11054 44 44 virtual ~GlobalShader(); 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 virtual void changedVisibility() ;48 virtual void changedVisibility() override; 49 49 50 50 inline const Shader& getShader() const -
code/branches/cpp11_v3/src/orxonox/graphics/Light.cc
r9667 r11054 31 31 #include <OgreSceneManager.h> 32 32 #include <OgreLight.h> 33 #include <boost/static_assert.hpp>34 33 35 34 #include "util/StringUtils.h" … … 45 44 46 45 // Be sure we don't do bad conversions 47 BOOST_STATIC_ASSERT((int)Ogre::Light::LT_POINT == (int)Light::Point);48 BOOST_STATIC_ASSERT((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional);49 BOOST_STATIC_ASSERT((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Spotlight);46 static_assert((int)Ogre::Light::LT_POINT == (int)Light::Point, "check enum"); 47 static_assert((int)Ogre::Light::LT_DIRECTIONAL == (int)Light::Directional, "check enum"); 48 static_assert((int)Ogre::Light::LT_SPOTLIGHT == (int)Light::Spotlight, "check enum"); 50 49 51 50 Light::Light(Context* context) : StaticEntity(context) … … 53 52 RegisterObject(Light); 54 53 55 this->light_ = 0;54 this->light_ = nullptr; 56 55 this->diffuse_ = ColourValue::White; 57 56 this->specular_ = ColourValue::White; -
code/branches/cpp11_v3/src/orxonox/graphics/Light.h
r9667 r11054 56 56 virtual ~Light(); 57 57 58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;58 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 59 59 60 virtual void changedVisibility() ;60 virtual void changedVisibility() override; 61 61 62 62 inline Ogre::Light* getLight() … … 78 78 { return this->specular_; } 79 79 80 virtual void setTeamColour(const ColourValue& colour) 80 virtual void setTeamColour(const ColourValue& colour) override 81 81 { this->setDiffuseColour(colour); this->setSpecularColour(colour); } 82 82 -
code/branches/cpp11_v3/src/orxonox/graphics/MeshLodInformation.h
r9667 r11054 50 50 float getReductionRate(){ return this->reductionRate_; } 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 53 54 54 private: -
code/branches/cpp11_v3/src/orxonox/graphics/Model.cc
r10728 r11054 134 134 Level* level = this->getLevel(); 135 135 136 assert( level != 0);136 assert( level != nullptr ); 137 137 138 138 MeshLodInformation* lodInfo = level->getLodInfo(this->meshSrc_); … … 157 157 BaseObject* creatorPtr = this; 158 158 159 while(creatorPtr!= NULL&&orxonox_cast<WorldEntity*>(creatorPtr))159 while(creatorPtr!=nullptr&&orxonox_cast<WorldEntity*>(creatorPtr)) 160 160 { 161 161 scaleFactor *= getBiggestScale(((WorldEntity*) creatorPtr)->getScale3D()); -
code/branches/cpp11_v3/src/orxonox/graphics/Model.h
r9667 r11054 46 46 void setConfigValues(); 47 47 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 49 50 virtual void changedVisibility() ;50 virtual void changedVisibility() override; 51 51 52 52 inline const Mesh& getMesh() const -
code/branches/cpp11_v3/src/orxonox/graphics/ParticleEmitter.cc
r9950 r11054 52 52 ThrowException(AbortLoading, "Can't create ParticleEmitter, no scene or no scene manager given."); 53 53 54 this->particles_ = 0;54 this->particles_ = nullptr; 55 55 this->LOD_ = LODParticle::Normal; 56 56 … … 102 102 { 103 103 delete this->particles_; 104 this->particles_ = 0;104 this->particles_ = nullptr; 105 105 } 106 106 -
code/branches/cpp11_v3/src/orxonox/graphics/ParticleEmitter.h
r9950 r11054 43 43 virtual ~ParticleEmitter(); 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 47 virtual void changedVisibility() ;48 virtual void changedActivity() ;47 virtual void changedVisibility() override; 48 virtual void changedActivity() override; 49 49 50 50 inline ParticleInterface* getParticleInterface() const -
code/branches/cpp11_v3/src/orxonox/graphics/ParticleSpawner.h
r9667 r11054 43 43 virtual ~ParticleSpawner(); 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 inline void stop(bool bDestroy) -
code/branches/cpp11_v3/src/orxonox/infos/Bot.h
r9667 r11054 45 45 void setConfigValues(); 46 46 47 inline bool isInitialized() const47 virtual inline bool isInitialized() const override 48 48 { return true; } 49 inline float getPing() const49 virtual inline float getPing() const override 50 50 { return 0; } 51 inline float getPacketLossRatio() const51 virtual inline float getPacketLossRatio() const override 52 52 { return 0; } 53 53 -
code/branches/cpp11_v3/src/orxonox/infos/GametypeInfo.cc
r10624 r11054 461 461 void GametypeInfo::dispatchAnnounceMessage(const std::string& message) const 462 462 { 463 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)464 it->announcemessage(this, message);463 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 464 listener->announcemessage(this, message); 465 465 } 466 466 467 467 void GametypeInfo::dispatchKillMessage(const std::string& message) const 468 468 { 469 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)470 it->killmessage(this, message);469 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 470 listener->killmessage(this, message); 471 471 } 472 472 473 473 void GametypeInfo::dispatchDeathMessage(const std::string& message) const 474 474 { 475 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)476 it->deathmessage(this, message);475 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 476 listener->deathmessage(this, message); 477 477 } 478 478 479 479 void GametypeInfo::dispatchStaticMessage(const std::string& message, const ColourValue& colour) const 480 480 { 481 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)482 it->staticmessage(this, message, colour);481 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 482 listener->staticmessage(this, message, colour); 483 483 } 484 484 485 485 void GametypeInfo::dispatchFadingMessage(const std::string& message) const 486 486 { 487 for ( ObjectList<GametypeMessageListener>::iterator it = ObjectList<GametypeMessageListener>::begin(); it != ObjectList<GametypeMessageListener>::end(); ++it)488 it->fadingmessage(this, message);487 for (GametypeMessageListener* listener : ObjectList<GametypeMessageListener>()) 488 listener->fadingmessage(this, message); 489 489 } 490 490 } -
code/branches/cpp11_v3/src/orxonox/infos/HumanPlayer.cc
r10624 r11054 53 53 this->defaultController_ = Class(NewHumanController); 54 54 55 this->humanHud_ = 0;56 this->gametypeHud_ = 0;55 this->humanHud_ = nullptr; 56 this->gametypeHud_ = nullptr; 57 57 58 58 this->setConfigValues(); … … 178 178 { 179 179 this->humanHud_->destroy(); 180 this->humanHud_ = 0;180 this->humanHud_ = nullptr; 181 181 } 182 182 … … 194 194 { 195 195 this->gametypeHud_->destroy(); 196 this->gametypeHud_ = 0;196 this->gametypeHud_ = nullptr; 197 197 } 198 198 -
code/branches/cpp11_v3/src/orxonox/infos/HumanPlayer.h
r10624 r11054 45 45 void setConfigValues(); 46 46 47 bool isInitialized() const;48 float getPing() const;49 float getPacketLossRatio() const;47 virtual bool isInitialized() const override; 48 virtual float getPing() const override; 49 virtual float getPacketLossRatio() const override; 50 50 51 51 void setClientID(unsigned int clientID); 52 52 53 virtual void switchGametype(Gametype* gametype) ;53 virtual void switchGametype(Gametype* gametype) override; 54 54 55 55 inline void setHumanHUDTemplate(const std::string& name) -
code/branches/cpp11_v3/src/orxonox/infos/PlayerInfo.cc
r11052 r11054 51 51 this->bReadyToSpawn_ = false; 52 52 this->bSetUnreadyAfterSpawn_ = true; 53 this->controller_ = 0;54 this->controllableEntity_ = 0;53 this->controller_ = nullptr; 54 this->controllableEntity_ = nullptr; 55 55 this->controllableEntityID_ = OBJECTID_UNKNOWN; 56 56 57 this->gtinfo_ = 0;57 this->gtinfo_ = nullptr; 58 58 this->gtinfoID_ = OBJECTID_UNKNOWN; 59 59 this->updateGametypeInfo(this->getGametype()); … … 72 72 { 73 73 this->controller_->destroy(); 74 this->controller_ = 0;74 this->controller_ = nullptr; 75 75 } 76 76 … … 126 126 void PlayerInfo::updateGametypeInfo(Gametype* gametype) 127 127 { 128 this->gtinfo_ = 0;128 this->gtinfo_ = nullptr; 129 129 this->gtinfoID_ = OBJECTID_UNKNOWN; 130 130 … … 141 141 { 142 142 this->controller_->destroy(); 143 this->controller_ = 0;143 this->controller_ = nullptr; 144 144 } 145 145 this->controller_ = this->defaultController_.fabricate(this->getContext()); … … 181 181 182 182 RadarViewable* radarviewable = orxonox_cast<RadarViewable*>(entity); 183 if (radarviewable != NULL)183 if (radarviewable != nullptr) 184 184 radarviewable->setRadarName(this->getName()); 185 185 } … … 218 218 return; 219 219 220 this->controllableEntity_->setController( 0);221 this->controllableEntity_ = 0;220 this->controllableEntity_->setController(nullptr); 221 this->controllableEntity_ = nullptr; 222 222 this->controllableEntityID_ = OBJECTID_UNKNOWN; 223 223 224 224 if (this->controller_) 225 this->controller_->setControllableEntity( 0);225 this->controller_->setControllableEntity(nullptr); 226 226 227 227 if ( GameMode::isMaster() ) … … 239 239 240 240 Controller* tmp =this->controllableEntity_->getController(); 241 if (tmp == NULL)242 { 243 orxout(verbose) << "PlayerInfo: pauseControl, Controller is NULL" << endl;241 if (tmp == nullptr) 242 { 243 orxout(verbose) << "PlayerInfo: pauseControl, Controller is nullptr " << endl; 244 244 return; 245 245 } 246 246 tmp->setActive(false); 247 //this->controllableEntity_->getController()->setControllableEntity( NULL);248 this->controllableEntity_->setController( 0);247 //this->controllableEntity_->getController()->setControllableEntity(nullptr); 248 this->controllableEntity_->setController(nullptr); 249 249 } 250 250 … … 253 253 ControllableEntity* entity = this->controllableEntity_; 254 254 255 assert(this->controllableEntity_ != NULL);255 assert(this->controllableEntity_ != nullptr); 256 256 if( !entity || this->previousControllableEntity_.size() == 0 ) 257 257 return; … … 259 259 entity->destroyHud(); // HACK-ish 260 260 261 this->controllableEntity_->setController( 0);261 this->controllableEntity_->setController(nullptr); 262 262 if(this->isHumanPlayer()) // TODO: Multiplayer? 263 263 this->controllableEntity_->destroyHud(); // HACK-ish … … 266 266 do { 267 267 this->controllableEntity_ = this->previousControllableEntity_.back(); 268 } while(this->controllableEntity_ == NULL&& this->previousControllableEntity_.size() > 0);268 } while(this->controllableEntity_ == nullptr && this->previousControllableEntity_.size() > 0); 269 269 this->controllableEntityID_ = this->controllableEntity_->getObjectID(); 270 270 this->previousControllableEntity_.pop_back(); 271 271 272 if ( this->controllableEntity_ != NULL && this->controller_ != NULL)272 if ( this->controllableEntity_ != nullptr && this->controller_ != nullptr) 273 273 this->controller_->setControllableEntity(this->controllableEntity_); 274 274 275 275 // HACK-ish 276 if(this->controllableEntity_ != NULL&& this->isHumanPlayer())276 if(this->controllableEntity_ != nullptr && this->isHumanPlayer()) 277 277 this->controllableEntity_->createHud(); 278 278 -
code/branches/cpp11_v3/src/orxonox/infos/PlayerInfo.h
r10624 r11054 44 44 virtual ~PlayerInfo(); 45 45 46 virtual void changedName() ;46 virtual void changedName() override; 47 47 virtual void switchGametype(Gametype* gametype); 48 48 … … 99 99 Controller* controller_; 100 100 ControllableEntity* controllableEntity_; 101 std::vector< WeakPtr<ControllableEntity>> previousControllableEntity_; //!< List of the previous ControllableEntities if repeatedly startTemporary control was called. The ControllableEntity at the back is the most recent.101 std::vector<WeakPtr<ControllableEntity>> previousControllableEntity_; //!< List of the previous ControllableEntities if repeatedly startTemporary control was called. The ControllableEntity at the back is the most recent. 102 102 unsigned int controllableEntityID_; 103 103 -
code/branches/cpp11_v3/src/orxonox/interfaces/NotificationListener.cc
r10624 r11054 108 108 { 109 109 // Iterate through all NotificationListeners and notify them by calling the method they overloaded. 110 for( ObjectList<NotificationListener>::iterator it = ObjectList<NotificationListener>::begin(); it != ObjectList<NotificationListener>::end(); ++it)110 for(NotificationListener* listener : ObjectList<NotificationListener>()) 111 111 { 112 112 // If the notification is a message. 113 113 if(!isCommand) 114 it->registerNotification(message, sender, notificationMessageType::Value(messageType));114 listener->registerNotification(message, sender, notificationMessageType::Value(messageType)); 115 115 116 116 // If the notification is a command. … … 119 119 notificationCommand::Value command = str2Command(message); 120 120 if(command != notificationCommand::none) 121 it->executeCommand(command, sender);121 listener->executeCommand(command, sender); 122 122 } 123 123 } -
code/branches/cpp11_v3/src/orxonox/interfaces/PickupCarrier.cc
r10624 r11054 101 101 // Go recursively through all children to check whether they are a target. 102 102 std::vector<PickupCarrier*>* children = this->getCarrierChildren(); 103 for( std::vector<PickupCarrier*>::const_iterator it = children->begin(); it != children->end(); it++)103 for(PickupCarrier* carrier : *children) 104 104 { 105 if( (*it)->isTarget(pickup))105 if(carrier->isTarget(pickup)) 106 106 { 107 107 isTarget = true; … … 127 127 { 128 128 if(!this->isTarget(pickup)) 129 return NULL;129 return nullptr; 130 130 131 131 if(pickup->isTarget(this)) // If the PickupCarrier itself is a target. 132 132 return this; 133 133 134 PickupCarrier* target = NULL;134 PickupCarrier* target = nullptr; 135 135 // Go recursively through all children to check whether they are the target. 136 136 std::vector<PickupCarrier*>* children = this->getCarrierChildren(); 137 for( std::vector<PickupCarrier*>::iterator it = children->begin(); it != children->end(); it++)137 for(PickupCarrier* child : *children) 138 138 { 139 if(pickup->isTarget( *it))139 if(pickup->isTarget(child)) 140 140 { 141 target = *it;141 target = child; 142 142 break; 143 143 } -
code/branches/cpp11_v3/src/orxonox/interfaces/PickupCarrier.h
r9667 r11054 59 59 But this structure has to be established first. 60 60 - <b>getCarrierChildren()</b> To this end a PickupCarrier needs to implement getCarrierChildren() which returns a list of its direct PickupCarrier children. If you need an example, have a look at @ref orxonox::Pawn "Pawn" and @ref orxonox::Engine "Engine". 61 - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or NULLif the PickupCarrier is a root node in this hierarchy.61 - <b>getCarrierParent()</b> This is the method in the other direction. It returns the parent of this PickupCarrier, or nullptr if the PickupCarrier is a root node in this hierarchy. 62 62 63 63 @author … … 77 77 PickupCarrier(); //!< Constructor. 78 78 virtual ~PickupCarrier(); //!< Destructor. 79 v oid preDestroy(void); //!< Is called before the PickupCarrier is effectively destroyed.79 virtual void preDestroy(void) override; //!< Is called before the PickupCarrier is effectively destroyed. 80 80 81 81 bool isTarget(const Pickupable* pickup) const; //!< Can be used to check whether the PickupCarrier or a child of his is a target ot the input Pickupable. -
code/branches/cpp11_v3/src/orxonox/interfaces/PickupListener.cc
r10624 r11054 74 74 75 75 // Iterate through all PickupListeners and notify them by calling the method they overloaded. 76 for( ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)77 it->pickupChangedUsed(pickup, used);76 for(PickupListener* listener : ObjectList<PickupListener>()) 77 listener->pickupChangedUsed(pickup, used); 78 78 } 79 79 … … 92 92 93 93 // Iterate through all PickupListeners and notify them by calling the method they overloaded. 94 for( ObjectList<PickupListener>::iterator it = ObjectList<PickupListener>::begin(); it != ObjectList<PickupListener>::end(); ++it)95 it->pickupChangedPickedUp(pickup, pickedUp);94 for(PickupListener* listener : ObjectList<PickupListener>()) 95 listener->pickupChangedPickedUp(pickup, pickedUp); 96 96 } 97 97 -
code/branches/cpp11_v3/src/orxonox/interfaces/Pickupable.cc
r10624 r11054 56 56 RegisterObject(Pickupable); 57 57 58 this->carrier_ = NULL;58 this->carrier_ = nullptr; 59 59 60 60 this->beingDestroyed_ = false; … … 143 143 bool Pickupable::isTarget(const PickupCarrier* carrier) const 144 144 { 145 if(carrier == NULL)145 if(carrier == nullptr) 146 146 return false; 147 147 … … 160 160 { 161 161 // Iterate through all targets of this Pickupable. 162 for( std::list<Identifier*>::const_iterator it = this->targets_.begin(); it != this->targets_.end(); it++)162 for(Identifier* target : this->targets_) 163 163 { 164 if(identifier->isA( *it))164 if(identifier->isA(target)) 165 165 return true; 166 166 } … … 210 210 bool Pickupable::pickup(PickupCarrier* carrier) 211 211 { 212 if(carrier == NULL || this->isPickedUp()) // If carrier is NULLor the Pickupable is already picked up.212 if(carrier == nullptr || this->isPickedUp()) // If carrier is nullptr or the Pickupable is already picked up. 213 213 return false; 214 214 … … 237 237 return false; 238 238 239 assert(this->getCarrier()); // The Carrier cannot be NULLat this point.239 assert(this->getCarrier()); // The Carrier cannot be nullptr at this point. 240 240 if(!this->getCarrier()->removePickup(this)) //TODO Shouldn't this be a little later? 241 241 orxout(internal_warning, context::pickups) << "Pickupable (&" << this << ", " << this->getIdentifier()->getName() << ") is being dropped, but it was not present in the PickupCarriers list of pickups." << endl; … … 249 249 created = this->createSpawner(); 250 250 251 this->setCarrier( NULL);251 this->setCarrier(nullptr); 252 252 253 253 if(!created && createSpawner) // If a PickupSpawner should have been created but wasn't. … … 301 301 orxout(verbose, context::pickups) << "Pickupable (&" << this << ") changed Carrier (& " << carrier << ")." << endl; 302 302 303 if(carrier != NULL&& tell)303 if(carrier != nullptr && tell) 304 304 { 305 305 if(!carrier->addPickup(this)) -
code/branches/cpp11_v3/src/orxonox/interfaces/Pickupable.h
r10624 r11054 144 144 145 145 protected: 146 virtual void preDestroy(void) ; //!< A method that is called by Destroyable::destroy() before the object is actually destroyed.146 virtual void preDestroy(void) override; //!< A method that is called by Destroyable::destroy() before the object is actually destroyed. 147 147 virtual void destroyPickup(void); //!< Destroys a Pickupable. 148 148 virtual void carrierDestroyed(void); //!< Is called by the PickupCarrier when it is being destroyed. … … 182 182 // For implementing the Rewardable interface: 183 183 public: 184 virtual bool reward(PlayerInfo* player) ; //!< Method to transcribe a Pickupable as a Rewardable to the player.184 virtual bool reward(PlayerInfo* player) override; //!< Method to transcribe a Pickupable as a Rewardable to the player. 185 185 186 186 }; -
code/branches/cpp11_v3/src/orxonox/interfaces/RadarViewable.h
r10624 r11054 66 66 if (name == "HIDDEN") 67 67 { 68 this->bVisibility_ = 0;68 this->bVisibility_ = false; 69 69 this->settingsChanged(); 70 70 } -
code/branches/cpp11_v3/src/orxonox/items/Engine.cc
r9667 r11054 50 50 RegisterObject(Engine); 51 51 52 this->ship_ = 0;52 this->ship_ = nullptr; 53 53 this->shipID_ = OBJECTID_UNKNOWN; 54 54 this->relativePosition_ = Vector3::ZERO; … … 136 136 void Engine::networkcallback_shipID() 137 137 { 138 this->ship_ = 0;138 this->ship_ = nullptr; 139 139 140 140 if (this->shipID_ != OBJECTID_UNKNOWN) … … 155 155 void Engine::run(float dt) 156 156 { 157 if (this->ship_ == NULL)157 if (this->ship_ == nullptr) 158 158 { 159 159 if (this->shipID_ != 0) … … 161 161 this->networkcallback_shipID(); 162 162 163 if (this->ship_ == NULL)163 if (this->ship_ == nullptr) 164 164 return; 165 165 } -
code/branches/cpp11_v3/src/orxonox/items/Engine.h
r9667 r11054 59 59 virtual ~Engine(); 60 60 61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;61 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 62 62 void setConfigValues(); 63 63 … … 67 67 /** 68 68 @brief Get the SpaceShip this Engine is mounted on. 69 @return Returns a pointer to the SpaceShip. NULLif it isn't mounted on any ship.69 @return Returns a pointer to the SpaceShip. nullptr if it isn't mounted on any ship. 70 70 */ 71 71 inline SpaceShip* getShip() const -
code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.cc
r9939 r11054 67 67 else 68 68 { 69 this->defEngineSndBoost_ = 0;70 this->defEngineSndNormal_ = 0;71 this->lua_ = 0;69 this->defEngineSndBoost_ = nullptr; 70 this->defEngineSndNormal_ = nullptr; 71 this->lua_ = nullptr; 72 72 } 73 73 this->state_ = 0; … … 85 85 { 86 86 // We have no ship, so the effects are not attached and won't be destroyed automatically 87 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)88 for (std::vector<WorldEntity*>::const_iterator it 2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsBegin(); ++it2)89 (*it 2)->destroy();87 for (EffectContainer* container : this->effectContainers_) 88 for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsBegin(); ++it) 89 (*it)->destroy(); 90 90 if (this->defEngineSndNormal_) 91 91 this->defEngineSndNormal_->destroy(); … … 178 178 179 179 // Update all effect conditions 180 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)181 (*it)->updateCondition();180 for (EffectContainer* container : this->effectContainers_) 181 container->updateCondition(); 182 182 } 183 183 } … … 198 198 this->getShip()->attach(defEngineSndBoost_); 199 199 200 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)201 for (std::vector<WorldEntity*>::const_iterator it 2 = (*it)->getEffectsBegin(); it2 != (*it)->getEffectsEnd(); ++it2)202 this->getShip()->attach(*it 2);200 for (EffectContainer* container : this->effectContainers_) 201 for (std::vector<WorldEntity*>::const_iterator it = container->getEffectsBegin(); it != container->getEffectsEnd(); ++it) 202 this->getShip()->attach(*it); 203 203 } 204 204 205 205 void MultiStateEngine::addEffectContainer(EffectContainer* effect) 206 206 { 207 if (effect == NULL)207 if (effect == nullptr) 208 208 return; 209 209 effect->setLuaState(this->lua_, 'f' + multi_cast<std::string>(this->effectContainers_.size())); … … 219 219 { 220 220 unsigned int i = 0; 221 for ( std::vector<EffectContainer*>::const_iterator it = this->effectContainers_.begin(); it != this->effectContainers_.end(); ++it)221 for (EffectContainer* effectContainer : this->effectContainers_) 222 222 { 223 223 if (i == index) 224 return (*it); 225 } 226 return NULL; 224 return effectContainer; 225 i++; 226 } 227 return nullptr; 227 228 } 228 229 -
code/branches/cpp11_v3/src/orxonox/items/MultiStateEngine.h
r9667 r11054 52 52 virtual ~MultiStateEngine(); 53 53 54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;54 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 55 55 56 virtual void run(float dt) ;56 virtual void run(float dt) override; 57 57 58 virtual void addToSpaceShip(SpaceShip* ship) ;58 virtual void addToSpaceShip(SpaceShip* ship) override; 59 59 60 60 void addEffectContainer(EffectContainer* effect); -
code/branches/cpp11_v3/src/orxonox/items/PartDestructionEvent.h
r10262 r11054 100 100 virtual ~PartDestructionEvent(); 101 101 102 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;102 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 103 103 104 104 void execute(); -
code/branches/cpp11_v3/src/orxonox/items/ShipPart.cc
r11052 r11054 49 49 50 50 ShipPart::ShipPart(Context* context) 51 : Item(context), parent_( NULL)51 : Item(context), parent_(nullptr) 52 52 { 53 53 RegisterObject(ShipPart); … … 121 121 void ShipPart::addEntity(StaticEntity* entity) 122 122 { 123 OrxAssert(entity != NULL, "The Entity cannot be NULL.");123 OrxAssert(entity != nullptr, "The Entity cannot be nullptr."); 124 124 this->entityList_.push_back(entity); 125 125 } … … 129 129 Get the i-th StaticEntity of the ShipPart. 130 130 @return 131 Returns a pointer to the i-the StaticEntity. NULLif there is no StaticEntity with that index.131 Returns a pointer to the i-the StaticEntity. nullptr if there is no StaticEntity with that index. 132 132 */ 133 133 StaticEntity* ShipPart::getEntity(unsigned int index) 134 134 { 135 135 if(this->entityList_.size() >= index) 136 return NULL;136 return nullptr; 137 137 else 138 138 return this->entityList_[index]; … … 142 142 @brief 143 143 Check whether the ShipPart has a particular Entity. 144 @param engine144 @param search 145 145 A pointer to the Entity to be checked. 146 146 */ 147 bool ShipPart::hasEntity(StaticEntity* entity) const148 { 149 for( unsigned int i = 0; i < this->entityList_.size(); i++)150 { 151 if( this->entityList_[i] == entity)147 bool ShipPart::hasEntity(StaticEntity* search) const 148 { 149 for(StaticEntity* entity : this->entityList_) 150 { 151 if(entity == search) 152 152 return true; 153 153 } … … 163 163 void ShipPart::addDestructionEvent(PartDestructionEvent* event) 164 164 { 165 OrxAssert(event != NULL, "The PartDestructionEvent cannot be NULL.");165 OrxAssert(event != nullptr, "The PartDestructionEvent cannot be nullptr."); 166 166 event->setParent(this); 167 167 this->eventList_.push_back(event); … … 172 172 Get the i-th PartDestructionEvent of the ShipPart. 173 173 @return 174 Returns a pointer to the i-the PartDestructionEvent. NULLif there is no PartDestructionEvent with that index.174 Returns a pointer to the i-the PartDestructionEvent. nullptr if there is no PartDestructionEvent with that index. 175 175 */ 176 176 PartDestructionEvent* ShipPart::getDestructionEvent(unsigned int index) 177 177 { 178 178 if(this->eventList_.size() <= index) 179 return NULL;179 return nullptr; 180 180 else 181 181 return this->eventList_[index]; -
code/branches/cpp11_v3/src/orxonox/items/ShipPart.h
r10624 r11054 47 47 virtual ~ShipPart(); 48 48 49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 50 50 51 51 virtual void handleHit(float damage, float healthdamage, float shielddamage, Pawn* originator); -
code/branches/cpp11_v3/src/orxonox/overlays/GUISheet.h
r9667 r11054 44 44 ~GUISheet(); 45 45 46 v oid XMLPort(Element& xmlelement, XMLPort::Mode mode);46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 void show(); -
code/branches/cpp11_v3/src/orxonox/overlays/InGameConsole.cc
r10624 r11054 75 75 : shell_(new Shell("InGameConsole", true)) 76 76 , bShowCursor_(false) 77 , consoleOverlay_( 0)78 , consoleOverlayContainer_( 0)79 , consoleOverlayNoise_( 0)80 , consoleOverlayCursor_( 0)81 , consoleOverlayBorder_( 0)82 , consoleOverlayTextAreas_( 0)83 , inputState_( 0)77 , consoleOverlay_(nullptr) 78 , consoleOverlayContainer_(nullptr) 79 , consoleOverlayNoise_(nullptr) 80 , consoleOverlayCursor_(nullptr) 81 , consoleOverlayBorder_(nullptr) 82 , consoleOverlayTextAreas_(nullptr) 83 , inputState_(nullptr) 84 84 { 85 85 RegisterObject(InGameConsole); … … 130 130 if (this->consoleOverlayTextAreas_[i]) 131 131 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->consoleOverlayTextAreas_[i]); 132 this->consoleOverlayTextAreas_[i] = 0;132 this->consoleOverlayTextAreas_[i] = nullptr; 133 133 } 134 134 … … 140 140 { 141 141 delete[] this->consoleOverlayTextAreas_; 142 this->consoleOverlayTextAreas_ = 0;142 this->consoleOverlayTextAreas_ = nullptr; 143 143 } 144 144 … … 175 175 else 176 176 { 177 inputState_->setMouseHandler( 0);178 inputState_->setJoyStickHandler( 0);177 inputState_->setMouseHandler(nullptr); 178 inputState_->setJoyStickHandler(nullptr); 179 179 } 180 180 } -
code/branches/cpp11_v3/src/orxonox/overlays/InGameConsole.h
r10624 r11054 53 53 void setConfigValues(); 54 54 55 v oid preUpdate(const Clock& time);56 v oid postUpdate(const Clock& time){ /*no action*/ }55 virtual void preUpdate(const Clock& time) override; 56 virtual void postUpdate(const Clock& time) override { /*no action*/ } 57 57 58 58 static void openConsole(); … … 65 65 void deactivate(); 66 66 67 v oid linesChanged();68 v oid lineAdded();69 v oid inputChanged();70 v oid cursorChanged();71 v oid executed();72 v oid exit();67 virtual void linesChanged() override; 68 virtual void lineAdded() override; 69 virtual void inputChanged() override; 70 virtual void cursorChanged() override; 71 virtual void executed() override; 72 virtual void exit() override; 73 73 74 74 void shiftLines(); … … 77 77 void print(const std::string& text, Shell::LineType type, int index, bool alwaysShift = false); 78 78 79 v oid windowResized(unsigned int newWidth, unsigned int newHeight);79 virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override; 80 80 81 81 // config value related -
code/branches/cpp11_v3/src/orxonox/overlays/OrxonoxOverlay.cc
r11052 r11054 70 70 RegisterObject(OrxonoxOverlay); 71 71 72 this->owner_ = 0;73 this->group_ = 0;72 this->owner_ = nullptr; 73 this->group_ = nullptr; 74 74 75 75 if (!GameMode::showsGraphics()) -
code/branches/cpp11_v3/src/orxonox/overlays/OrxonoxOverlay.h
r11052 r11054 90 90 virtual ~OrxonoxOverlay(); 91 91 92 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;93 94 virtual void changedName() ;92 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 93 94 virtual void changedName() override; 95 95 96 96 //! Shows the overlay with an detour to BaseObject::visibility_ … … 167 167 void setBackgroundColour(ColourValue colour); 168 168 169 virtual void changedVisibility() ;169 virtual void changedVisibility() override; 170 170 171 171 inline void setOwner(BaseObject* owner) … … 207 207 208 208 private: 209 v oid windowResized(unsigned int newWidth, unsigned int newHeight);209 virtual void windowResized(unsigned int newWidth, unsigned int newHeight) override; 210 210 211 211 static unsigned int hudOverlayCounter_s; //!< Static counter for hud elements -
code/branches/cpp11_v3/src/orxonox/overlays/OverlayGroup.cc
r11052 r11054 51 51 { 52 52 ArgumentCompletionList names; 53 for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup> ::begin(); it; ++it)53 for (ObjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>().begin(); it; ++it) 54 54 names.push_back(ArgumentCompletionListElement(it->getName(), getLowercase(it->getName()))); 55 55 return names; … … 69 69 RegisterObject(OverlayGroup); 70 70 71 this->owner_ = 0;71 this->owner_ = nullptr; 72 72 73 73 setScale(Vector2(1.0, 1.0)); … … 77 77 OverlayGroup::~OverlayGroup() 78 78 { 79 for ( std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)80 (*it)->destroy();79 for (OrxonoxOverlay* hudElement : hudElements_) 80 hudElement->destroy(); 81 81 this->hudElements_.clear(); 82 82 } … … 101 101 void OverlayGroup::setScale(const Vector2& scale) 102 102 { 103 for ( std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)104 (*it)->scale(scale / this->scale_);103 for (OrxonoxOverlay* hudElement : hudElements_) 104 hudElement->scale(scale / this->scale_); 105 105 this->scale_ = scale; 106 106 } … … 109 109 void OverlayGroup::setScroll(const Vector2& scroll) 110 110 { 111 for ( std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)112 (*it)->scroll(scroll - this->scroll_);111 for (OrxonoxOverlay* hudElement : hudElements_) 112 hudElement->scroll(scroll - this->scroll_); 113 113 this->scroll_ = scroll; 114 114 } … … 148 148 if (index < this->hudElements_.size()) 149 149 { 150 std::set< StrongPtr<OrxonoxOverlay>>::const_iterator it = hudElements_.begin();150 std::set<StrongPtr<OrxonoxOverlay>>::const_iterator it = hudElements_.begin(); 151 151 for (unsigned int i = 0; i != index; ++it, ++i) 152 152 ; … … 154 154 } 155 155 else 156 return 0;156 return nullptr; 157 157 } 158 158 … … 162 162 SUPER( OverlayGroup, changedVisibility ); 163 163 164 for ( std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)165 (*it)->changedVisibility(); //inform all Child Overlays that our visibility has changed164 for (OrxonoxOverlay* hudElement : hudElements_) 165 hudElement->changedVisibility(); //inform all Child Overlays that our visibility has changed 166 166 } 167 167 … … 170 170 this->owner_ = owner; 171 171 172 for ( std::set< StrongPtr<OrxonoxOverlay> >::iterator it = hudElements_.begin(); it != hudElements_.end(); ++it)173 (*it)->setOwner(owner);172 for (OrxonoxOverlay* hudElement : hudElements_) 173 hudElement->setOwner(owner); 174 174 } 175 175 … … 185 185 /*static*/ void OverlayGroup::toggleVisibility(const std::string& name) 186 186 { 187 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)188 { 189 if ( (*it)->getName() == name)190 (*it)->setVisible(!((*it)->isVisible()));187 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 188 { 189 if (group->getName() == name) 190 group->setVisible(!(group->isVisible())); 191 191 } 192 192 } … … 200 200 /*static*/ void OverlayGroup::show(const std::string& name) 201 201 { 202 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)203 { 204 if ( (*it)->getName() == name)202 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 203 { 204 if (group->getName() == name) 205 205 { 206 if( (*it)->isVisible())207 (*it)->changedVisibility();206 if(group->isVisible()) 207 group->changedVisibility(); 208 208 else 209 (*it)->setVisible(!((*it)->isVisible()));209 group->setVisible(!(group->isVisible())); 210 210 } 211 211 } … … 223 223 /*static*/ void OverlayGroup::scaleGroup(const std::string& name, float scale) 224 224 { 225 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)226 { 227 if ( (*it)->getName() == name)228 (*it)->scale(Vector2(scale, scale));225 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 226 { 227 if (group->getName() == name) 228 group->scale(Vector2(scale, scale)); 229 229 } 230 230 } … … 241 241 /*static*/ void OverlayGroup::scrollGroup(const std::string& name, const Vector2& scroll) 242 242 { 243 for (O bjectList<OverlayGroup>::iterator it = ObjectList<OverlayGroup>::begin(); it; ++it)244 { 245 if ( (*it)->getName() == name)246 (*it)->scroll(scroll);243 for (OverlayGroup* group : ObjectList<OverlayGroup>()) 244 { 245 if (group->getName() == name) 246 group->scroll(scroll); 247 247 } 248 248 } -
code/branches/cpp11_v3/src/orxonox/overlays/OverlayGroup.h
r10624 r11054 58 58 ~OverlayGroup(); 59 59 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 61 61 62 62 static void toggleVisibility(const std::string& name); … … 65 65 static void scrollGroup(const std::string& name, const Vector2& scroll); 66 66 67 inline const std::set< StrongPtr<OrxonoxOverlay>>& getOverlays() const67 inline const std::set<StrongPtr<OrxonoxOverlay>>& getOverlays() const 68 68 { return this->hudElements_; } 69 69 70 virtual void changedVisibility() ;70 virtual void changedVisibility() override; 71 71 72 72 void setOwner(BaseObject* owner); … … 91 91 92 92 private: 93 std::set< StrongPtr<OrxonoxOverlay>> hudElements_; //!< Contains all the OrxonoxOverlays of the this group.93 std::set<StrongPtr<OrxonoxOverlay>> hudElements_; //!< Contains all the OrxonoxOverlays of the this group. 94 94 Vector2 scale_; //!< Current scale (independent of the elements). 95 95 Vector2 scroll_; //!< Current scrolling offset. -
code/branches/cpp11_v3/src/orxonox/sound/AmbientSound.cc
r10624 r11054 92 92 { 93 93 const std::string& path = "ambient/" + mood + '/' + this->ambientSource_; 94 s hared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path);95 if (fileInfo != NULL)94 std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(path); 95 if (fileInfo != nullptr) 96 96 { 97 97 orxout(user_info) << "Loading ambient sound " << path << "..." << endl; // TODO: make this output internal if we implement sound streaming -
code/branches/cpp11_v3/src/orxonox/sound/AmbientSound.h
r9939 r11054 50 50 AmbientSound(); 51 51 52 v oid play();53 bool stop();54 v oid pause();52 virtual void play() override; 53 virtual bool stop() override; 54 virtual void pause() override; 55 55 56 56 bool setAmbientSource(const std::string& source); … … 66 66 67 67 private: 68 v oid preDestroy();69 float getRealVolume();70 bool moodChanged(const std::string& mood);68 virtual void preDestroy() override; 69 virtual float getRealVolume() override; 70 virtual bool moodChanged(const std::string& mood) override; 71 71 inline void ambientSourceChanged() 72 72 { this->setAmbientSource(this->ambientSource_); } -
code/branches/cpp11_v3/src/orxonox/sound/BaseSound.cc
r10624 r11054 66 66 this->stop(); 67 67 // Release buffer 68 if (this->soundBuffer_ != NULL)68 if (this->soundBuffer_ != nullptr) 69 69 { 70 70 assert(GameMode::playsSound()); … … 84 84 { 85 85 this->state_ = Playing; 86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != NULL)86 if (GameMode::playsSound() && this->getSourceState() != AL_PLAYING && this->soundBuffer_ != nullptr) 87 87 { 88 88 if (!alIsSource(this->audioSource_)) … … 151 151 orxout(internal_warning, context::sound) << "Setting source parameters to 0 failed: " 152 152 << SoundManager::getALErrorString(error) << endl; 153 assert(this->soundBuffer_ != NULL);153 assert(this->soundBuffer_ != nullptr); 154 154 alSourcei(this->audioSource_, AL_BUFFER, this->soundBuffer_->getBuffer()); 155 155 if (ALuint error = alGetError()) … … 209 209 } 210 210 211 if (this->soundBuffer_ != NULL)211 if (this->soundBuffer_ != nullptr) 212 212 { 213 213 if (this->soundBuffer_->getFilename() == source) … … 233 233 // Get new sound buffer 234 234 this->soundBuffer_ = SoundManager::getInstance().getSoundBuffer(this->source_); 235 if (this->soundBuffer_ == NULL)235 if (this->soundBuffer_ == nullptr) 236 236 return; 237 237 -
code/branches/cpp11_v3/src/orxonox/sound/BaseSound.h
r9667 r11054 33 33 34 34 #include <string> 35 #include < boost/shared_ptr.hpp>35 #include <memory> 36 36 #include <OgreDataStream.h> 37 37 #include "core/object/Listable.h" … … 107 107 ALuint audioSource_; 108 108 bool bPooling_; 109 s hared_ptr<SoundBuffer> soundBuffer_;109 std::shared_ptr<SoundBuffer> soundBuffer_; 110 110 std::string source_; 111 111 float volume_; -
code/branches/cpp11_v3/src/orxonox/sound/SoundBuffer.cc
r8858 r11054 39 39 namespace orxonox 40 40 { 41 SoundBuffer::SoundBuffer(const std::string& filename, std::list<s hared_ptr<SoundBuffer>>::iterator poolIterator)41 SoundBuffer::SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator) 42 42 : filename_(filename) 43 43 , audioBuffer_(AL_NONE) … … 45 45 { 46 46 if (this->filename_.empty()) 47 ThrowException(General, "SoundBuffer construction: fileInfo was NULL");47 ThrowException(General, "SoundBuffer construction: fileInfo was nullptr"); 48 48 49 49 // Get resource info 50 s hared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename);51 if (fileInfo == NULL)50 std::shared_ptr<ResourceInfo> fileInfo = Resource::getInfo(filename); 51 if (fileInfo == nullptr) 52 52 { 53 53 orxout(internal_error, context::sound) << "Sound file '" << filename << "' not found" << endl; … … 83 83 } 84 84 85 void SoundBuffer::loadStandard(const s hared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)85 void SoundBuffer::loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream) 86 86 { 87 87 // Read everything into a temporary buffer … … 127 127 } 128 128 129 void SoundBuffer::loadOgg(const s hared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream)129 void SoundBuffer::loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream) 130 130 { 131 131 char inbuffer[256*1024]; … … 138 138 vorbisCallbacks.seek_func = &seekVorbis; 139 139 vorbisCallbacks.tell_func = &tellVorbis; 140 vorbisCallbacks.close_func = NULL;140 vorbisCallbacks.close_func = nullptr; 141 141 142 142 OggVorbis_File vf; 143 int ret = ov_open_callbacks(dataStream.get(), &vf, NULL, 0, vorbisCallbacks);143 int ret = ov_open_callbacks(dataStream.get(), &vf, nullptr, 0, vorbisCallbacks); 144 144 if (ret < 0) 145 145 { -
code/branches/cpp11_v3/src/orxonox/sound/SoundBuffer.h
r10624 r11054 33 33 34 34 #include <list> 35 #include < boost/shared_ptr.hpp>35 #include <memory> 36 36 #include "core/Resource.h" 37 37 … … 45 45 { 46 46 friend class SoundManager; 47 #if !defined(_MSC_VER) || _MSC_VER >= 150048 // Make sure nobody deletes an instance (using strong pointers)49 template <class T>50 friend void boost::checked_delete(T*);51 #endif52 47 53 48 public: 54 #if defined(_MSC_VER) && _MSC_VER < 150055 49 ~SoundBuffer(); 56 #endif57 50 inline ALuint getBuffer() 58 51 { return this->audioBuffer_; } … … 64 57 65 58 private: 66 SoundBuffer(const std::string& filename, std::list<shared_ptr<SoundBuffer> >::iterator poolIterator); 67 #if !defined(_MSC_VER) || _MSC_VER >= 1500 68 ~SoundBuffer(); 69 #endif 70 void loadStandard(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 71 void loadOgg(const shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 59 SoundBuffer(const std::string& filename, std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator); 60 void loadStandard(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 61 void loadOgg(const std::shared_ptr<ResourceInfo>& fileInfo, DataStreamPtr dataStream); 72 62 73 63 std::string filename_; 74 64 ALuint audioBuffer_; 75 std::list<s hared_ptr<SoundBuffer>>::iterator poolIterator_;65 std::list<std::shared_ptr<SoundBuffer>>::iterator poolIterator_; 76 66 }; 77 67 } -
code/branches/cpp11_v3/src/orxonox/sound/SoundManager.cc
r10624 r11054 83 83 ThrowException(InitialisationAborted, "Sound: Not loading at all"); 84 84 #if !defined(ORXONOX_PLATFORM_APPLE) 85 if (!alutInitWithoutContext( NULL, NULL))85 if (!alutInitWithoutContext(nullptr, nullptr)) 86 86 ThrowException(InitialisationFailed, "Sound Error: ALUT initialisation failed: " << alutGetErrorString(alutGetError())); 87 87 Loki::ScopeGuard alutExitGuard = Loki::MakeGuard(&alutExit); … … 90 90 /* 91 91 // Get list of available sound devices and display them 92 const char* devices = alcGetString( NULL, ALC_DEVICE_SPECIFIER);92 const char* devices = alcGetString(nullptr, ALC_DEVICE_SPECIFIER); 93 93 char* device = new char[strlen(devices)+1]; 94 94 strcpy(device, devices); … … 110 110 this->device_ = alcOpenDevice(renderDevice.c_str()); 111 111 */ 112 this->device_ = alcOpenDevice( NULL);113 if (this->device_ == NULL)112 this->device_ = alcOpenDevice(nullptr); 113 if (this->device_ == nullptr) 114 114 ThrowException(InitialisationFailed, "Sound Error: Could not open sound device."); 115 115 Loki::ScopeGuard closeDeviceGuard = Loki::MakeGuard(&alcCloseDevice, this->device_); 116 116 117 117 // Create sound context and make it the currently used one 118 this->context_ = alcCreateContext(this->device_, NULL);119 if (this->context_ == NULL)118 this->context_ = alcCreateContext(this->device_, nullptr); 119 if (this->context_ == nullptr) 120 120 ThrowException(InitialisationFailed, "Sound Error: Could not create ALC context"); 121 121 Loki::ScopeGuard desroyContextGuard = Loki::MakeGuard(&alcDestroyContext, this->context_); … … 189 189 190 190 // Relieve context to destroy it 191 if (!alcMakeContextCurrent( NULL))191 if (!alcMakeContextCurrent(nullptr)) 192 192 orxout(internal_error, context::sound) << "Could not unset ALC context" << endl; 193 193 alcDestroyContext(this->context_); … … 294 294 { 295 295 case SoundType::All: 296 for ( ObjectList<BaseSound>::iterator it = ObjectList<BaseSound>::begin(); it != ObjectList<BaseSound>::end(); ++it)297 (*it)->updateVolume();296 for (BaseSound* sound : ObjectList<BaseSound>()) 297 sound->updateVolume(); 298 298 break; 299 299 case SoundType::Music: 300 for ( ObjectList<AmbientSound>::iterator it = ObjectList<AmbientSound>::begin(); it != ObjectList<AmbientSound>::end(); ++it)301 (*it)->updateVolume();300 for (AmbientSound* sound : ObjectList<AmbientSound>()) 301 sound->updateVolume(); 302 302 break; 303 303 case SoundType::Effects: 304 for ( ObjectList<WorldSound>::iterator it = ObjectList<WorldSound>::begin(); it != ObjectList<WorldSound>::end(); ++it)305 (*it)->updateVolume();304 for (WorldSound* sound : ObjectList<WorldSound>()) 305 sound->updateVolume(); 306 306 break; 307 307 default: … … 350 350 void SoundManager::registerAmbientSound(AmbientSound* newAmbient) 351 351 { 352 if (newAmbient != NULL&& !this->bDestructorCalled_)352 if (newAmbient != nullptr && !this->bDestructorCalled_) 353 353 { 354 354 for (AmbientList::const_iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it) … … 373 373 void SoundManager::unregisterAmbientSound(AmbientSound* oldAmbient) 374 374 { 375 if (oldAmbient == NULL|| ambientSounds_.empty() || this->bDestructorCalled_)375 if (oldAmbient == nullptr || ambientSounds_.empty() || this->bDestructorCalled_) 376 376 return; 377 377 … … 405 405 void SoundManager::pauseAmbientSound(AmbientSound* ambient) 406 406 { 407 if (ambient != NULL)408 { 409 for ( AmbientList::iterator it = this->ambientSounds_.begin(); it != this->ambientSounds_.end(); ++it)410 { 411 if ( it->first == ambient)407 if (ambient != nullptr) 408 { 409 for (std::pair<AmbientSound*, bool>& pair : this->ambientSounds_) 410 { 411 if (pair.first == ambient) 412 412 { 413 it->second = true;414 this->fadeOut( it->first);413 pair.second = true; 414 this->fadeOut(pair.first); 415 415 return; 416 416 } … … 422 422 { 423 423 // If we're already fading out --> remove that 424 for (std::list<StrongPtr<AmbientSound> 424 for (std::list<StrongPtr<AmbientSound>>::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); it++) 425 425 { 426 426 if (*it == sound) … … 438 438 { 439 439 // If we're already fading in --> remove that 440 for (std::list<StrongPtr<AmbientSound> 440 for (std::list<StrongPtr<AmbientSound>>::iterator it = this->fadeInList_.begin(); it != this->fadeInList_.end(); it++) 441 441 { 442 442 if (*it == sound) … … 461 461 462 462 // FADE IN 463 for (std::list<StrongPtr<AmbientSound> 463 for (std::list<StrongPtr<AmbientSound>>::iterator it= this->fadeInList_.begin(); it != this->fadeInList_.end(); ) 464 464 { 465 465 if ((*it)->getVolume() + this->crossFadeStep_*dt > 1.0f) … … 476 476 477 477 // FADE OUT 478 for (std::list<StrongPtr<AmbientSound> 478 for (std::list<StrongPtr<AmbientSound>>::iterator it = this->fadeOutList_.begin(); it != this->fadeOutList_.end(); ) 479 479 { 480 480 if ((*it)->getVolume() - this->crossFadeStep_*dt < 0.0f) … … 505 505 } 506 506 507 s hared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename)508 { 509 s hared_ptr<SoundBuffer> buffer;507 std::shared_ptr<SoundBuffer> SoundManager::getSoundBuffer(const std::string& filename) 508 { 509 std::shared_ptr<SoundBuffer> buffer; 510 510 // Check active or pooled buffers 511 511 SoundBufferMap::const_iterator it = this->soundBuffers_.find(filename); … … 538 538 } 539 539 540 void SoundManager::releaseSoundBuffer(const s hared_ptr<SoundBuffer>& buffer, bool bPoolBuffer)540 void SoundManager::releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer) 541 541 { 542 542 // Check if others are still using the buffer … … 551 551 while (this->effectsPoolSize_ + it->second->getSize() > this->maxEffectsPoolSize_s && !this->effectsPool_.empty()) 552 552 { 553 s hared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back();553 std::shared_ptr<SoundBuffer> bufferDel = this->effectsPool_.back(); 554 554 this->effectsPoolSize_ -= bufferDel->getSize(); 555 555 bufferDel->poolIterator_ = this->effectsPool_.end(); … … 576 576 ALuint source = this->availableSoundSources_.back(); 577 577 this->availableSoundSources_.pop_back(); 578 this->usedSoundSources_. push_back(std::make_pair(source, object));578 this->usedSoundSources_.emplace_back(source, object); 579 579 return source; 580 580 } … … 588 588 if (alIsSource(source) && !alGetError()) 589 589 { 590 this->usedSoundSources_. push_back(std::make_pair(source, object));590 this->usedSoundSources_.emplace_back(source, object); 591 591 return source; 592 592 } … … 606 606 #endif 607 607 this->availableSoundSources_.push_back(source); 608 for (std::vector<std::pair<ALuint, BaseSound*> 608 for (std::vector<std::pair<ALuint, BaseSound*>>::iterator it = this->usedSoundSources_.begin(); 609 609 it != this->usedSoundSources_.end(); ++it) 610 610 { -
code/branches/cpp11_v3/src/orxonox/sound/SoundManager.h
r10624 r11054 36 36 #include <map> 37 37 #include <string> 38 #include < boost/shared_ptr.hpp>38 #include <memory> 39 39 40 40 #include "util/Singleton.h" … … 68 68 ~SoundManager(); 69 69 70 v oid preUpdate(const Clock& time);71 v oid postUpdate(const Clock& time){ /*no action*/ }70 virtual void preUpdate(const Clock& time) override; 71 virtual void postUpdate(const Clock& time) override { /*no action*/ } 72 72 void setConfigValues(); 73 73 … … 96 96 // tolua_end 97 97 98 s hared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename);99 void releaseSoundBuffer(const s hared_ptr<SoundBuffer>& buffer, bool bPoolBuffer);98 std::shared_ptr<SoundBuffer> getSoundBuffer(const std::string& filename); 99 void releaseSoundBuffer(const std::shared_ptr<SoundBuffer>& buffer, bool bPoolBuffer); 100 100 101 101 ALuint getSoundSource(BaseSound* object); … … 125 125 126 126 // Ambient sound related 127 typedef std::list<std::pair<AmbientSound*, bool> 127 typedef std::list<std::pair<AmbientSound*, bool>> AmbientList; 128 128 AmbientList ambientSounds_; 129 129 //! Absolute change per second (0.1 means 10% of the nominal volume) for cross fading 130 130 float crossFadeStep_; 131 std::list<StrongPtr<AmbientSound> 132 std::list<StrongPtr<AmbientSound> 131 std::list<StrongPtr<AmbientSound>> fadeInList_; 132 std::list<StrongPtr<AmbientSound>> fadeOutList_; 133 133 134 134 // Volume related … … 139 139 static const unsigned int maxEffectsPoolSize_s = 40 * 1024 * 1024; 140 140 unsigned int effectsPoolSize_; 141 typedef std::list<s hared_ptr<SoundBuffer>> EffectsPoolList;141 typedef std::list<std::shared_ptr<SoundBuffer>> EffectsPoolList; 142 142 EffectsPoolList effectsPool_; 143 typedef std::map<std::string, s hared_ptr<SoundBuffer>> SoundBufferMap;143 typedef std::map<std::string, std::shared_ptr<SoundBuffer>> SoundBufferMap; 144 144 SoundBufferMap soundBuffers_; 145 145 … … 148 148 unsigned int maxSources_; 149 149 std::vector<ALuint> availableSoundSources_; 150 std::vector<std::pair<ALuint, BaseSound*> 150 std::vector<std::pair<ALuint, BaseSound*>> usedSoundSources_; 151 151 152 152 bool bDestructorCalled_; ///< Becomes true if the destructor is called - used to prevent ambient sounds from registering after the lists were cleared -
code/branches/cpp11_v3/src/orxonox/sound/SoundStreamer.cc
r8858 r11054 45 45 vorbisCallbacks.seek_func = &seekVorbis; 46 46 vorbisCallbacks.tell_func = &tellVorbis; 47 vorbisCallbacks.close_func = NULL;47 vorbisCallbacks.close_func = nullptr; 48 48 49 49 OggVorbis_File vf; 50 int ret = ov_open_callbacks(dataStream.get(), &vf, NULL, 0, vorbisCallbacks);50 int ret = ov_open_callbacks(dataStream.get(), &vf, nullptr, 0, vorbisCallbacks); 51 51 if (ret < 0) 52 52 { … … 68 68 int current_section; 69 69 70 for( int i = 0; i < 4; i++)70 for(ALuint& initbuffer : initbuffers) 71 71 { 72 72 long ret = ov_read(&vf, inbuffer, sizeof(inbuffer), 0, 2, 1, ¤t_section); … … 82 82 } 83 83 84 alBufferData(initbuffer s[i], format, &inbuffer, ret, vorbisInfo->rate);84 alBufferData(initbuffer, format, &inbuffer, ret, vorbisInfo->rate); 85 85 } 86 86 alSourceQueueBuffers(audioSource, 4, initbuffers); -
code/branches/cpp11_v3/src/orxonox/sound/WorldAmbientSound.cc
r10624 r11054 49 49 this->ambientSound_ = new AmbientSound(); 50 50 this->registerVariables(); 51 soundList_. push_back("Earth.ogg");52 soundList_. push_back("Jupiter.ogg");53 soundList_. push_back("Mars.ogg");54 soundList_. push_back("allgorythm-lift_up.ogg");55 soundList_. push_back("allgorythm-resonance_blaster.ogg");56 soundList_. push_back("AlphaCentauri.ogg");57 soundList_. push_back("Asteroid_rocks.ogg");58 soundList_. push_back("Ganymede.ogg");59 soundList_. push_back("luke_grey_-_hypermode.ogg");51 soundList_.emplace_back("Earth.ogg"); 52 soundList_.emplace_back("Jupiter.ogg"); 53 soundList_.emplace_back("Mars.ogg"); 54 soundList_.emplace_back("allgorythm-lift_up.ogg"); 55 soundList_.emplace_back("allgorythm-resonance_blaster.ogg"); 56 soundList_.emplace_back("AlphaCentauri.ogg"); 57 soundList_.emplace_back("Asteroid_rocks.ogg"); 58 soundList_.emplace_back("Ganymede.ogg"); 59 soundList_.emplace_back("luke_grey_-_hypermode.ogg"); 60 60 61 61 } … … 114 114 115 115 //HACK: Assuption - there is only one WorldAmbientSound in a level and only one level is used. 116 for (ObjectList<WorldAmbientSound>::iterator it = ObjectList<WorldAmbientSound>::begin(); 117 it != ObjectList<WorldAmbientSound>::end(); ++it) 116 for (WorldAmbientSound* sound : ObjectList<WorldAmbientSound>()) 118 117 { 119 while( it->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){118 while(sound->ambientSound_->setAmbientSource(WorldAmbientSound::soundList_[WorldAmbientSound::soundNumber_]) == false){ 120 119 WorldAmbientSound::soundNumber_ = (WorldAmbientSound::soundNumber_ + 1) % WorldAmbientSound::soundList_.size(); 121 120 } -
code/branches/cpp11_v3/src/orxonox/sound/WorldAmbientSound.h
r9939 r11054 50 50 virtual ~WorldAmbientSound(); 51 51 52 v oid XMLPort(Element& xmlelement, XMLPort::Mode mode);53 v oid XMLEventPort(Element& xmlelement, XMLPort::Mode mode);52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 54 54 55 virtual void changedActivity() ;55 virtual void changedActivity() override; 56 56 57 57 void play(); -
code/branches/cpp11_v3/src/orxonox/sound/WorldSound.h
r9667 r11054 47 47 WorldSound(Context* context); 48 48 49 v oid XMLPort(Element& xmlelement, XMLPort::Mode mode);50 v oid XMLEventPort(Element& xmlelement, XMLPort::Mode mode);51 v oid changedActivity();49 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 50 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 51 virtual void changedActivity() override; 52 52 53 v oid tick(float dt);53 virtual void tick(float dt) override; 54 54 55 55 protected: … … 58 58 private: 59 59 void registerVariables(); 60 v oid initialiseSource();61 float getRealVolume();60 virtual void initialiseSource() override; 61 virtual float getRealVolume() override; 62 62 }; 63 63 } -
code/branches/cpp11_v3/src/orxonox/weaponsystem/DefaultWeaponmodeLink.h
r9667 r11054 42 42 virtual ~DefaultWeaponmodeLink(); 43 43 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 45 45 46 46 inline void setFiremode(const unsigned int firemode) -
code/branches/cpp11_v3/src/orxonox/weaponsystem/Munition.cc
r11052 r11054 57 57 Munition::~Munition() 58 58 { 59 for ( std::map<WeaponMode*, Magazine*>::iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)60 delete it->second;59 for (const auto& mapEntry : this->assignedMagazines_) 60 delete mapEntry.second; 61 61 } 62 62 … … 76 76 // For separated magazines we definitively need a given user 77 77 if (!user) 78 return 0;78 return nullptr; 79 79 80 80 // Use the map to get the magazine assigned to the given user … … 90 90 } 91 91 92 return 0;92 return nullptr; 93 93 } 94 94 … … 262 262 if (deployment_ != MunitionDeployment::Separate) 263 263 { 264 user = NULL;264 user = nullptr; 265 265 } 266 266 … … 299 299 { 300 300 // Return true if any of the current magazines is not full (loading counts as full although it returns 0 munition) 301 for ( std::map<WeaponMode*, Magazine*>::const_iterator it = this->assignedMagazines_.begin(); it != this->assignedMagazines_.end(); ++it)302 if ( it->second->munition_ < this->maxMunitionPerMagazine_ && it->second->bLoaded_)301 for (const auto& mapEntry : this->assignedMagazines_) 302 if (mapEntry.second->munition_ < this->maxMunitionPerMagazine_ && mapEntry.second->bLoaded_) 303 303 return true; 304 304 } … … 515 515 // If we don't use separate magazines, set user to 0 516 516 if (deployment_ != MunitionDeployment::Separate) 517 user = NULL;517 user = nullptr; 518 518 519 519 // Remove the current magazine for the given user -
code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.cc
r11052 r11054 45 45 RegisterObject(Weapon); 46 46 47 this->weaponPack_ = 0;48 this->weaponSlot_ = 0;47 this->weaponPack_ = nullptr; 48 this->weaponSlot_ = nullptr; 49 49 this->bReloading_ = false; 50 50 this->reloadingWeaponmode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED; … … 61 61 this->weaponPack_->removeWeapon(this); 62 62 63 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)64 it->second->destroy();63 for (const auto& mapEntry : this->weaponmodes_) 64 mapEntry.second->destroy(); 65 65 } 66 66 } … … 85 85 { 86 86 unsigned int i = 0; 87 for ( std::multimap<unsigned int, WeaponMode*>::const_iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)87 for (const auto& mapEntry : this->weaponmodes_) 88 88 { 89 89 if (i == index) 90 return it->second;90 return mapEntry.second; 91 91 92 92 ++i; 93 93 } 94 return 0;94 return nullptr; 95 95 } 96 96 … … 140 140 void Weapon::reload() 141 141 { 142 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)143 it->second->reload();142 for (const auto& mapEntry : this->weaponmodes_) 143 mapEntry.second->reload(); 144 144 } 145 145 … … 152 152 void Weapon::notifyWeaponModes() 153 153 { 154 for ( std::multimap<unsigned int, WeaponMode*>::iterator it = this->weaponmodes_.begin(); it != this->weaponmodes_.end(); ++it)155 it->second->setWeapon(this);154 for (const auto& mapEntry : this->weaponmodes_) 155 mapEntry.second->setWeapon(this); 156 156 } 157 157 -
code/branches/cpp11_v3/src/orxonox/weaponsystem/Weapon.h
r11052 r11054 50 50 virtual ~Weapon(); 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 53 53 54 54 void fire(unsigned int mode); -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponMode.cc
r11052 r11054 51 51 RegisterObject(WeaponMode); 52 52 53 this->weapon_ = 0;53 this->weapon_ = nullptr; 54 54 this->mode_ = WeaponSystem::WEAPON_MODE_UNASSIGNED; 55 55 56 this->munition_ = 0;56 this->munition_ = nullptr; 57 57 this->initialMunition_ = 0; 58 58 this->initialMagazines_ = 0; … … 244 244 else 245 245 { 246 this->munition_ = NULL;246 this->munition_ = nullptr; 247 247 } 248 248 } -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponMode.h
r11052 r11054 52 52 virtual ~WeaponMode(); 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 bool fire(float* reloadTime); -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.cc
r11052 r11054 44 44 RegisterObject(WeaponPack); 45 45 46 this->weaponSystem_ = 0;46 this->weaponSystem_ = nullptr; 47 47 } 48 48 … … 76 76 void WeaponPack::fire(unsigned int weaponmode) 77 77 { 78 for ( std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)79 (*it)->fire(weaponmode);78 for (Weapon* weapon : this->weapons_) 79 weapon->fire(weaponmode); 80 80 } 81 81 … … 86 86 void WeaponPack::reload() 87 87 { 88 for ( std::vector<Weapon *>::iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)89 (*it)->reload();88 for (Weapon* weapon : this->weapons_) 89 weapon->reload(); 90 90 } 91 91 … … 107 107 assert(it != this->weapons_.end()); 108 108 this->weapons_.erase(it); 109 weapon->setWeaponPack( 0);109 weapon->setWeaponPack(nullptr); 110 110 } 111 111 … … 114 114 unsigned int i = 0; 115 115 116 for ( std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)116 for (Weapon* weapon : this->weapons_) 117 117 { 118 118 if (i == index) 119 return (*it);119 return weapon; 120 120 ++i; 121 121 } 122 122 123 return 0;123 return nullptr; 124 124 } 125 125 … … 137 137 { 138 138 unsigned int i = 0; 139 for ( std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)139 for (DefaultWeaponmodeLink* link : this->links_) 140 140 { 141 141 if (i == index) 142 return (*it);142 return link; 143 143 144 144 ++i; 145 145 } 146 return 0;146 return nullptr; 147 147 } 148 148 149 149 unsigned int WeaponPack::getDesiredWeaponmode(unsigned int firemode) const 150 150 { 151 for ( std::set<DefaultWeaponmodeLink*>::const_iterator it = this->links_.begin(); it != this->links_.end(); ++it)152 if ( (*it)->getFiremode() == firemode)153 return (*it)->getWeaponmode();151 for (DefaultWeaponmodeLink* link : this->links_) 152 if (link->getFiremode() == firemode) 153 return link->getWeaponmode(); 154 154 155 155 return WeaponSystem::WEAPON_MODE_UNASSIGNED; … … 158 158 void WeaponPack::notifyWeapons() 159 159 { 160 for ( std::vector<Weapon *>::const_iterator it = this->weapons_.begin(); it != this->weapons_.end(); ++it)161 (*it)->setWeaponPack(this);160 for (Weapon* weapon : this->weapons_) 161 weapon->setWeaponPack(this); 162 162 } 163 163 -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponPack.h
r11052 r11054 44 44 virtual ~WeaponPack(); 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 fire(unsigned int weaponmode); -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSet.cc
r10650 r11054 43 43 RegisterObject(WeaponSet); 44 44 45 this->weaponSystem_ = 0;45 this->weaponSystem_ = nullptr; 46 46 this->desiredFiremode_ = WeaponSystem::FIRE_MODE_UNASSIGNED; 47 47 } … … 63 63 { 64 64 // Fire all WeaponPacks with their defined weaponmode 65 for ( std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)66 if ( it->second != WeaponSystem::WEAPON_MODE_UNASSIGNED)67 it->first->fire(it->second);65 for (const auto& mapEntry : this->weaponpacks_) 66 if (mapEntry.second != WeaponSystem::WEAPON_MODE_UNASSIGNED) 67 mapEntry.first->fire(mapEntry.second); 68 68 } 69 69 … … 71 71 { 72 72 // Reload all WeaponPacks with their defined weaponmode 73 for ( std::map<WeaponPack*, unsigned int>::iterator it = this->weaponpacks_.begin(); it != this->weaponpacks_.end(); ++it)74 it->first->reload();73 for (const auto& mapEntry : this->weaponpacks_) 74 mapEntry.first->reload(); 75 75 } 76 76 -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSet.h
r9667 r11054 44 44 virtual ~WeaponSet(); 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 fire(); -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSlot.cc
r10648 r11054 43 43 RegisterObject(WeaponSlot); 44 44 45 this->weaponSystem_ = 0;46 this->weapon_ = 0;45 this->weaponSystem_ = nullptr; 46 this->weapon_ = nullptr; 47 47 48 48 this->setSyncMode(ObjectDirection::None); … … 88 88 if (this->weapon_) 89 89 { 90 this->weapon_->setWeaponSlot( 0);91 this->weapon_ = 0;90 this->weapon_->setWeaponSlot(nullptr); 91 this->weapon_ = nullptr; 92 92 } 93 93 } -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSlot.h
r10650 r11054 62 62 virtual ~WeaponSlot(); 63 63 64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;64 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 65 65 66 66 void attachWeapon(Weapon * weapon); … … 74 74 */ 75 75 inline bool isOccupied() const 76 { return (this->weapon_ != 0); }76 { return (this->weapon_ != nullptr); } 77 77 78 78 inline void setWeaponSystem(WeaponSystem * weaponSystem) -
code/branches/cpp11_v3/src/orxonox/weaponsystem/WeaponSystem.cc
r11052 r11054 52 52 RegisterObject(WeaponSystem); 53 53 54 this->pawn_ = 0;54 this->pawn_ = nullptr; 55 55 } 56 56 … … 60 60 { 61 61 if (this->pawn_) 62 this->pawn_->setWeaponSystem( 0);62 this->pawn_->setWeaponSystem(nullptr); 63 63 64 64 while (!this->weaponSets_.empty()) … … 106 106 { 107 107 unsigned int i = 0; 108 for ( std::vector<WeaponSlot*>::const_iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)108 for (WeaponSlot* weaponSlot : this->weaponSlots_) 109 109 { 110 110 ++i; 111 111 if (i > index) 112 return (*it);113 } 114 return 0;112 return weaponSlot; 113 } 114 return nullptr; 115 115 } 116 116 … … 153 153 { 154 154 unsigned int i = 0; 155 for ( std::map<unsigned int, WeaponSet*>::const_iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)155 for (const auto& mapEntry : this->weaponSets_) 156 156 { 157 157 ++i; 158 158 if (i > index) 159 return it->second;160 } 161 return 0;159 return mapEntry.second; 160 } 161 return nullptr; 162 162 } 163 163 … … 168 168 169 169 unsigned int freeSlots = 0; 170 for ( std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)171 { 172 if (! (*it)->isOccupied())170 for (WeaponSlot* weaponSlot : this->weaponSlots_) 171 { 172 if (!weaponSlot->isOccupied()) 173 173 ++freeSlots; 174 174 } … … 184 184 // Attach all weapons to the first free slots (and to the Pawn) 185 185 unsigned int i = 0; 186 for ( std::vector<WeaponSlot*>::iterator it = this->weaponSlots_.begin(); it != this->weaponSlots_.end(); ++it)187 { 188 if (! (*it)->isOccupied() && i < wPack->getNumWeapons())186 for (WeaponSlot* weaponSlot : this->weaponSlots_) 187 { 188 if (!weaponSlot->isOccupied() && i < wPack->getNumWeapons()) 189 189 { 190 190 Weapon* weapon = wPack->getWeapon(i); 191 (*it)->attachWeapon(weapon);191 weaponSlot->attachWeapon(weapon); 192 192 this->getPawn()->attach(weapon); 193 193 ++i; … … 196 196 197 197 // Assign the desired weaponmode to the firemodes 198 for ( std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)199 { 200 unsigned int weaponmode = wPack->getDesiredWeaponmode( it->first);198 for (const auto& mapEntry : this->weaponSets_) 199 { 200 unsigned int weaponmode = wPack->getDesiredWeaponmode(mapEntry.first); 201 201 if (weaponmode != WeaponSystem::WEAPON_MODE_UNASSIGNED) 202 it->second->setWeaponmodeLink(wPack, weaponmode);202 mapEntry.second->setWeaponmodeLink(wPack, weaponmode); 203 203 } 204 204 … … 213 213 // Remove all weapons from their WeaponSlot 214 214 unsigned int i = 0; 215 Weapon* weapon = 0;215 Weapon* weapon = nullptr; 216 216 while ((weapon = wPack->getWeapon(i++))) 217 217 if (weapon->getWeaponSlot()) … … 219 219 220 220 // Remove all added links from the WeaponSets 221 for ( std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)222 it->second->removeWeaponmodeLink(wPack);221 for (const auto& mapEntry : this->weaponSets_) 222 mapEntry.second->removeWeaponmodeLink(wPack); 223 223 224 224 // Remove the WeaponPack from the WeaponSystem … … 231 231 { 232 232 unsigned int i = 0; 233 for ( std::vector<WeaponPack*>::const_iterator it = this->weaponPacks_.begin(); it != this->weaponPacks_.end(); ++it)233 for (WeaponPack* weaponPack : this->weaponPacks_) 234 234 { 235 235 ++i; 236 236 if (i > index) 237 return (*it);238 } 239 return 0;237 return weaponPack; 238 } 239 return nullptr; 240 240 } 241 241 … … 273 273 // Check if the WeaponSet belongs to this WeaponSystem 274 274 bool foundWeaponSet = false; 275 for ( std::map<unsigned int, WeaponSet *>::iterator it2 = this->weaponSets_.begin(); it2 != this->weaponSets_.end(); ++it2)276 { 277 if ( it2->second == wSet)275 for (const auto& mapEntry : this->weaponSets_) 276 { 277 if (mapEntry.second == wSet) 278 278 { 279 279 foundWeaponSet = true; … … 301 301 void WeaponSystem::reload() 302 302 { 303 for ( std::map<unsigned int, WeaponSet *>::iterator it = this->weaponSets_.begin(); it != this->weaponSets_.end(); ++it)304 it->second->reload();303 for (const auto& mapEntry : this->weaponSets_) 304 mapEntry.second->reload(); 305 305 } 306 306 … … 308 308 { 309 309 if (!identifier || !identifier->getIdentifier()) 310 return 0;310 return nullptr; 311 311 312 312 std::map<Identifier *, Munition *>::iterator it = this->munitions_.find(identifier->getIdentifier()); … … 337 337 else 338 338 { 339 orxout(internal_warning) << "Adding munition failed. identifier == NULL" << endl;339 orxout(internal_warning) << "Adding munition failed. identifier == nullptr " << endl; 340 340 } 341 341 } -
code/branches/cpp11_v3/src/orxonox/worldentities/CameraPosition.h
r9667 r11054 41 41 virtual ~CameraPosition(); 42 42 43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;43 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 44 44 45 45 inline void setDrag(bool bDrag) -
code/branches/cpp11_v3/src/orxonox/worldentities/ControllableEntity.cc
r10624 r11054 61 61 this->server_overwrite_ = 0; 62 62 this->client_overwrite_ = 0; 63 this->player_ = 0;64 this->formerPlayer_ = NULL;63 this->player_ = nullptr; 64 this->formerPlayer_ = nullptr; 65 65 this->playerID_ = OBJECTID_UNKNOWN; 66 this->hud_ = 0;67 this->camera_ = 0;68 this->xmlcontroller_ = 0;69 //this->controller_ = 0;70 this->reverseCamera_ = 0;66 this->hud_ = nullptr; 67 this->camera_ = nullptr; 68 this->xmlcontroller_ = nullptr; 69 //this->controller_ = nullptr; 70 this->reverseCamera_ = nullptr; 71 71 this->bDestroyWhenPlayerLeft_ = false; 72 72 this->cameraPositionRootNode_ = this->node_->createChildSceneNode(); 73 this->currentCameraPosition_ = 0;73 this->currentCameraPosition_ = nullptr; 74 74 this->bMouseLook_ = false; 75 75 this->mouseLookSpeed_ = 200; … … 108 108 this->camera_->destroy(); 109 109 110 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)111 (*it)->destroy();110 for (CameraPosition* cameraPosition : this->cameraPositions_) 111 cameraPosition->destroy(); 112 112 113 113 if (this->getScene()->getSceneManager()) … … 165 165 { 166 166 unsigned int i = 0; 167 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)167 for (CameraPosition* cameraPosition : this->cameraPositions_) 168 168 { 169 169 if (i == index) 170 return (*it);170 return cameraPosition; 171 171 ++i; 172 172 } 173 return 0;173 return nullptr; 174 174 } 175 175 … … 180 180 181 181 unsigned int counter = 0; 182 for ( std::list<StrongPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)183 { 184 if ( (*it)== this->currentCameraPosition_)182 for (CameraPosition* cameraPosition : this->cameraPositions_) 183 { 184 if (cameraPosition == this->currentCameraPosition_) 185 185 break; 186 186 counter++; … … 194 194 bool ControllableEntity::setCameraPosition(unsigned int index) 195 195 { 196 if(this->camera_ != NULL&& this->cameraPositions_.size() > 0)196 if(this->camera_ != nullptr && this->cameraPositions_.size() > 0) 197 197 { 198 198 if(index >= this->cameraPositions_.size()) … … 219 219 else if (this->cameraPositions_.size() > 0) 220 220 { 221 for (std::list<StrongPtr<CameraPosition> 221 for (std::list<StrongPtr<CameraPosition>>::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it) 222 222 { 223 223 if ((*it) == this->camera_->getParent()) … … 241 241 { 242 242 this->camera_->attachToNode(this->cameraPositionRootNode_); 243 this->currentCameraPosition_ = 0;243 this->currentCameraPosition_ = nullptr; 244 244 } 245 245 … … 321 321 if ( !GameMode::isMaster() ) 322 322 { 323 if ( target != 0)323 if ( target != nullptr ) 324 324 { 325 325 callMemberNetworkFunction(&ControllableEntity::setTargetInternal, this->getObjectID(), 0, target->getObjectID() ); … … 350 350 this->bHasLocalController_ = player->isLocalPlayer(); 351 351 this->bHasHumanController_ = player->isHumanPlayer(); 352 if(controller_ != NULL)352 if(controller_ != nullptr) 353 353 this->team_ = controller_->getTeam(); // forward controller team number 354 354 … … 372 372 this->stopLocalHumanControl(); 373 373 374 this->player_ = 0;374 this->player_ = nullptr; 375 375 this->playerID_ = OBJECTID_UNKNOWN; 376 376 this->bHasLocalController_ = false; … … 411 411 { 412 412 this->camera_->attachToNode(this->cameraPositionRootNode_); 413 this->currentCameraPosition_ = 0;413 this->currentCameraPosition_ = nullptr; 414 414 } 415 415 } … … 434 434 void ControllableEntity::destroyHud(void) 435 435 { 436 if (this->hud_ != NULL)436 if (this->hud_ != nullptr) 437 437 { 438 438 this->hud_->destroy(); 439 this->hud_ = NULL;439 this->hud_ = nullptr; 440 440 } 441 441 } … … 447 447 this->camera_->detachFromParent(); 448 448 this->camera_->destroy(); 449 this->camera_ = 0;449 this->camera_ = nullptr; 450 450 } 451 451 … … 453 453 { 454 454 this->hud_->destroy(); 455 this->hud_ = 0;455 this->hud_ = nullptr; 456 456 } 457 457 } … … 477 477 if (parent) 478 478 { 479 for ( std::list<StrongPtr<CameraPosition> >::iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it)480 if ( (*it)->getIsAbsolute())481 parent->attach( (*it));479 for (CameraPosition* cameraPosition : this->cameraPositions_) 480 if (cameraPosition->getIsAbsolute()) 481 parent->attach(cameraPosition); 482 482 } 483 483 } -
code/branches/cpp11_v3/src/orxonox/worldentities/ControllableEntity.h
r10624 r11054 54 54 virtual ~ControllableEntity(); 55 55 56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;57 virtual void tick(float dt) ;56 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 57 virtual void tick(float dt) override; 58 58 void setConfigValues(); 59 59 … … 121 121 void addCameraPosition(CameraPosition* position); 122 122 CameraPosition* getCameraPosition(unsigned int index) const; 123 inline const std::list<StrongPtr<CameraPosition> 123 inline const std::list<StrongPtr<CameraPosition>>& getCameraPositions() const 124 124 { return this->cameraPositions_; } 125 125 unsigned int getCurrentCameraIndex() const; … … 141 141 using MobileEntity::setAngularVelocity; 142 142 143 v oid setPosition(const Vector3& position);144 v oid setOrientation(const Quaternion& orientation);145 v oid setVelocity(const Vector3& velocity);146 v oid setAngularVelocity(const Vector3& velocity);143 virtual void setPosition(const Vector3& position) override; 144 virtual void setOrientation(const Quaternion& orientation) override; 145 virtual void setVelocity(const Vector3& velocity) override; 146 virtual void setAngularVelocity(const Vector3& velocity) override; 147 147 148 148 inline bool hasLocalController() const … … 177 177 178 178 protected: 179 virtual void preDestroy() ;179 virtual void preDestroy() override; 180 180 181 181 virtual void setPlayer(PlayerInfo* player); // don't call this directly, use friend class PlayerInfo instead … … 184 184 virtual void startLocalHumanControl(); 185 185 virtual void stopLocalHumanControl(); 186 virtual void parentChanged() ;186 virtual void parentChanged() override; 187 187 188 188 inline void setHudTemplate(const std::string& name) … … 214 214 215 215 // Bullet btMotionState related 216 v oid setWorldTransform(const btTransform& worldTrans);216 virtual void setWorldTransform(const btTransform& worldTrans) override; 217 217 218 218 unsigned int server_overwrite_; … … 242 242 bool bMouseLook_; 243 243 float mouseLookSpeed_; 244 std::list<StrongPtr<CameraPosition> 244 std::list<StrongPtr<CameraPosition>> cameraPositions_; 245 245 CameraPosition* currentCameraPosition_; 246 246 std::string cameraPositionTemplate_; -
code/branches/cpp11_v3/src/orxonox/worldentities/Drone.cc
r9667 r11054 30 30 31 31 #include "core/XMLPort.h" 32 #include "core/CoreIncludes.h" 32 33 #include "BulletDynamics/Dynamics/btRigidBody.h" 33 34 … … 43 44 RegisterObject(Drone); 44 45 45 this->myController_ = 0;46 this->myController_ = nullptr; 46 47 47 48 this->localLinearAcceleration_.setValue(0, 0, 0); -
code/branches/cpp11_v3/src/orxonox/worldentities/Drone.h
r9667 r11054 50 50 virtual ~Drone(); 51 51 52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ; //!< Method for creating a Drone through XML.53 virtual void tick(float dt) ; //!< Defines which actions the Drone has to take in each tick.52 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; //!< Method for creating a Drone through XML. 53 virtual void tick(float dt) override; //!< Defines which actions the Drone has to take in each tick. 54 54 55 55 56 virtual void moveFrontBack(const Vector2& value) ;57 virtual void moveRightLeft(const Vector2& value) ;58 virtual void moveUpDown(const Vector2& value) ;56 virtual void moveFrontBack(const Vector2& value) override; 57 virtual void moveRightLeft(const Vector2& value) override; 58 virtual void moveUpDown(const Vector2& value) override; 59 59 60 virtual void rotateYaw(const Vector2& value) ;61 virtual void rotatePitch(const Vector2& value) ;62 virtual void rotateRoll(const Vector2& value) ;60 virtual void rotateYaw(const Vector2& value) override; 61 virtual void rotatePitch(const Vector2& value) override; 62 virtual void rotateRoll(const Vector2& value) override; 63 63 64 64 /** -
code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.cc
r9667 r11054 44 44 EffectContainer::EffectContainer(Context* context) 45 45 : BaseObject(context) 46 , lua_( NULL)46 , lua_(nullptr) 47 47 { 48 48 RegisterObject(EffectContainer); … … 89 89 { 90 90 unsigned int i = 0; 91 for ( std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)91 for (WorldEntity* effect : this->effects_) 92 92 if (i == index) 93 return (*it);94 return NULL;93 return effect; 94 return nullptr; 95 95 } 96 96 … … 103 103 bool result = (bool)lua_toboolean(this->lua_->getInternalLuaState(), -1); 104 104 lua_pop(this->lua_->getInternalLuaState(), 1); 105 for ( std::vector<WorldEntity*>::const_iterator it = this->effects_.begin(); it != this->effects_.end(); ++it)105 for (WorldEntity* effect : this->effects_) 106 106 { 107 (*it)->setMainState(result);107 effect->setMainState(result); 108 108 } 109 109 } -
code/branches/cpp11_v3/src/orxonox/worldentities/EffectContainer.h
r9667 r11054 43 43 virtual ~EffectContainer(); 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 47 47 void setLuaState(LuaState* state, const std::string& functionName); -
code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionChunk.cc
r9667 r11054 62 62 { 63 63 orxout(internal_error) << "Couldn't load particle effect in ExplosionChunk: " << ex.what() << endl; 64 this->fire_ = 0;65 this->smoke_ = 0;64 this->fire_ = nullptr; 65 this->smoke_ = nullptr; 66 66 } 67 67 } 68 68 else 69 69 { 70 this->fire_ = 0;71 this->smoke_ = 0;70 this->fire_ = nullptr; 71 this->smoke_ = nullptr; 72 72 } 73 73 -
code/branches/cpp11_v3/src/orxonox/worldentities/ExplosionChunk.h
r9667 r11054 43 43 virtual ~ExplosionChunk(); 44 44 45 virtual void tick(float dt) ;45 virtual void tick(float dt) override; 46 46 47 47 inline void setLOD(LODParticle::Value level) -
code/branches/cpp11_v3/src/orxonox/worldentities/MobileEntity.h
r11052 r11054 57 57 virtual ~MobileEntity(); 58 58 59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;60 virtual void tick(float dt) ;59 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 60 virtual void tick(float dt) override; 61 61 62 virtual void setPosition(const Vector3& position) ;63 virtual void setOrientation(const Quaternion& orientation) ;62 virtual void setPosition(const Vector3& position) override; 63 virtual void setOrientation(const Quaternion& orientation) override; 64 64 65 65 virtual void setVelocity(const Vector3& velocity); 66 66 inline void setVelocity(float x, float y, float z) 67 67 { this->setVelocity(Vector3(x, y, z)); } 68 inline const Vector3& getVelocity() const68 virtual inline const Vector3& getVelocity() const override 69 69 { return this->linearVelocity_; } 70 70 /** … … 110 110 protected: 111 111 // Bullet btMotionState related 112 virtual void setWorldTransform(const btTransform& worldTrans) ;113 v oid getWorldTransform(btTransform& worldTrans) const;112 virtual void setWorldTransform(const btTransform& worldTrans) override; 113 virtual void getWorldTransform(btTransform& worldTrans) const override; 114 114 115 115 Vector3 linearAcceleration_; … … 119 119 120 120 private: 121 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const ;121 virtual bool isCollisionTypeLegal(WorldEntity::CollisionType type) const override; 122 122 }; 123 123 } -
code/branches/cpp11_v3/src/orxonox/worldentities/MovableEntity.cc
r11018 r11054 50 50 this->overwrite_orientation_ = Quaternion::IDENTITY; 51 51 52 this->continuousResynchroTimer_ = 0;52 this->continuousResynchroTimer_ = nullptr; 53 53 54 54 this->setPriority(Priority::Low); … … 80 80 { 81 81 float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length(); 82 victim->hit( 0, contactPoint, ownCollisionShape, damage);82 victim->hit(nullptr, contactPoint, ownCollisionShape, damage); 83 83 } 84 84 } -
code/branches/cpp11_v3/src/orxonox/worldentities/MovableEntity.h
r10216 r11054 46 46 virtual ~MovableEntity(); 47 47 48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) ;48 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 49 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* cs, btManifoldPoint& contactPoint) override; 50 50 51 51 using WorldEntity::setPosition; 52 52 using WorldEntity::setOrientation; 53 53 54 inline void setPosition(const Vector3& position)54 virtual inline void setPosition(const Vector3& position) override 55 55 { MobileEntity::setPosition(position); this->overwrite_position_ = this->getPosition(); } 56 inline void setOrientation(const Quaternion& orientation)56 virtual inline void setOrientation(const Quaternion& orientation) override 57 57 { MobileEntity::setOrientation(orientation); this->overwrite_orientation_ = this->getOrientation(); } 58 58 … … 79 79 private: 80 80 void registerVariables(); 81 v oid clientConnected(unsigned int clientID);82 v oid clientDisconnected(unsigned int clientID);81 virtual void clientConnected(unsigned int clientID) override; 82 virtual void clientDisconnected(unsigned int clientID) override; 83 83 void resynchronize(); 84 84 -
code/branches/cpp11_v3/src/orxonox/worldentities/SpawnPoint.cc
r9667 r11054 43 43 RegisterObject(SpawnPoint); 44 44 45 this->template_ = 0;45 this->template_ = nullptr; 46 46 47 47 if (this->getGametype()) -
code/branches/cpp11_v3/src/orxonox/worldentities/SpawnPoint.h
r11052 r11054 44 44 virtual ~SpawnPoint() {} 45 45 46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;46 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 47 47 48 48 inline void setSpawnClass(Identifier* identifier) -
code/branches/cpp11_v3/src/orxonox/worldentities/StaticEntity.h
r11052 r11054 57 57 using WorldEntity::setOrientation; 58 58 59 v oid setPosition(const Vector3& position);60 v oid setOrientation(const Quaternion& orientation);59 virtual void setPosition(const Vector3& position) override; 60 virtual void setOrientation(const Quaternion& orientation) override; 61 61 62 62 private: 63 63 void registerVariables(); 64 bool isCollisionTypeLegal(CollisionType type) const;64 virtual bool isCollisionTypeLegal(CollisionType type) const override; 65 65 66 66 // network callbacks … … 71 71 72 72 // Bullet btMotionState related 73 v oid setWorldTransform(const btTransform& worldTrans);74 v oid getWorldTransform(btTransform& worldTrans) const;73 virtual void setWorldTransform(const btTransform& worldTrans) override; 74 virtual void getWorldTransform(btTransform& worldTrans) const override; 75 75 }; 76 76 } -
code/branches/cpp11_v3/src/orxonox/worldentities/TeamSpawnPoint.h
r11052 r11054 43 43 virtual ~TeamSpawnPoint() {} 44 44 45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;45 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 46 46 47 47 void setTeamNumber(unsigned int team) -
code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.cc
r10624 r11054 37 37 #include <OgreSceneNode.h> 38 38 #include <BulletDynamics/Dynamics/btRigidBody.h> 39 #include <boost/static_assert.hpp>40 39 41 40 #include "util/OrxAssert.h" … … 57 56 58 57 // Be sure we don't do bad conversions 59 BOOST_STATIC_ASSERT((int)Ogre::Node::TS_LOCAL == (int)WorldEntity::Local);60 BOOST_STATIC_ASSERT((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent);61 BOOST_STATIC_ASSERT((int)Ogre::Node::TS_WORLD == (int)WorldEntity::World);58 static_assert((int)Ogre::Node::TS_LOCAL == (int)WorldEntity::Local, "check enum"); 59 static_assert((int)Ogre::Node::TS_PARENT == (int)WorldEntity::Parent, "check enum"); 60 static_assert((int)Ogre::Node::TS_WORLD == (int)WorldEntity::World, "check enum"); 62 61 63 62 RegisterAbstractClass(WorldEntity).inheritsFrom<BaseObject>().inheritsFrom<Synchronisable>(); … … 77 76 this->node_ = this->getScene()->getRootSceneNode()->createChildSceneNode(); 78 77 79 this->parent_ = 0;78 this->parent_ = nullptr; 80 79 this->parentID_ = OBJECTID_UNKNOWN; 81 80 this->bDeleteWithParent_ = true; … … 90 89 91 90 // Default behaviour does not include physics 92 this->physicalBody_ = 0;91 this->physicalBody_ = nullptr; 93 92 this->bPhysicsActive_ = false; 94 93 this->bPhysicsActiveSynchronised_ = false; … … 234 233 235 234 // iterate over all children and change their activity as well 236 for ( std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)235 for (WorldEntity* object : this->getAttachedObjects()) 237 236 { 238 237 if(!this->isActive()) 239 238 { 240 (*it)->bActiveMem_ = (*it)->isActive();241 (*it)->setActive(this->isActive());239 object->bActiveMem_ = object->isActive(); 240 object->setActive(this->isActive()); 242 241 } 243 242 else 244 243 { 245 (*it)->setActive((*it)->bActiveMem_);244 object->setActive(object->bActiveMem_); 246 245 } 247 246 } … … 260 259 { 261 260 // iterate over all children and change their visibility as well 262 for ( std::set<WorldEntity*>::const_iterator it = this->getAttachedObjects().begin(); it != this->getAttachedObjects().end(); it++)261 for (WorldEntity* object : this->getAttachedObjects()) 263 262 { 264 263 if(!this->isVisible()) 265 264 { 266 (*it)->bVisibleMem_ = (*it)->isVisible();267 (*it)->setVisible(this->isVisible());265 object->bVisibleMem_ = object->isVisible(); 266 object->setVisible(this->isVisible()); 268 267 } 269 268 else 270 269 { 271 (*it)->setVisible((*it)->bVisibleMem_);270 object->setVisible(object->bVisibleMem_); 272 271 } 273 272 } … … 498 497 void WorldEntity::notifyDetached() 499 498 { 500 this->parent_ = 0;499 this->parent_ = nullptr; 501 500 this->parentID_ = OBJECTID_UNKNOWN; 502 501 … … 519 518 { 520 519 unsigned int i = 0; 521 for ( std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)520 for (WorldEntity* child : this->children_) 522 521 { 523 522 if (i == index) 524 return (*it);523 return child; 525 524 ++i; 526 525 } 527 return 0;526 return nullptr; 528 527 } 529 528 … … 563 562 void WorldEntity::detachOgreObject(Ogre::MovableObject* object) 564 563 { 565 object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>( NULL)));564 object->setUserAny(Ogre::Any(static_cast<OrxonoxClass*>(nullptr))); 566 565 this->node_->detachObject(object); 567 566 } … … 660 659 { 661 660 // If physics is enabled scale the attached CollisionShape. 662 /*if (this->hasPhysics() && this->collisionShape_ != NULL)661 /*if (this->hasPhysics() && this->collisionShape_ != nullptr) 663 662 { 664 663 this->collisionShape_->setScale3D(scale); … … 856 855 deactivatePhysics(); 857 856 delete this->physicalBody_; 858 this->physicalBody_ = 0;857 this->physicalBody_ = nullptr; 859 858 this->collisionType_ = None; 860 859 this->collisionTypeSynchronised_ = None; … … 939 938 // Recalculate mass 940 939 this->childrenMass_ = 0.0f; 941 for ( std::set<WorldEntity*>::const_iterator it = this->children_.begin(); it != this->children_.end(); ++it)942 this->childrenMass_ += (*it)->getMass();940 for (WorldEntity* child : this->children_) 941 this->childrenMass_ += child->getMass(); 943 942 recalculateMassProps(); 944 943 // Notify parent WE -
code/branches/cpp11_v3/src/orxonox/worldentities/WorldEntity.h
r10726 r11054 96 96 virtual ~WorldEntity(); 97 97 98 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;98 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 99 99 100 100 inline const Ogre::SceneNode* getNode() const … … 108 108 static const Vector3 UP; 109 109 110 virtual void changedActivity(void) ;111 virtual void changedVisibility(void) ;110 virtual void changedActivity(void) override; 111 virtual void changedVisibility(void) override; 112 112 113 113 virtual void setPosition(const Vector3& position) = 0; -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.cc
r9667 r11054 282 282 } 283 283 284 bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint)284 bool FpsPlayer::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) 285 285 { 286 286 if (contactPoint.m_normalWorldOnB.y() > 0.6) -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/FpsPlayer.h
r9667 r11054 69 69 virtual void fire(); 70 70 71 bool collidesAgainst(WorldEntity* otherObject, btManifoldPoint& contactPoint);71 virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint) override; 72 72 73 73 virtual void addedWeaponPack(WeaponPack* wPack); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/ModularSpaceShip.cc
r10624 r11054 53 53 RegisterClass(ModularSpaceShip); 54 54 55 std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = 0;55 std::map<StaticEntity*, ShipPart*>* ModularSpaceShip::partMap_s = nullptr; 56 56 57 57 ModularSpaceShip::ModularSpaceShip(Context* context) : SpaceShip(context) … … 94 94 for (unsigned int i=0; i < this->getAttachedObjects().size(); i++) 95 95 { 96 if (this->getAttachedObject(i) == NULL)96 if (this->getAttachedObject(i) == nullptr) 97 97 { 98 98 break; 99 99 } 100 100 // iterate through all attached parts 101 for( unsigned int j = 0; j < this->partList_.size(); j++)101 for(ShipPart* part : this->partList_) 102 102 { 103 103 // if the name of the part matches the name of the object, add the object to that parts entitylist (unless it was already done). 104 if(( this->partList_[j]->getName() == this->getAttachedObject(i)->getName()) && !this->partList_[j]->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))))104 if((part->getName() == this->getAttachedObject(i)->getName()) && !part->hasEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)))) 105 105 { 106 106 // The Entity is added to the part's entityList_ 107 this->partList_[j]->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i)));107 part->addEntity(orxonox_cast<StaticEntity*>(this->getAttachedObject(i))); 108 108 // An entry in the partMap_ is created, assigning the part to the entity. 109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), this->partList_[j]);109 this->addPartEntityAssignment((StaticEntity*)(this->getAttachedObject(i)), part); 110 110 } 111 111 } … … 146 146 ShipPart* ModularSpaceShip::getPartOfEntity(StaticEntity* entity) const 147 147 { 148 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = this->partMap_.begin(); it != this->partMap_.end(); ++it)149 { 150 if ( it->first == entity)151 return it->second;152 } 153 return NULL;148 for (const auto& mapEntry : this->partMap_) 149 { 150 if (mapEntry.first == entity) 151 return mapEntry.second; 152 } 153 return nullptr; 154 154 } 155 155 … … 160 160 void ModularSpaceShip::damage(float damage, float healthdamage, float shielddamage, Pawn* originator, const btCollisionShape* cs) 161 161 { 162 if (cs != NULL && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != NULL)162 if (cs != nullptr && this->getPartOfEntity((StaticEntity*)(cs->getUserPointer())) != nullptr) 163 163 this->getPartOfEntity((StaticEntity*)(cs->getUserPointer()))->handleHit(damage, healthdamage, shielddamage, originator); 164 164 else … … 174 174 void ModularSpaceShip::killShipPartStatic(std::string name) 175 175 { 176 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_s->begin(); it != ModularSpaceShip::partMap_s->end(); ++it)177 { 178 if ( it->second->getName() == name)179 { 180 it->second->death();176 for (const auto& mapEntry : *ModularSpaceShip::partMap_s) 177 { 178 if (mapEntry.second->getName() == name) 179 { 180 mapEntry.second->death(); 181 181 return; 182 182 } … … 193 193 void ModularSpaceShip::killShipPart(std::string name) 194 194 { 195 for ( std::map<StaticEntity*, ShipPart*>::const_iterator it = ModularSpaceShip::partMap_.begin(); it != ModularSpaceShip::partMap_.end(); ++it)196 { 197 if ( it->second->getName() == name)198 { 199 it->second->death();195 for (const auto& mapEntry : ModularSpaceShip::partMap_) 196 { 197 if (mapEntry.second->getName() == name) 198 { 199 mapEntry.second->death(); 200 200 return; 201 201 } … … 212 212 void ModularSpaceShip::addShipPart(ShipPart* part) 213 213 { 214 OrxAssert(part != NULL, "The ShipPart cannot be NULL.");214 OrxAssert(part != nullptr, "The ShipPart cannot be nullptr."); 215 215 this->partList_.push_back(part); 216 216 part->setParent(this); … … 222 222 Get the i-th ShipPart of the SpaceShip. 223 223 @return 224 Returns a pointer to the i-the ShipPart. NULLif there is no ShipPart with that index.224 Returns a pointer to the i-the ShipPart. nullptr if there is no ShipPart with that index. 225 225 */ 226 226 ShipPart* ModularSpaceShip::getShipPart(unsigned int index) 227 227 { 228 228 if(this->partList_.size() <= index) 229 return NULL;229 return nullptr; 230 230 else 231 231 return this->partList_[index]; … … 238 238 The name of the ShipPart to be returned. 239 239 @return 240 Pointer to the ShipPart with the given name, or NULLif not found.240 Pointer to the ShipPart with the given name, or nullptr if not found. 241 241 */ 242 242 ShipPart* ModularSpaceShip::getShipPartByName(std::string name) 243 243 { 244 for( std::vector<ShipPart*>::iterator it = this->partList_.begin(); it != this->partList_.end(); ++it)245 { 246 if(orxonox_cast<ShipPart*>( *it)->getName() == name)247 { 248 return orxonox_cast<ShipPart*>( *it);244 for(ShipPart* part : this->partList_) 245 { 246 if(orxonox_cast<ShipPart*>(part)->getName() == name) 247 { 248 return orxonox_cast<ShipPart*>(part); 249 249 } 250 250 } 251 251 orxout(internal_warning) << "Couldn't find ShipPart with name \"" << name << "\"." << endl; 252 return NULL;252 return nullptr; 253 253 } 254 254 … … 256 256 @brief 257 257 Check whether the SpaceShip has a particular Engine. 258 @param engine258 @param search 259 259 A pointer to the Engine to be checked. 260 260 */ 261 bool ModularSpaceShip::hasShipPart(ShipPart* part) const262 { 263 for( unsigned int i = 0; i < this->partList_.size(); i++)264 { 265 if( this->partList_[i] == part)261 bool ModularSpaceShip::hasShipPart(ShipPart* search) const 262 { 263 for(ShipPart* part : this->partList_) 264 { 265 if(part == search) 266 266 return true; 267 267 } -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/ModularSpaceShip.h
r10262 r11054 109 109 ShipPart* getPartOfEntity(StaticEntity* entity) const; 110 110 111 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);111 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr); 112 112 113 113 static void killShipPartStatic(std::string name); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.cc
r11052 r11054 77 77 this->shieldRechargeWaitCountdown_ = 0; 78 78 79 this->lastHitOriginator_ = 0;79 this->lastHitOriginator_ = nullptr; 80 80 81 81 // set damage multiplier to default value 1, meaning nominal damage … … 94 94 } 95 95 else 96 this->weaponSystem_ = 0;96 this->weaponSystem_ = nullptr; 97 97 98 98 this->setRadarObjectColour(ColourValue::Red); … … 112 112 else 113 113 { 114 this->explosionSound_ = 0;114 this->explosionSound_ = nullptr; 115 115 } 116 116 } … … 373 373 { 374 374 // delete the AIController // <-- TODO: delete? nothing is deleted here... should we delete the controller? 375 slave->setControllableEntity( 0);375 slave->setControllableEntity(nullptr); 376 376 377 377 // set a new master within the formation … … 468 468 return this->weaponSystem_->getWeaponSlot(index); 469 469 else 470 return 0;470 return nullptr; 471 471 } 472 472 … … 482 482 return this->weaponSystem_->getWeaponSet(index); 483 483 else 484 return 0;484 return nullptr; 485 485 } 486 486 … … 510 510 return this->weaponSystem_->getWeaponPack(index); 511 511 else 512 return 0;512 return nullptr; 513 513 } 514 514 … … 564 564 bool Pawn::hasSlaves() 565 565 { 566 for (ObjectList<FormationController>::iterator it = 567 ObjectList<FormationController>::begin(); 568 it != ObjectList<FormationController>::end(); ++it ) 566 for (FormationController* controller : ObjectList<FormationController>()) 569 567 { 570 568 // checks if the pawn's controller has a slave 571 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController())569 if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController()) 572 570 return true; 573 571 } … … 577 575 // A function that returns a slave of the pawn's controller 578 576 Controller* Pawn::getSlave(){ 579 for (ObjectList<FormationController>::iterator it = 580 ObjectList<FormationController>::begin(); 581 it != ObjectList<FormationController>::end(); ++it ) 582 { 583 if (this->hasHumanController() && it->getMaster() == this->getPlayer()->getController()) 584 return it->getController(); 585 } 586 return 0; 577 for (FormationController* controller : ObjectList<FormationController>()) 578 { 579 if (this->hasHumanController() && controller->getMaster() == this->getPlayer()->getController()) 580 return controller->getController(); 581 } 582 return nullptr; 587 583 } 588 584 -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Pawn.h
r11052 r11054 63 63 virtual ~Pawn(); 64 64 65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;67 virtual void tick(float dt) ;65 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 66 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 67 virtual void tick(float dt) override; 68 68 69 69 inline bool isAlive() const … … 157 157 virtual void kill(); 158 158 159 virtual void fired(unsigned int firemode) ;159 virtual void fired(unsigned int firemode) override; 160 160 virtual void postSpawn(); 161 161 … … 201 201 202 202 203 virtual void startLocalHumanControl() ;203 virtual void startLocalHumanControl() override; 204 204 205 205 void setAimPosition( Vector3 position ) … … 208 208 { return this->aimPosition_; } 209 209 210 virtual const Vector3& getCarrierPosition(void) const 210 virtual const Vector3& getCarrierPosition(void) const override 211 211 { return this->getWorldPosition(); }; 212 212 213 virtual void changedVisibility() ;213 virtual void changedVisibility() override; 214 214 215 215 void setExplosionSound(const std::string& engineSound); … … 220 220 221 221 protected: 222 virtual void preDestroy() ;223 224 virtual void setPlayer(PlayerInfo* player) ;225 virtual void removePlayer() ;222 virtual void preDestroy() override; 223 224 virtual void setPlayer(PlayerInfo* player) override; 225 virtual void removePlayer() override; 226 226 227 227 virtual void death(); … … 231 231 virtual void spawneffect(); 232 232 233 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = NULL, const btCollisionShape* cs = NULL);233 virtual void damage(float damage, float healthdamage = 0.0f, float shielddamage = 0.0f, Pawn* originator = nullptr, const btCollisionShape* cs = nullptr); 234 234 235 235 bool bAlive_; 236 236 bool bVulnerable_; ///< If false the pawn may not ged damaged 237 237 238 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const 238 virtual std::vector<PickupCarrier*>* getCarrierChildren(void) const override 239 239 { return new std::vector<PickupCarrier*>(); } 240 virtual PickupCarrier* getCarrierParent(void) const 241 { return NULL; }240 virtual PickupCarrier* getCarrierParent(void) const override 241 { return nullptr; } 242 242 243 243 -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/SpaceShip.cc
r11052 r11054 48 48 RegisterClass(SpaceShip); 49 49 50 SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_( NULL)50 SpaceShip::SpaceShip(Context* context) : Pawn(context), boostBlur_(nullptr) 51 51 { 52 52 RegisterObject(SpaceShip); … … 160 160 161 161 // Run the engines 162 for( std::vector<Engine*>::iterator it = this->engineList_.begin(); it != this->engineList_.end(); it++)163 (*it)->run(dt);162 for(Engine* engine : this->engineList_) 163 engine->run(dt); 164 164 165 165 if (this->hasLocalController()) … … 198 198 if(this->bEnableMotionBlur_) 199 199 { 200 if (this->boostBlur_ == NULL&& this->hasLocalController() && this->hasHumanController())200 if (this->boostBlur_ == nullptr && this->hasLocalController() && this->hasHumanController()) 201 201 { 202 202 this->boostBlur_ = new Shader(this->getScene()->getSceneManager()); … … 325 325 void SpaceShip::addEngine(orxonox::Engine* engine) 326 326 { 327 OrxAssert(engine != NULL, "The engine cannot be NULL.");327 OrxAssert(engine != nullptr, "The engine cannot be nullptr."); 328 328 this->engineList_.push_back(engine); 329 329 engine->addToSpaceShip(this); … … 333 333 @brief 334 334 Check whether the SpaceShip has a particular Engine. 335 @param engine335 @param search 336 336 A pointer to the Engine to be checked. 337 337 */ 338 bool SpaceShip::hasEngine(Engine* engine) const339 { 340 for( unsigned int i = 0; i < this->engineList_.size(); i++)341 { 342 if( this->engineList_[i] == engine)338 bool SpaceShip::hasEngine(Engine* search) const 339 { 340 for(Engine* engine : this->engineList_) 341 { 342 if(engine == search) 343 343 return true; 344 344 } … … 350 350 Get the i-th Engine of the SpaceShip. 351 351 @return 352 Returns a pointer to the i-the Engine. NULLif there is no Engine with that index.352 Returns a pointer to the i-the Engine. nullptr if there is no Engine with that index. 353 353 */ 354 354 Engine* SpaceShip::getEngine(unsigned int i) 355 355 { 356 356 if(this->engineList_.size() >= i) 357 return NULL;357 return nullptr; 358 358 else 359 359 return this->engineList_[i]; … … 366 366 The name of the engine to be returned. 367 367 @return 368 Pointer to the engine with the given name, or NULLif not found.368 Pointer to the engine with the given name, or nullptr if not found. 369 369 */ 370 370 Engine* SpaceShip::getEngineByName(const std::string& name) 371 371 { 372 for( size_t i = 0; i < this->engineList_.size(); ++i)373 if( this->engineList_[i]->getName() == name)374 return this->engineList_[i];372 for(Engine* engine : this->engineList_) 373 if(engine->getName() == name) 374 return engine; 375 375 376 376 orxout(internal_warning) << "Couldn't find Engine with name \"" << name << "\"." << endl; 377 return NULL;377 return nullptr; 378 378 } 379 379 … … 416 416 void SpaceShip::addSpeedFactor(float factor) 417 417 { 418 for( unsigned int i=0; i<this->engineList_.size(); i++)419 this->engineList_[i]->addSpeedMultiply(factor);418 for(Engine* engine : this->engineList_) 419 engine->addSpeedMultiply(factor); 420 420 } 421 421 … … 428 428 void SpaceShip::addSpeed(float speed) 429 429 { 430 for( unsigned int i=0; i<this->engineList_.size(); i++)431 this->engineList_[i]->addSpeedAdd(speed);430 for(Engine* engine : this->engineList_) 431 engine->addSpeedAdd(speed); 432 432 } 433 433 … … 456 456 { 457 457 float speed=0; 458 for( unsigned int i=0; i<this->engineList_.size(); i++)459 { 460 if( this->engineList_[i]->getMaxSpeedFront() > speed)461 speed = this->engineList_[i]->getMaxSpeedFront();458 for(Engine* engine : this->engineList_) 459 { 460 if(engine->getMaxSpeedFront() > speed) 461 speed = engine->getMaxSpeedFront(); 462 462 } 463 463 return speed; … … 485 485 void SpaceShip::changedEnableMotionBlur() 486 486 { 487 if (!this->bEnableMotionBlur_ && this->boostBlur_ != NULL)487 if (!this->bEnableMotionBlur_ && this->boostBlur_ != nullptr) 488 488 { 489 489 delete this->boostBlur_; 490 this->boostBlur_ = NULL;490 this->boostBlur_ = nullptr; 491 491 } 492 492 } … … 514 514 Camera* camera = this->getCamera(); 515 515 //Shaking Camera effect 516 if (camera != 0)516 if (camera != nullptr) 517 517 camera->setOrientation(Vector3::UNIT_X, angle); 518 518 … … 530 530 { 531 531 Camera* camera = CameraManager::getInstance().getActiveCamera(); 532 if(camera != NULL)532 if(camera != nullptr) 533 533 { 534 534 this->cameraOriginalPosition_ = camera->getPosition(); … … 546 546 { 547 547 Camera *camera = this->getCamera(); 548 if (camera == 0)548 if (camera == nullptr) 549 549 { 550 550 orxout(internal_warning) << "Failed to reset camera!" << endl; -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/Spectator.cc
r10624 r11054 58 58 this->localVelocity_ = Vector3::ZERO; 59 59 this->setHudTemplate("spectatorhud"); 60 this->greetingFlare_ = 0;60 this->greetingFlare_ = nullptr; 61 61 62 62 this->setDestroyWhenPlayerLeft(true); -
code/branches/cpp11_v3/src/orxonox/worldentities/pawns/TeamBaseMatchBase.cc
r10624 r11054 80 80 81 81 std::set<WorldEntity*> attachments = this->getAttachedObjects(); 82 for ( std::set<WorldEntity*>::iterator it = attachments.begin(); it != attachments.end(); ++it)82 for (WorldEntity* attachment : attachments) 83 83 { 84 if ( (*it)->isA(Class(TeamColourable)))84 if (attachment->isA(Class(TeamColourable))) 85 85 { 86 TeamColourable* tc = orxonox_cast<TeamColourable*>( *it);86 TeamColourable* tc = orxonox_cast<TeamColourable*>(attachment); 87 87 tc->setTeamColour(colour); 88 88 } … … 92 92 93 93 // Call this so bots stop shooting at the base after they converted it 94 for ( ObjectList<ArtificialController>::iterator it = ObjectList<ArtificialController>::begin(); it != ObjectList<ArtificialController>::end(); ++it)95 it->abandonTarget(this);94 for (ArtificialController* controller : ObjectList<ArtificialController>()) 95 controller->abandonTarget(this); 96 96 } 97 97 }
Note: See TracChangeset
for help on using the changeset viewer.