diff options
Diffstat (limited to 'Minecraft.World/Explosion.cpp')
| -rw-r--r-- | Minecraft.World/Explosion.cpp | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Minecraft.World/Explosion.cpp b/Minecraft.World/Explosion.cpp index 028ad673..ab305a02 100644 --- a/Minecraft.World/Explosion.cpp +++ b/Minecraft.World/Explosion.cpp @@ -29,9 +29,9 @@ Explosion::Explosion(Level *level, shared_ptr<Entity> source, double x, double y Explosion::~Explosion() { delete random; - for(AUTO_VAR(it, hitPlayers.begin()); it != hitPlayers.end(); ++it) + for( auto& it : hitPlayers ) { - delete it->second; + delete it.second; } } @@ -105,17 +105,14 @@ void Explosion::explode() vector<shared_ptr<Entity> > entities(levelEntities->begin(), levelEntities->end() ); Vec3 *center = Vec3::newTemp(x, y, z); - AUTO_VAR(itEnd, entities.end()); - for (AUTO_VAR(it, entities.begin()); it != itEnd; it++) + for ( auto& e : entities ) { - shared_ptr<Entity> e = *it; //entities->at(i); - // 4J Stu - If the entity is not in a block that would be blown up, then they should not be damaged // Fix for #46606 - TU5: Content: Gameplay: The player can be damaged and killed by explosions behind obsidian walls bool canDamage = false; - for(AUTO_VAR(it2, toBlow.begin()); it2 != toBlow.end(); ++it2) + for ( auto& it2 : toBlow ) { - if(e->bb->intersects(it2->x,it2->y,it2->z,it2->x + 1,it2->y + 1,it2->z + 1)) + if(e->bb->intersects(it2.x,it2.y,it2.z,it2.x + 1,it2.y + 1,it2.z + 1)) { canDamage = true; break; @@ -192,7 +189,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector<TilePos> *toBlo if( fraction == 0 ) fraction = 1; size_t j = toBlowArray->size() - 1; //for (size_t j = toBlowArray->size() - 1; j >= 0; j--) - for(AUTO_VAR(it,toBlowArray->rbegin()); it != toBlowArray->rend(); ++it) + for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); ++it) { TilePos *tp = &(*it); //&toBlowArray->at(j); int xt = tp->x; @@ -249,8 +246,7 @@ void Explosion::finalizeExplosion(bool generateParticles, vector<TilePos> *toBlo if (fire) { - //for (size_t j = toBlowArray->size() - 1; j >= 0; j--) - for(AUTO_VAR(it,toBlowArray->rbegin()); it != toBlowArray->rend(); ++it) + for (auto it = toBlowArray->rbegin(); it != toBlowArray->rend(); ++it) { TilePos *tp = &(*it); //&toBlowArray->at(j); int xt = tp->x; @@ -276,7 +272,7 @@ Explosion::playerVec3Map *Explosion::getHitPlayers() Vec3 *Explosion::getHitPlayerKnockback( shared_ptr<Player> player ) { - AUTO_VAR(it, hitPlayers.find(player)); + auto it = hitPlayers.find(player); if(it == hitPlayers.end() ) return Vec3::newTemp(0.0,0.0,0.0); |
