Changeset 5785
- Timestamp:
- Sep 25, 2009, 12:54:12 AM (15 years ago)
- Location:
- code/branches/core5/src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core5/src/libraries/core/ClassTreeMask.h
r5738 r5785 265 265 266 266 /** @brief Returns true if the ClassTreeMaskObjectIterator points at the given object. @param pointer The pointer of the object */ 267 inline bool operator==(BaseObject* pointer) const { return ( (*this->objectIterator_) == pointer); }267 inline bool operator==(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) == pointer) || (!this->objectIterator_ && pointer == 0); } 268 268 /** @brief Returns true if the ClassTreeMaskObjectIterator doesn't point at the given object. @param pointer The pointer of the object */ 269 inline bool operator!=(BaseObject* pointer) const { return ( (*this->objectIterator_) != pointer); }269 inline bool operator!=(BaseObject* pointer) const { return (this->objectIterator_ && (*this->objectIterator_) != pointer) || (!this->objectIterator_ && pointer != 0); } 270 270 /** @brief Returns true if the ClassTreeMaskObjectIterator hasn't already reached the end. */ 271 271 inline operator bool() const { return (this->objectIterator_); } -
code/branches/core5/src/libraries/core/Iterator.h
r5738 r5785 167 167 168 168 return (*this); 169 return *this;170 169 } 171 170 … … 193 192 inline const Iterator<T>& operator++() 194 193 { 195 if (this->element_) 196 this->element_ = this->element_->next_; 194 this->element_ = this->element_->next_; 197 195 return *this; 198 196 } … … 205 203 { 206 204 Iterator<T> copy = *this; 207 if (this->element_) 208 this->element_ = this->element_->next_; 205 this->element_ = this->element_->next_; 209 206 return copy; 210 207 } … … 216 213 inline const Iterator<T>& operator--() 217 214 { 218 if (this->element_) 219 this->element_ = this->element_->prev_; 215 this->element_ = this->element_->prev_; 220 216 return *this; 221 217 } … … 228 224 { 229 225 Iterator<T> copy = *this; 230 if (this->element_) 231 this->element_ = this->element_->prev_; 226 this->element_ = this->element_->prev_; 232 227 return copy; 233 228 } … … 239 234 inline T* operator*() const 240 235 { 241 if (this->element_) 242 return orxonox_cast<T*>(this->element_->objectBase_); 243 else 244 return 0; 236 return orxonox_cast<T*>(this->element_->objectBase_); 245 237 } 246 238 … … 251 243 inline T* operator->() const 252 244 { 253 if (this->element_) 254 return orxonox_cast<T*>(this->element_->objectBase_); 255 else 256 return 0; 245 return orxonox_cast<T*>(this->element_->objectBase_); 257 246 } 258 247 -
code/branches/core5/src/libraries/core/ObjectListIterator.h
r5738 r5785 123 123 inline const ObjectListIterator<T>& operator++() 124 124 { 125 if (this->element_) 126 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 125 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 127 126 return *this; 128 127 } … … 135 134 { 136 135 ObjectListIterator<T> copy = *this; 137 if (this->element_) 138 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 136 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->next_); 139 137 return copy; 140 138 } … … 146 144 inline const ObjectListIterator<T>& operator--() 147 145 { 148 if (this->element_) 149 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 146 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 150 147 return *this; 151 148 } … … 158 155 { 159 156 ObjectListIterator<T> copy = *this; 160 if (this->element_) 161 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 157 this->element_ = static_cast<ObjectListElement<T>*>(this->element_->prev_); 162 158 return copy; 163 159 } … … 169 165 inline T* operator*() const 170 166 { 171 if (this->element_) 172 return this->element_->object_; 173 else 174 return 0; 167 return this->element_->object_; 175 168 } 176 169 … … 181 174 inline T* operator->() const 182 175 { 183 if (this->element_) 184 return this->element_->object_; 185 else 186 return 0; 176 return this->element_->object_; 187 177 } 188 178 -
code/branches/core5/src/modules/gamestates/GSRoot.cc
r5738 r5785 111 111 } 112 112 113 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it)114 it->tick(time);113 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ) 114 (it++)->tick(time); 115 115 116 116 /*** HACK *** HACK ***/ … … 122 122 leveldt = 0.0f; 123 123 } 124 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ++it)125 it->tick(leveldt * this->timeFactor_);124 for (ObjectList<Tickable>::iterator it = ObjectList<Tickable>::begin(); it; ) 125 (it++)->tick(leveldt * this->timeFactor_); 126 126 /*** HACK *** HACK ***/ 127 127 } -
code/branches/core5/src/orxonox/Radar.cc
r5738 r5785 84 84 const RadarViewable* Radar::getFocus() 85 85 { 86 return *(this->itFocus_); 86 if (this->itFocus_) 87 return *(this->itFocus_); 88 else 89 return 0; 87 90 } 88 91 … … 101 104 SUPER(Radar, tick, dt); 102 105 103 if (this-> focus_ != *(this->itFocus_))106 if (this->itFocus_ && (this->focus_ != *(this->itFocus_))) 104 107 { 105 108 // focus object was deleted, release focus -
code/branches/core5/src/orxonox/overlays/Map.cc
r5738 r5785 290 290 for(ObjectList<orxonox::RadarViewable>::iterator it = ObjectList<orxonox::RadarViewable>::begin(); 291 291 it!=ObjectList<orxonox::RadarViewable>::end(); 292 it++)292 ++it) 293 293 { 294 294 //COUT(0) << "Radar_Position: " << it->getRVWorldPosition() << std::endl; … … 392 392 for(ObjectList<orxonox::Map>::iterator it = ObjectList<orxonox::Map>::begin(); 393 393 it!=ObjectList<orxonox::Map>::end(); 394 it++)394 ++it) 395 395 { 396 396 //Map * m = it->getMap(); -
code/branches/core5/src/orxonox/pickup/DroppedItem.cc
r5738 r5785 56 56 if (this->item_) 57 57 { 58 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); it++)58 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 59 59 { 60 60 Vector3 distance = it->getWorldPosition() - this->getWorldPosition(); -
code/branches/core5/src/orxonox/pickup/PickupSpawner.cc
r5738 r5785 127 127 if (this->isActive()) 128 128 { 129 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); it++)129 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 130 130 { 131 131 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();
Note: See TracChangeset
for help on using the changeset viewer.