Changeset 11054 for code/branches/cpp11_v3/src/orxonox/interfaces
- Timestamp:
- Jan 10, 2016, 1:54:11 PM (9 years ago)
- Location:
- code/branches/cpp11_v3
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v3
- Property svn:mergeinfo changed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.