Changeset 10919 for code/branches/cpp11_v2/src/modules
- Timestamp:
- Dec 5, 2015, 10:47:51 PM (9 years ago)
- Location:
- code/branches/cpp11_v2/src/modules
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/cpp11_v2/src/modules/docking/Dock.cc
r10916 r10919 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 } -
code/branches/cpp11_v2/src/modules/docking/DockingEffect.cc
r10916 r10919 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 72 return nullptr; -
code/branches/cpp11_v2/src/modules/dodgerace/DodgeRace.cc
r10768 r10919 136 136 if (player == nullptr) 137 137 { 138 for ( ObjectList<DodgeRaceShip>::iterator it = ObjectList<DodgeRaceShip>::begin(); it != ObjectList<DodgeRaceShip>::end(); ++it)139 { 140 player = *it;138 for (DodgeRaceShip* ship : ObjectList<DodgeRaceShip>()) 139 { 140 player = ship; 141 141 } 142 142 } -
code/branches/cpp11_v2/src/modules/dodgerace/DodgeRaceShip.cc
r10818 r10919 154 154 if (game == nullptr) 155 155 { 156 for ( ObjectList<DodgeRace>::iterator it = ObjectList<DodgeRace>::begin(); it != ObjectList<DodgeRace>::end(); ++it)156 for (DodgeRace* race : ObjectList<DodgeRace>()) 157 157 { 158 game = *it;158 game = race; 159 159 } 160 160 } -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRace.cc
r9804 r10919 88 88 this->cantMove_ = true; 89 89 90 for ( ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)91 it->setActive(false);90 for (Engine* engine : ObjectList<Engine>()) 91 engine->setActive(false); 92 92 } 93 93 … … 95 95 if (!this->isStartCountdownRunning() && this->cantMove_) 96 96 { 97 for ( ObjectList<Engine>::iterator it = ObjectList<Engine>::begin(); it; ++it)98 it->setActive(true);97 for (Engine* engine : ObjectList<Engine>()) 98 engine->setActive(true); 99 99 100 100 this->cantMove_= false; -
code/branches/cpp11_v2/src/modules/gametypes/SpaceRaceController.cc
r10917 r10919 61 61 if (ObjectList<SpaceRaceManager>::size() != 1) 62 62 orxout(internal_warning) << "Expected 1 instance of SpaceRaceManager but found " << ObjectList<SpaceRaceManager>::size() << endl; 63 for ( ObjectList<SpaceRaceManager>::iterator it = ObjectList<SpaceRaceManager>::begin(); it != ObjectList<SpaceRaceManager>::end(); ++it)64 { 65 checkpoints = it->getAllCheckpoints();66 nextRaceCheckpoint_ = it->findCheckpoint(0);63 for (SpaceRaceManager* manager : ObjectList<SpaceRaceManager>()) 64 { 65 checkpoints = manager->getAllCheckpoints(); 66 nextRaceCheckpoint_ = manager->findCheckpoint(0); 67 67 } 68 68 … … 187 187 { 188 188 int numberOfWays = 0; // counts number of ways from this Point to the last point 189 for ( std::set<int>::iterator it = currentCheckpoint->getNextCheckpoints().begin(); it!= currentCheckpoint->getNextCheckpoints().end(); ++it)190 { 191 if (currentCheckpoint == findCheckpoint( *it))189 for (int checkpointIndex : currentCheckpoint->getNextCheckpoints()) 190 { 191 if (currentCheckpoint == findCheckpoint(checkpointIndex)) 192 192 { 193 193 //orxout() << currentCheckpoint->getCheckpointIndex()<<endl; 194 194 continue; 195 195 } 196 if (findCheckpoint( *it) == nullptr)197 orxout(internal_warning) << "Problematic Point: " << (*it)<< endl;196 if (findCheckpoint(checkpointIndex) == nullptr) 197 orxout(internal_warning) << "Problematic Point: " << checkpointIndex << endl; 198 198 else 199 numberOfWays += rekSimulationCheckpointsReached(findCheckpoint( *it), zaehler);199 numberOfWays += rekSimulationCheckpointsReached(findCheckpoint(checkpointIndex), zaehler); 200 200 } 201 201 zaehler[currentCheckpoint] += numberOfWays; … … 255 255 { 256 256 float minimum = std::numeric_limits<float>::max(); 257 for ( std::set<int>::iterator it = currentCheckPoint->getNextCheckpoints().begin(); it != currentCheckPoint->getNextCheckpoints().end(); ++it)257 for (int checkpointIndex : currentCheckPoint->getNextCheckpoints()) 258 258 { 259 259 int dist_currentCheckPoint_currentPosition = static_cast<int> ((currentPosition- currentCheckPoint->getPosition()).length()); 260 260 261 minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint( *it), currentCheckPoint->getPosition()));261 minimum = std::min(minimum, dist_currentCheckPoint_currentPosition + recCalculateDistance(findCheckpoint(checkpointIndex), currentCheckPoint->getPosition())); 262 262 // minimum of distanz from 'currentPosition' to the next static Checkpoint 263 263 } -
code/branches/cpp11_v2/src/modules/invader/Invader.cc
r10768 r10919 98 98 if (player == nullptr) 99 99 { 100 for ( ObjectList<InvaderShip>::iterator it = ObjectList<InvaderShip>::begin(); it != ObjectList<InvaderShip>::end(); ++it)101 player = *it;100 for (InvaderShip* ship : ObjectList<InvaderShip>()) 101 player = ship; 102 102 } 103 103 return player; -
code/branches/cpp11_v2/src/modules/invader/InvaderEnemy.cc
r10818 r10919 75 75 if (game == nullptr) 76 76 { 77 for ( ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)78 game = *it;77 for (Invader* invader : ObjectList<Invader>()) 78 game = invader; 79 79 } 80 80 return game; -
code/branches/cpp11_v2/src/modules/invader/InvaderShip.cc
r10818 r10919 184 184 if (game == nullptr) 185 185 { 186 for ( ObjectList<Invader>::iterator it = ObjectList<Invader>::begin(); it != ObjectList<Invader>::end(); ++it)187 game = *it;186 for (Invader* invader : ObjectList<Invader>()) 187 game = invader; 188 188 } 189 189 return game; -
code/branches/cpp11_v2/src/modules/jump/JumpProjectile.cc
r10768 r10919 69 69 Vector3 projectilePosition = getPosition(); 70 70 71 for ( ObjectList<JumpEnemy>::iterator it = ObjectList<JumpEnemy>::begin(); it != ObjectList<JumpEnemy>::end(); ++it)71 for (JumpEnemy* enemy : ObjectList<JumpEnemy>()) 72 72 { 73 Vector3 enemyPosition = it->getPosition();74 float enemyWidth = it->getWidth();75 float enemyHeight = it->getHeight();73 Vector3 enemyPosition = enemy->getPosition(); 74 float enemyWidth = enemy->getWidth(); 75 float enemyHeight = enemy->getHeight(); 76 76 77 77 if(projectilePosition.x > enemyPosition.x-enemyWidth && projectilePosition.x < enemyPosition.x+enemyWidth && projectilePosition.z > enemyPosition.z-enemyHeight && projectilePosition.z < enemyPosition.z+enemyHeight) 78 78 { 79 it->dead_ = true;79 enemy->dead_ = true; 80 80 } 81 81 } -
code/branches/cpp11_v2/src/modules/objects/Attacher.cc
r10916 r10919 101 101 return; 102 102 103 for ( ObjectList<WorldEntity>::iterator it = ObjectList<WorldEntity>::begin(); it != ObjectList<WorldEntity>::end(); ++it)103 for (WorldEntity* worldEntity : ObjectList<WorldEntity>()) 104 104 { 105 if ( it->getName() == this->targetname_)105 if (worldEntity->getName() == this->targetname_) 106 106 { 107 this->target_ = *it;108 this->attachToParent( *it);107 this->target_ = worldEntity; 108 this->attachToParent(worldEntity); 109 109 } 110 110 } -
code/branches/cpp11_v2/src/modules/objects/ForceField.cc
r9945 r10919 118 118 { 119 119 // Iterate over all objects that could possibly be affected by the ForceField. 120 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)120 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 121 121 { 122 122 // The direction of the orientation of the force field. … … 125 125 126 126 // Vector from the center of the force field to the object its acting on. 127 Vector3 distanceVector = it->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction));127 Vector3 distanceVector = mobileEntity->getWorldPosition() - (this->getWorldPosition() + (this->halfLength_ * direction)); 128 128 129 129 // The object is outside a ball around the center with radius length/2 of the ForceField. … … 132 132 133 133 // The distance of the object form the orientation vector. (Or rather the smallest distance from the orientation vector) 134 float distanceFromDirectionVector = (( it->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length();134 float distanceFromDirectionVector = ((mobileEntity->getWorldPosition() - this->getWorldPosition()).crossProduct(direction)).length(); 135 135 136 136 // If the object in a tube of radius 'radius' around the direction of orientation. … … 140 140 // Apply a force to the object in the direction of the orientation. 141 141 // The force is highest when the object is directly on the direction vector, with a linear decrease, finally reaching zero, when distanceFromDirectionVector = radius. 142 it->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction);142 mobileEntity->applyCentralForce((this->radius_ - distanceFromDirectionVector)/this->radius_ * this->velocity_ * direction); 143 143 } 144 144 } … … 146 146 { 147 147 // Iterate over all objects that could possibly be affected by the ForceField. 148 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)149 { 150 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();148 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 149 { 150 Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition(); 151 151 float distance = distanceVector.length(); 152 152 // If the object is within 'radius' distance. … … 155 155 distanceVector.normalise(); 156 156 // Apply a force proportional to the velocity, with highest force at the origin of the sphere, linear decreasing until reaching a distance of 'radius' from the origin, where the force reaches zero. 157 it->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector);157 mobileEntity->applyCentralForce((this->radius_ - distance)/this->radius_ * this->velocity_ * distanceVector); 158 158 } 159 159 } … … 162 162 { 163 163 // Iterate over all objects that could possibly be affected by the ForceField. 164 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)165 { 166 Vector3 distanceVector = this->getWorldPosition() - it->getWorldPosition();164 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 165 { 166 Vector3 distanceVector = this->getWorldPosition() - mobileEntity->getWorldPosition(); 167 167 float distance = distanceVector.length(); 168 168 // If the object is within 'radius' distance and no more than 'length' away from the boundary of the sphere. … … 172 172 distanceVector.normalise(); 173 173 // Apply a force proportional to the velocity, with highest force at the boundary of the sphere, linear decreasing until reaching a distance of 'radius-length' from the origin, where the force reaches zero. 174 it->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector);174 mobileEntity->applyCentralForce((distance-range)/range * this->velocity_ * distanceVector); 175 175 } 176 176 } … … 179 179 { 180 180 // Iterate over all objects that could possibly be affected by the ForceField. 181 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)182 { 183 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();181 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 182 { 183 Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition(); 184 184 float distance = distanceVector.length(); 185 185 // If the object is within 'radius' distance and especially further away than massRadius_ … … 197 197 198 198 // Note: this so called force is actually an acceleration! 199 it->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector);199 mobileEntity->applyCentralForce((-1) * (ForceField::attenFactor_ * ForceField::gravConstant_ * this->getMass()) / (distance * distance) * distanceVector); 200 200 } 201 201 } … … 204 204 { 205 205 // Iterate over all objects that could possibly be affected by the ForceField. 206 for ( ObjectList<MobileEntity>::iterator it = ObjectList<MobileEntity>::begin(); it != ObjectList<MobileEntity>::end(); ++it)207 { 208 Vector3 distanceVector = it->getWorldPosition() - this->getWorldPosition();206 for (MobileEntity* mobileEntity : ObjectList<MobileEntity>()) 207 { 208 Vector3 distanceVector = mobileEntity->getWorldPosition() - this->getWorldPosition(); 209 209 float distance = distanceVector.length(); 210 210 if (distance < this->radius_ && distance > this->massRadius_) … … 212 212 // Add a Acceleration in forceDirection_. 213 213 // Vector3(0,0,0) is the direction, where the force should work. 214 it->addAcceleration(forceDirection_ , Vector3(0,0,0));214 mobileEntity->addAcceleration(forceDirection_ , Vector3(0,0,0)); 215 215 } 216 216 } -
code/branches/cpp11_v2/src/modules/objects/SpaceBoundaries.cc
r10916 r10919 73 73 { 74 74 pawnsIn_.clear(); 75 for(ObjectList<Pawn>::iterator current = ObjectList<Pawn>::begin(); current != ObjectList<Pawn>::end(); ++current) 76 { 77 Pawn* currentPawn = *current; 75 for(Pawn* currentPawn : ObjectList<Pawn>()) 76 { 78 77 if( this->reaction_ == 0 ) 79 78 { -
code/branches/cpp11_v2/src/modules/objects/controllers/TurretController.cc
r10818 r10919 103 103 Pawn* minScorePawn = nullptr; 104 104 105 for (ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it) 106 { 107 Pawn* entity = orxonox_cast<Pawn*>(*it); 108 if (!entity || FormationController::sameTeam(turret, entity, this->getGametype())) 105 for (Pawn* pawn : ObjectList<Pawn>()) 106 { 107 if (!pawn || FormationController::sameTeam(turret, pawn, this->getGametype())) 109 108 continue; 110 tempScore = turret->isInRange( entity);109 tempScore = turret->isInRange(pawn); 111 110 if(tempScore != -1.f) 112 111 { … … 114 113 { 115 114 minScore = tempScore; 116 minScorePawn = entity;115 minScorePawn = pawn; 117 116 } 118 117 } -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventFilter.cc
r10916 r10919 70 70 { 71 71 bool success = false; 72 for ( std::list<EventName*>::const_iterator it = this->names_.begin(); it != this->names_.end(); ++it)72 for (EventName* name : this->names_) 73 73 { 74 if ( (*it)->getName() == event.name_)74 if (name->getName() == event.name_) 75 75 { 76 76 success = true; -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventListener.cc
r9667 r10919 78 78 return; 79 79 80 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)81 if ( it->getName() == this->eventName_)82 this->addEventSource( *it, "");80 for (BaseObject* object : ObjectList<BaseObject>()) 81 if (object->getName() == this->eventName_) 82 this->addEventSource(object, ""); 83 83 } 84 84 -
code/branches/cpp11_v2/src/modules/objects/eventsystem/EventTarget.cc
r9667 r10919 73 73 this->target_ = name; 74 74 75 for ( ObjectList<BaseObject>::iterator it = ObjectList<BaseObject>::begin(); it != ObjectList<BaseObject>::end(); ++it)76 if ( it->getName() == this->target_)77 this->addEventTarget( *it);75 for (BaseObject* object : ObjectList<BaseObject>()) 76 if (object->getName() == this->target_) 77 this->addEventTarget(object); 78 78 } 79 79 -
code/branches/cpp11_v2/src/modules/objects/triggers/Trigger.cc
r10916 r10919 346 346 { 347 347 // Iterate over all Triggers. 348 for ( ObjectList<Trigger>::iterator it = ObjectList<Trigger>::begin(); it != ObjectList<Trigger>::end(); ++it)349 it->setVisible(bVisible);348 for (Trigger* trigger : ObjectList<Trigger>()) 349 trigger->setVisible(bVisible); 350 350 } 351 351 -
code/branches/cpp11_v2/src/modules/overlays/hud/HUDRadar.cc
r10917 r10919 165 165 { 166 166 const std::set<RadarViewable*>& objectSet = this->getCreator()->getScene()->getRadar()->getRadarObjects(); 167 std::set<RadarViewable*>::const_iterator it; 168 for( it=objectSet.begin(); it!=objectSet.end(); ++it ) 169 this->addObject(*it); 167 for( RadarViewable* viewable : objectSet ) 168 this->addObject(viewable); 170 169 this->radarTick(0); 171 170 } … … 183 182 184 183 // update the distances for all objects 185 std::map<RadarViewable*,Ogre::PanelOverlayElement*>::iterator it;186 187 184 188 185 if(RadarMode_) … … 201 198 } 202 199 203 for( it = this->radarObjects_.begin(); it != this->radarObjects_.end(); ++it)200 for( const auto& mapEntry : this->radarObjects_ ) 204 201 { 205 202 // Make sure the object really is a WorldEntity 206 const WorldEntity* wePointer = it->first->getWorldEntity();203 const WorldEntity* wePointer = mapEntry.first->getWorldEntity(); 207 204 if( !wePointer ) 208 205 { … … 210 207 assert(0); 211 208 } 212 bool isFocus = ( it->first == focusObject);209 bool isFocus = (mapEntry.first == focusObject); 213 210 // set size to fit distance... 214 211 float distance = (wePointer->getWorldPosition() - this->owner_->getPosition()).length(); … … 217 214 float size; 218 215 if(RadarMode_) 219 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();216 size = maximumDotSize3D_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale(); 220 217 else 221 size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * it->first->getRadarObjectScale();222 it->second->setDimensions(size, size);218 size = maximumDotSize_ * halfDotSizeDistance_ / (halfDotSizeDistance_ + distance) * mapEntry.first->getRadarObjectScale(); 219 mapEntry.second->setDimensions(size, size); 223 220 224 221 // calc position on radar... … … 234 231 int zOrder = determineMap3DZOrder(this->owner_->getPosition(), this->owner_->getOrientation() * WorldEntity::FRONT, this->owner_->getOrientation() * WorldEntity::UP, wePointer->getWorldPosition(), detectionLimit_); 235 232 if(overXZPlain == false /*&& (it->second->getZOrder() > 100 * this->overlay_->getZOrder())*/) // it appears that zOrder of attached Overlayelements is 100 times the zOrder of the Overlay 236 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder);233 mapEntry.second->_notifyZOrder(this->overlay_->getZOrder() * 100 - 70 + zOrder); 237 234 if(overXZPlain == true /*&& (it->second->getZOrder() <= 100 * this->overlay_->getZOrder())*/) 238 it->second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder);235 mapEntry.second->_notifyZOrder(this->overlay_->getZOrder() * 100 + 70 + zOrder); 239 236 } 240 237 else … … 242 239 243 240 coord *= math::pi / 3.5f; // small adjustment to make it fit the texture 244 it->second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f);241 mapEntry.second->setPosition((1.0f + coord.x - size) * 0.5f, (1.0f - coord.y - size) * 0.5f); 245 242 246 243 if( distance < detectionLimit_ || detectionLimit_ < 0 ) 247 it->second->show();244 mapEntry.second->show(); 248 245 else 249 it->second->hide();246 mapEntry.second->hide(); 250 247 251 248 // if this object is in focus, then set the focus marker … … 255 252 this->marker_->setPosition((1.0f + coord.x - size * 1.5f) * 0.5f, (1.0f - coord.y - size * 1.5f) * 0.5f); 256 253 if(RadarMode_) 257 this->marker_->_notifyZOrder( it->second->getZOrder() -1);254 this->marker_->_notifyZOrder(mapEntry.second->getZOrder() -1); 258 255 this->marker_->show(); 259 256 } -
code/branches/cpp11_v2/src/modules/pickup/PickupSpawner.cc
r10765 r10919 158 158 159 159 // Iterate trough all Pawns. 160 for( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)160 for(Pawn* pawn : ObjectList<Pawn>()) 161 161 { 162 162 if(spawner == nullptr) // Stop if the PickupSpawner has been deleted (e.g. because it has run out of pickups to distribute). 163 163 break; 164 164 165 Vector3 distance = it->getWorldPosition() - this->getWorldPosition();166 PickupCarrier* carrier = static_cast<PickupCarrier*>( *it);165 Vector3 distance = pawn->getWorldPosition() - this->getWorldPosition(); 166 PickupCarrier* carrier = static_cast<PickupCarrier*>(pawn); 167 167 // If a PickupCarrier, that fits the target-range of the Pickupable spawned by this PickupSpawner, is in trigger-distance and the carrier is not blocked. 168 168 if(distance.length() < this->triggerDistance_ && carrier != nullptr && this->blocked_.find(carrier) == this->blocked_.end()) 169 169 { 170 170 if(carrier->isTarget(this->pickup_)) 171 this->trigger( *it);171 this->trigger(pawn); 172 172 } 173 173 } -
code/branches/cpp11_v2/src/modules/tetris/Tetris.cc
r10917 r10919 136 136 return false; 137 137 138 for( std::list<StrongPtr<TetrisStone>>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)139 { 140 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone138 for(TetrisStone* someStone : this->stones_) 139 { 140 const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone 141 141 142 142 if((position.x == currentStonePosition.x) && abs(position.y-currentStonePosition.y) < this->center_->getStoneSize()) … … 192 192 193 193 // check for collisions with all stones 194 for( std::list<StrongPtr<TetrisStone>>::const_iterator it = this->stones_.begin(); it != this->stones_.end(); ++it)194 for(TetrisStone* someStone : this->stones_) 195 195 { 196 196 //Vector3 currentStonePosition = rotateVector((*it)->getPosition(), this->activeBrick_->getRotationCount()); 197 const Vector3& currentStonePosition = (*it)->getPosition(); //!< Saves the position of the currentStone197 const Vector3& currentStonePosition = someStone->getPosition(); //!< Saves the position of the currentStone 198 198 199 199 //filter out cases where the falling stone is already below a steady stone -
code/branches/cpp11_v2/src/modules/towerdefense/TowerDefenseEnemy.cc
r10818 r10919 49 49 if (game == nullptr) 50 50 { 51 for ( ObjectList<TowerDefense>::iterator it = ObjectList<TowerDefense>::begin(); it != ObjectList<TowerDefense>::end(); ++it)52 game = *it;51 for (TowerDefense* towerDefense : ObjectList<TowerDefense>()) 52 game = towerDefense; 53 53 } 54 54 return game; -
code/branches/cpp11_v2/src/modules/weapons/projectiles/GravityBombField.cc
r10765 r10919 125 125 126 126 //Check if any pawn is inside the shockwave and hit it with dammage proportional to the distance between explosion centre and pawn. Make sure, the same pawn is damaged only once. 127 for ( ObjectList<Pawn>::iterator it = ObjectList<Pawn>::begin(); it != ObjectList<Pawn>::end(); ++it)127 for (Pawn* pawn : ObjectList<Pawn>()) 128 128 { 129 Vector3 distanceVector = it->getWorldPosition()-this->getWorldPosition();129 Vector3 distanceVector = pawn->getWorldPosition()-this->getWorldPosition(); 130 130 //orxout(debug_output) << "Found Pawn:" << it->getWorldPosition() << endl; 131 131 if(distanceVector.length()< forceSphereRadius_) 132 132 { 133 133 //orxout(debug_output) << "Force sphere radius is: " << forceSphereRadius_ << " Distance to Pawn is: " << distanceVector.length(); 134 if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(), *it) == victimsAlreadyDamaged_.end())134 if (std::find(victimsAlreadyDamaged_.begin(),victimsAlreadyDamaged_.end(),pawn) == victimsAlreadyDamaged_.end()) 135 135 { 136 136 //orxout(debug_output) << "Found Pawn to damage: " << it->getWorldPosition() << endl; 137 137 float damage = FORCE_FIELD_EXPLOSION_DAMMAGE*(1-distanceVector.length()/EXPLOSION_RADIUS); 138 138 //orxout(debug_output) << "Damage: " << damage << endl; 139 it->hit(shooter_, it->getWorldPosition(), nullptr, damage, 0,0);140 victimsAlreadyDamaged_.push_back( *it);139 pawn->hit(shooter_, pawn->getWorldPosition(), nullptr, damage, 0,0); 140 victimsAlreadyDamaged_.push_back(pawn); 141 141 } 142 142 }
Note: See TracChangeset
for help on using the changeset viewer.