Changeset 11071 for code/trunk/src/modules/docking
- Timestamp:
- Jan 17, 2016, 10:29:21 PM (9 years ago)
- Location:
- code/trunk
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/modules/docking/Dock.cc
r10624 r11071 87 87 88 88 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 89 PlayerInfo* player = NULL;89 PlayerInfo* player = nullptr; 90 90 91 91 // Check whether it is a player trigger and extract pawn from it 92 if(pTrigger != NULL)92 if(pTrigger != nullptr) 93 93 { 94 94 if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 103 103 return false; 104 104 } 105 if(player == NULL)105 if(player == nullptr) 106 106 { 107 107 orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 131 131 { 132 132 PlayerTrigger* pTrigger = orxonox_cast<PlayerTrigger*>(trigger); 133 PlayerInfo* player = NULL;133 PlayerInfo* player = nullptr; 134 134 135 135 // Check whether it is a player trigger and extract pawn from it 136 if(pTrigger != NULL)136 if(pTrigger != nullptr) 137 137 { 138 138 if(!pTrigger->isForPlayer()) { // The PlayerTrigger is not exclusively for Pawns which means we cannot extract one. … … 147 147 return false; 148 148 } 149 if(player == NULL)149 if(player == nullptr) 150 150 { 151 151 orxout(verbose, context::docking) << "Docking::execute Can't retrieve PlayerInfo from Trigger. (" << trigger->getIdentifier()->getName() << ")" << endl; … … 214 214 { 215 215 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 216 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)217 { 218 if( it->dock(player))216 for(Dock* dock : ObjectList<Dock>()) 217 { 218 if(dock->dock(player)) 219 219 break; 220 220 } … … 224 224 { 225 225 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 226 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)227 { 228 if( it->undock(player))226 for(Dock* dock : ObjectList<Dock>()) 227 { 228 if(dock->undock(player)) 229 229 break; 230 230 } … … 295 295 int i = 0; 296 296 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 297 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)298 { 299 if( it->candidates_.find(player) != it->candidates_.end())297 for(Dock* dock : ObjectList<Dock>()) 298 { 299 if(dock->candidates_.find(player) != dock->candidates_.end()) 300 300 i++; 301 301 } … … 306 306 { 307 307 PlayerInfo* player = HumanController::getLocalControllerSingleton()->getPlayer(); 308 for( ObjectList<Dock>::iterator it = ObjectList<Dock>::begin(); it != ObjectList<Dock>::end(); ++it)309 { 310 if( it->candidates_.find(player) != it->candidates_.end())308 for(Dock* dock : ObjectList<Dock>()) 309 { 310 if(dock->candidates_.find(player) != dock->candidates_.end()) 311 311 { 312 312 if(index == 0) 313 return *it;313 return dock; 314 314 index--; 315 315 } 316 316 } 317 return NULL;317 return nullptr; 318 318 } 319 319 … … 327 327 const DockingEffect* Dock::getEffect(unsigned int i) const 328 328 { 329 for ( std::list<DockingEffect*>::const_iterator effect = this->effects_.begin(); effect != this->effects_.end(); ++effect)329 for (DockingEffect* effect : this->effects_) 330 330 { 331 331 if(i == 0) 332 return *effect;332 return effect; 333 333 i--; 334 334 } 335 return NULL;335 return nullptr; 336 336 } 337 337 … … 346 346 const DockingAnimation* Dock::getAnimation(unsigned int i) const 347 347 { 348 for ( std::list<DockingAnimation*>::const_iterator animation = this->animations_.begin(); animation != this->animations_.end(); ++animation)348 for (DockingAnimation* animation : this->animations_) 349 349 { 350 350 if(i == 0) 351 return *animation;351 return animation; 352 352 i--; 353 353 } 354 return NULL;354 return nullptr; 355 355 } 356 356 } -
code/trunk/src/modules/docking/Dock.h
r9939 r11071 65 65 66 66 // XML interface 67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;68 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) ;67 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 68 virtual void XMLEventPort(Element& xmlelement, XMLPort::Mode mode) override; 69 69 70 70 // XML functions -
code/trunk/src/modules/docking/DockToShip.cc
r9974 r11071 72 72 73 73 DockingTarget *target = DockingEffect::findTarget(this->target_); 74 if (target == NULL) {74 if (target == nullptr) { 75 75 orxout(internal_warning, context::docking) << "Can't retrieve target for '" << this->target_ << "'.." << endl; 76 76 return false; … … 78 78 79 79 ControllableEntity *dockTo = (ControllableEntity*) target->getParent(); 80 if (dockTo == NULL) {80 if (dockTo == nullptr) { 81 81 orxout(internal_warning, context::docking) << "Parent is not a ControllableEntity.." << endl; 82 82 return false; -
code/trunk/src/modules/docking/DockToShip.h
r9667 r11071 60 60 virtual ~DockToShip(); 61 61 62 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) ;62 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override; 63 63 void setTargetId(const std::string& str); 64 64 const std::string& getTargetId() const; 65 65 66 virtual bool docking(PlayerInfo* player) ; //!< Called when docking starts67 virtual bool release(PlayerInfo* player) ; //!< Called when player wants undock66 virtual bool docking(PlayerInfo* player) override; //!< Called when docking starts 67 virtual bool release(PlayerInfo* player) override; //!< Called when player wants undock 68 68 private: 69 69 std::string target_; -
code/trunk/src/modules/docking/DockingAnimation.cc
r10624 r11071 45 45 RegisterObject(DockingAnimation); 46 46 47 this->parent_ = NULL;47 this->parent_ = nullptr; 48 48 } 49 49 … … 57 57 bool check = true; 58 58 59 for ( std::list<DockingAnimation*>::iterator animation = animations.begin(); animation != animations.end(); animation++)59 for (DockingAnimation* animation : animations) 60 60 { 61 61 if(dock) 62 check &= (*animation)->docking(player);62 check &= animation->docking(player); 63 63 else 64 check &= (*animation)->release(player);64 check &= animation->release(player); 65 65 } 66 66 -
code/trunk/src/modules/docking/DockingController.cc
r11052 r11071 44 44 RegisterObject(DockingController); 45 45 46 this->dock_ = NULL;47 this->player_ = NULL;48 this->entity_ = NULL;46 this->dock_ = nullptr; 47 this->player_ = nullptr; 48 this->entity_ = nullptr; 49 49 } 50 50 … … 122 122 this->player_->startControl(this->entity_); 123 123 this->setActive(false); 124 this->controllableEntity_ = NULL;124 this->controllableEntity_ = nullptr; 125 125 126 126 if (this->docking_) -
code/trunk/src/modules/docking/DockingController.h
r9667 r11071 45 45 virtual ~DockingController(); 46 46 47 virtual void tick(float dt) ;47 virtual void tick(float dt) override; 48 48 49 49 void takeControl(bool docking); … … 53 53 54 54 protected: 55 virtual void positionReached() ;55 virtual void positionReached() override; 56 56 57 57 private: -
code/trunk/src/modules/docking/DockingEffect.cc
r10624 r11071 53 53 bool check = true; 54 54 55 for ( std::list<DockingEffect*>::iterator effect = effects.begin(); effect != effects.end(); effect++)55 for (DockingEffect* effect : effects) 56 56 { 57 57 if (dock) 58 check &= (*effect)->docking(player);58 check &= effect->docking(player); 59 59 else 60 check &= (*effect)->release(player);60 check &= effect->release(player); 61 61 } 62 62 … … 65 65 66 66 DockingTarget *DockingEffect::findTarget(std::string name) { 67 for ( ObjectList<DockingTarget>::iterator it = ObjectList<DockingTarget>::begin(); it != ObjectList<DockingTarget>::end(); ++it)67 for (DockingTarget* target : ObjectList<DockingTarget>()) 68 68 { 69 if ( (*it)->getName().compare(name) == 0)70 return (*it);69 if (target->getName().compare(name) == 0) 70 return target; 71 71 } 72 return NULL;72 return nullptr; 73 73 } 74 74 } -
code/trunk/src/modules/docking/DockingTarget.cc
r9667 r11071 34 34 #include "DockingTarget.h" 35 35 #include "core/CoreIncludes.h" 36 #include "core/XMLPort.h"37 36 38 37 … … 49 48 { 50 49 } 51 52 void DockingTarget::XMLPort(Element& xmlelement, XMLPort::Mode mode)53 {54 SUPER(DockingTarget, XMLPort, xmlelement, mode);55 56 orxout(verbose, context::docking) << "DockingTarget with name '" << this->getName() << "' created.." << endl;57 }58 59 50 } 60 51 -
code/trunk/src/modules/docking/DockingTarget.h
r9667 r11071 58 58 virtual ~DockingTarget(); 59 59 60 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);61 62 60 }; 63 61 -
code/trunk/src/modules/docking/MoveToDockingTarget.h
r9667 r11071 59 59 virtual ~MoveToDockingTarget(); 60 60 61 virtual bool docking(PlayerInfo* player) ; //!< Called when a player starts docking62 virtual bool release(PlayerInfo* player) ; //!< Called when player wants to undock61 virtual bool docking(PlayerInfo* player) override; //!< Called when a player starts docking 62 virtual bool release(PlayerInfo* player) override; //!< Called when player wants to undock 63 63 }; 64 64
Note: See TracChangeset
for help on using the changeset viewer.